Examples of TestService


Examples of callbacktest.TestService

            checkDomainErr();
            checkDomainOut();
            thisNode.start();

            // Run the client test code.
            TestService tester = ((SCAClient)thisNode).getService(TestService.class, "MyClientComponent/TestService");
            tester.runTest();
            otherNode.checkNodeErr();
            otherNode.checkNodeOut();
            System.out.println("Sleeping ...");
            Thread.sleep(4000);
            otherNode.checkNodeErr();
            otherNode.checkNodeOut();
            assertEquals("-> someMethod -> receiveResult", tester.getResult());
           
            // Stop the client node.
            thisNode.stop();

            // Stop the test nodes.
View Full Code Here

Examples of callbacktest.TestService

            checkDomainErr();
            checkDomainOut();
            thisNode.start();

            // Run the client test code.
            TestService tester = ((SCAClient)thisNode).getService(TestService.class, "MyClientComponent/TestService");
            tester.runTest();
            otherNode.checkNodeErr();
            otherNode.checkNodeOut();
            System.out.println("Sleeping ...");
            Thread.sleep(14000);
            otherNode.checkNodeErr();
            otherNode.checkNodeOut();
            assertEquals("-> someMethod -> receiveResult", tester.getResult());
           
            // Stop the client node.
            thisNode.stop();

            // Stop the test nodes.
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.TestService

        .newBlockingRpcChannel(clientConnectionFactory);
    RpcChannel channel = RpcChannels.newRpcChannel(clientConnectionFactory,
        threadPool);
    BlockingInterface blockingStub = TestService
        .newBlockingStub(blockingChannel);
    TestService stub = TestService.newStub(channel);

    try {
      rpcServer.startServer();
      Thread.sleep(500);
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.TestService

    verifyRequestToSocket(request);
  }

  private FakeCallback callRpc(Request request, ErrorReason reason) {
    SocketRpcController controller = new SocketRpcController();
    TestService service = TestService.newStub(rpcChannel);
    FakeCallback callback = new FakeCallback();
    service.testMethod(controller, request, callback);
    if (reason != null) {
      assertTrue(controller.failed());
      assertEquals(reason, controller.errorReason());
      assertTrue(callback.invoked);
      assertNull(callback.response);
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.TestService

  private FakeCallback callAsyncRpc(Request request, ErrorReason reason,
      boolean hasListener) {
    SocketRpcController controller = new SocketRpcController();
    DelayedExecutor executor = new DelayedExecutor();
    TestService service = TestService.newStub(
        new RpcChannelImpl(connectionFactory, executor));
    FakeCallback callback = new FakeCallback();
    service.testMethod(controller, request, callback);

    assertEquals(hasListener, executor.listener != null);
    if (hasListener) {
      // Callback should not be called yet since it is async
      assertFalse(callback.invoked);
View Full Code Here

Examples of com.googlecode.protobuf.socketrpc.TestProtos.TestService

  }

  private FakeCallback callAsync(SocketRpcChannel rpcChannel,
      Request request, ErrorReason reason) {
    SocketRpcController controller = rpcChannel.newRpcController();
    TestService service = TestService.newStub(rpcChannel);
    FakeCallback callback = new FakeCallback();
    service.testMethod(controller, request, callback);
    if (reason != null) {
      assertTrue(controller.failed());
      assertEquals(reason, controller.errorReason());
      assertTrue(callback.invoked);
      assertNull(callback.response);
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.connection.util.TestService

        //initiate a listen operation
        TestServerEndpoint tse = new TestServerEndpoint(getListenPort());
        BasicJeriExporter exporter =
            new BasicJeriExporter(tse, new BasicILFactory());
        TestServiceImpl service = new TestServiceImpl();
        TestService stub = (TestService) exporter.export(service);
        TestEndpoint te = tse.getTestEndpoint();
        //make a call
        stub.doSomething();
        //Verify that the 3-arg connect method is called
        if (methodCalls.get(connect2)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call 3-arg connect on the ConnectionEndpoint");
        }
        //Verify that the 1-arg connect method is called
        if (methodCalls.get(connect1)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call 1-arg connect on the ConnectionEndpoint");
        }
        //Verify that writeRequestData is called
        if (methodCalls.get(writeRequestData)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call writeRequestData on the Connection");
        }
        //Verify that readResponseData is called
        if (methodCalls.get(readResponseData)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call readResponseData on the Connection");
        }
        //Verify that populateContext is called
        if (methodCalls.get(populateContext)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call populateContext on the Connection");
        }
        //Verify that getUnfulfilledConstraints is called
        if (methodCalls.get(getUnfulfilledConstraints)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call getUnfulfilledConstraints on the"
                + " Connection");
        }
        //Verify that the single-arg connect is not called if the 3-arg
        //connect is called
        clearMethodCalls();
        stub.doSomething();
        //Verify that the 3-arg connect method is called
        if (methodCalls.get(connect2)==null) {
            throw new TestException("The ConnectionManager"
                + " did not call 3-arg connect on the ConnectionEndpoint");
        }
        //Verify that the single-arg connect method is not called
        if (methodCalls.get(connect1)!=null) {
            throw new TestException("The ConnectionManager called"
                + " 1-arg connect even though a connection was returned on"
                + " call to 3-arg connect");
        }
        //Check exceptions
        clearMethodCalls();
        te.setException("connect");
        boolean exceptionThrown = false;
        try {
           stub.doSomething();
        } catch (Exception e) {
            if (e.getMessage().equals("Bogus Exception")) {
                exceptionThrown = true;
            } else {
                e.printStackTrace();
            }
        }
        if (!exceptionThrown) {
            throw new TestException("The ConnectionManager"
                + " does not propagate an exception thrown in"
                + " ConnectionEndpoint.connect");
        }
        clearMethodCalls();
        te.setException("writeRequestData");
        exceptionThrown = false;
        try {
           stub.doSomething();
        } catch (Exception e) {
            if (e.getMessage().equals("Bogus Exception")) {
                exceptionThrown = true;
            } else {
                e.printStackTrace();
View Full Code Here

Examples of com.sun.jini.test.spec.jeri.mux.util.TestService

public class MuxServerTest extends AbstractMuxTest {

    public void run() throws Exception {
        //Setup server side mux connection
        ServerEndpoint se = getServerEndpoint();
        TestService service = new TestServiceImpl();
        int redirectPort = getPort() + 1;
        Redirector rd = new Redirector(getHost(),getPort(),redirectPort);
        ((TestServerEndpoint) se).redirect(redirectPort);
        Thread t = new Thread(rd);
        t.start();
        BasicJeriExporter exporter = new BasicJeriExporter(se,
            new BasicILFactory());
        TestService stub = (TestService) exporter.export(service);
        //Connect to the mux server
        Socket s = new Socket(getHost(),getPort());
        InputStream is = s.getInputStream();
        OutputStream os = s.getOutputStream();
        //Send client connection header
        ClientConnectionHeader cHeader = new ClientConnectionHeader();
        cHeader.send(os);
        //Receive ServerConnection header and verify format
        ServerConnectionHeader sHeader = new ServerConnectionHeader();
        try {
            sHeader.receive(is,getTimeout());
        } catch (ProtocolException e) {
            e.printStackTrace();
            throw new TestException(e.getMessage(),e);
        }
        //Make a remote call that returns something
        stub.doSomething();
        exporter.unexport(true);
        rd.stop();
        //Extract and analyze the messages sent by the mux server
        try {
            analyzeServerDataBytes(rd.getServerConversation());
View Full Code Here

Examples of in.partake.service.impl.TestService

        return null;
    }

    public void createServices() throws Exception {
        super.createServices();
        testService = new TestService();
    }
View Full Code Here

Examples of org.apache.cxf.dosgi.dsw.hooks.TestService

        assertNotNull(serviceProps.get(DistributionProvider.PRODUCT_VERSION));
        assertNotNull(serviceProps.get(DistributionProvider.VENDOR_NAME));
    }
   
    public void testPublishPreexistingServices() throws Exception {
        TestService serviceObject = new TestServiceImpl();

        IMocksControl control = EasyMock.createNiceControl();
       
        Bundle b = control.createMock(Bundle.class);
        Hashtable<String, String> ht = new Hashtable<String, String>();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.