Package com.walmartlabs.mupd8.network.client

Examples of com.walmartlabs.mupd8.network.client.Client$Endpoint


  @SuppressWarnings("unchecked")
    public void testConfigDirLoad() throws Exception {
        String dir =
            this.getClass().getClassLoader().getResource( "testapp").getPath();
        Config config = new Config( new File( dir));
        String[] paths = { "mupd8", "application", "TestApp", "performers", "K1Updater", "class"};
        String k1Updater = ( String) config.getScopedValue( paths);
        assertEquals("check performer class value", "com.walmartlabs.mupd8.examples.KnUpdaterJson", k1Updater);
        String[] cassPath = { "mupd8", "slate_store", "keyspace"};
        assertEquals("check slate_store" , "Mupd8", ( String) config.getScopedValue( cassPath));

        JSONObject performerConfig = config.workerJSONs.get("K1Updater");
        assertEquals("workerJSONs defined in directory configuration", k1Updater, (String) performerConfig.get("class"));

        String sys =
            this.getClass().getClassLoader().getResource( "testapp/sys_old").getPath();
        String app =
            this.getClass().getClassLoader().getResource( "testapp/app_old").getPath();

        Config newConfig = new Config(sys, app);
        String[] clPath = { "mupd8", "application" };
        java.util.HashMap<String, Object> testApp = ( java.util.HashMap<String, Object>) newConfig.getScopedValue( clPath);
        String firstKey = ( String) testApp.keySet().toArray()[0];
        assertEquals("contains TestApp", "TestApp", firstKey);

        performerConfig = newConfig.workerJSONs.get("K1Updater");
        assertEquals("workerJSONs defined in sys/app configuration", "com.walmartlabs.mupd8.examples.KnUpdater", (String) performerConfig.get("class"));
View Full Code Here


        assertTrue("HasNext should not consume data",kafkaSource.hasNext());
    }

    public void testNext() {
        assertTrue("HasNext should return true when data", kafkaSource.hasNext());
        Mupd8DataPair mupd8DataPair = kafkaSource.getNextDataPair();
        assertEquals("Next should return the correct message",val,mupd8DataPair._key.toString());
        produceNonJsonMessage();
        mupd8DataPair = kafkaSource.getNextDataPair();
        assertEquals("Next should return the next correct message",val, new String(mupd8DataPair._value));
        assertNull("Next should return the null val for missing key", mupd8DataPair._key);
View Full Code Here

    @Override
    public Mupd8DataPair getNextDataPair() {
         try {
            byte[] msg = consumerIterator.next().message();
            Mupd8DataPair ret = new Mupd8DataPair();
            ret._value = msg;
            ret._key = getValue(key,msg);
            return ret;
         } catch (Exception e) {
            LOG.error("Exception in getting next value from consumer stream", e);
View Full Code Here

        if (service.endpoints == null) {
            service.endpoints = Lists.newArrayList();
        }

        for (String interfaceName : new String[] { "public", "internal", "admin" }) {
            Endpoint endpoint = new Endpoint();
            service.endpoints.add(endpoint);

            endpoint.id = service.id + "-" + interfaceName;
            endpoint.name = service.name;
            endpoint.interfaceName = interfaceName;
View Full Code Here

            setService(svc.getName());
        } else {
            throw new DeploymentException(
                            "If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint()
                                + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService()
                            + "' must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService() + "' "
                                             + "must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

        try {
            String url = PersonHttpTest.class.getResource(wsdlResource).toString();
            WSDLReader reader = WSDLFactory.newInstance().newWSDLReader();
            DescriptionElement descElement = reader.readWSDL(url);
            Description desc = descElement.toComponent();
            Endpoint endpoint = desc.getServices()[0].getEndpoints()[0];
            Binding<?> binding = BindingFactory.createBinding(endpoint);
            assertNotNull(binding);
            return binding;
        } catch (WSDLException e) {
            throw new RuntimeException(e);
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException("Cound not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException("If endpoint is not set, the WSDL service '" + getService() + "' "
                                             + "must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

            svc = desc.getServices()[0];
            setService(svc.getName());
        } else {
            throw new DeploymentException("If service is not set, the WSDL must contain a single service definition");
        }
        Endpoint endpoint;
        if (getEndpoint() != null) {
            endpoint = svc.getEndpoint(new NCName(getEndpoint()));
            if (endpoint == null) {
                throw new DeploymentException(
                        "Could not find endpoint '" + getEndpoint() + "' in wsdl for service '" + getService() + "'");
            }
        } else if (svc.getEndpoints().length == 1) {
            endpoint = svc.getEndpoints()[0];
            setEndpoint(endpoint.getName().toString());
        } else {
            throw new DeploymentException(
                    "If endpoint is not set, the WSDL service '" + getService() + "' must contain a single port definition");
        }
        marshaler.setBinding(BindingFactory.createBinding(endpoint));
View Full Code Here

        if (endpoints.length == 0) {
            throw new AxisFault("No endpoints found in the WSDL");
        }

        processedBindings = new HashMap();
        Endpoint endpoint = null;

        // If the interface name is not null thats means that this is a call from the codegen engine
        // and we need to populate a single endpoint. Hence find the endpoint and populate it.
        // If that was not the case then we need to check whether the call is from the codegen
        // engine with thw allports check false. If its so no need to populate all endpoints, we
        // select an enspoint accrding to the following criteria.
        // 1. Find the first SOAP 1.2 endpoint
        // 2. Find the first SOAP 1.1 endpoint
        // 3. Use the first endpoint
        if (this.interfaceName != null) {
            for (int i = 0; i < endpoints.length; ++i) {
                if (this.interfaceName.equals(endpoints[i].getName().toString())) {
                    endpoint = endpoints[i];
                    break// found it.  Stop looking
                }
            }
            if (endpoint == null) {
                throw new AxisFault("No endpoint found for the given name :"
                        + this.interfaceName);
            }

            axisService
                    .addEndpoint(endpoint.getName().toString(),
                                 processEndpoint(endpoint, serviceInterface));
        } else if (this.isCodegen && !this.isAllPorts) {
            Endpoint soap11Endpoint = null;
            for (int i = 0; i < endpoints.length; ++i) {
                Binding binding = endpoints[i].getBinding();
                if (WSDL2Constants.URI_WSDL2_SOAP.equals(binding.getType().toString())) {
                    SOAPBindingExtensions soapBindingExtensions;
                    try {
View Full Code Here

TOP

Related Classes of com.walmartlabs.mupd8.network.client.Client$Endpoint

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.