Package com.facebook.swift.service

Examples of com.facebook.swift.service.ThriftClientManager$ThriftInvocationHandler


  /**
   * Try to establish new connection to JobProgressTracker
   */
  private void resetConnection() throws ExecutionException,
      InterruptedException {
    clientManager = new ThriftClientManager();
    FramedClientConnector connector =
        new FramedClientConnector(new InetSocketAddress(
            JOB_PROGRESS_SERVICE_HOST.get(conf),
            JOB_PROGRESS_SERVICE_PORT.get(conf)));
    jobProgressTracker =
View Full Code Here


    @Override
    public ThriftClientManager get()
    {
        if (maxFrameSize == null) {
            return new ThriftClientManager();
        }

        return new ThriftClientManager(maxFrameSize);
    }
View Full Code Here

    @Test
    public void testUnframedSyncMethod()
            throws Exception
    {
        TestServerInfo info = startServer();
        ThriftClientManager clientManager = new ThriftClientManager();

        try (Scribe client = createUnframedClient(clientManager, Scribe.class, info.port).get()) {
            ResultCode result = client.log(Lists.newArrayList(
                    new LogEntry("testCategory", "testMessage")));
            assertEquals(result, ResultCode.OK);
View Full Code Here

    @Test
    public void testUnframedAsyncMethod()
            throws Exception
    {
        TestServerInfo info = startServer();
        ThriftClientManager clientManager = new ThriftClientManager();
        final CountDownLatch latch = new CountDownLatch(1);
        final ResultCode[] resultHolder = new ResultCode[0];

        ListenableFuture<AsyncScribe> clientFuture = createUnframedClient(clientManager, AsyncScribe.class, info.port);
        Futures.addCallback(clientFuture, new FutureCallback<AsyncScribe>()
View Full Code Here

    public void setupTest() throws Exception {
        // TODO: move this to setupSuite when TestNG/surefire integration is fixed
        handler = handlerClass.newInstance();
        server = createServer(handler).start();

        clientManager = new ThriftClientManager(codecManager);
        client = createClient(clientManager).get();
    }
View Full Code Here

    public void testBinaryProtocolClient()
            throws Exception
    {
        // Server and client use binary protocol
        try (ScopedServer server = new ScopedServer(new TBinaryProtocol.Factory());
             ThriftClientManager manager = new ThriftClientManager();
             Scribe client = createScribeClient(manager, server, new TBinaryProtocol.Factory())) {
            client.log(ImmutableList.of(new LogEntry("testCategory1", "testMessage1"),
                                        new LogEntry("testCategory2", "testMessage2")));
        }
    }
View Full Code Here

    public void testCompactProtocolClient()
            throws Exception
    {
        // Server and client use compact protocol
        try (ScopedServer server = new ScopedServer(new TCompactProtocol.Factory());
             ThriftClientManager manager = new ThriftClientManager();
             Scribe client = createScribeClient(manager, server, new TCompactProtocol.Factory())) {
            client.log(ImmutableList.of(new LogEntry("testCategory1", "testMessage1"),
                                        new LogEntry("testCategory2", "testMessage2")));
        }
    }
View Full Code Here

    {
        // Setup a server to accept compact protocol, and try to send it a message with a binary
        // protocol client. Server should disconnect the client while client is trying to read the
        // response, so we should get a TTransportException
        try (ScopedServer server = new ScopedServer(new TCompactProtocol.Factory());
             ThriftClientManager manager = new ThriftClientManager();
             Scribe client = createScribeClient(manager, server, new TBinaryProtocol.Factory())) {
            client.log(ImmutableList.of(new LogEntry("testCategory1", "testMessage1"),
                                        new LogEntry("testCategory2", "testMessage2")));
        }
    }
View Full Code Here

    @BeforeMethod(alwaysRun = true)
    public void setup()
            throws IllegalAccessException, InstantiationException, TException
    {
        codecManager = new ThriftCodecManager();
        clientManager = new ThriftClientManager(codecManager);
    }
View Full Code Here

    @Test
    public void testUnframedSyncMethod()
            throws Exception
    {
        TestServerInfo info = startServer();
        ThriftClientManager clientManager = new ThriftClientManager();

        try (Scribe client = createUnframedClient(clientManager, Scribe.class, info.port).get()) {
            ResultCode result = client.log(Lists.newArrayList(
                    new LogEntry("testCategory", "testMessage")));
            assertEquals(result, ResultCode.OK);
View Full Code Here

TOP

Related Classes of com.facebook.swift.service.ThriftClientManager$ThriftInvocationHandler

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.