Package com.facebook.swift.service

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


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


        ThriftServiceProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), puma);

        // create server and client
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
            // invoke puma
            List<ReadResultQueryInfoTimeString> results = pumaClient.getResultTimeString(PUMA_REQUEST);
View Full Code Here

        puma.setException(exception);

        TProcessor processor = new ThriftServiceProcessor(new ThriftCodecManager(), puma);
        try (
                ThriftServer server = new ThriftServer(processor).start();
                ThriftClientManager clientManager = new ThriftClientManager();
                PumaReadService pumaClient = clientManager.createClient(
                        new FramedClientConnector(HostAndPort.fromParts("localhost", server.getPort())),
                        PumaReadService.class).get()
        ) {
            pumaClient.getResultTimeString(PUMA_REQUEST);
            fail("Expected ReadSemanticException");
View Full Code Here


    public HiveMetaStoreClient(HiveConf conf)
        throws MetaException
    {
        this.thriftClientManager = closer.register(new ThriftClientManager());

        if (conf == null) {
            conf = new HiveConf(HiveMetaStoreClient.class);
        }
        this.conf = conf;
View Full Code Here


    public HiveMetaStoreClient(HiveConf conf)
        throws MetaException
    {
        this.thriftClientManager = closer.register(new ThriftClientManager());

        if (conf == null) {
            conf = new HiveConf(HiveMetaStoreClient.class);
        }
        this.conf = conf;
View Full Code Here

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

    @Test
    public void testHttpClient()
            throws Exception
    {
        try (HttpScribeServer server = new HttpScribeServer();
             ThriftClientManager clientManager = new ThriftClientManager())
        {
            server.start();

            // Server was just started, it shouldn't have recorded any messages yet
            assertEquals(server.getLogEntries().size(), 0);
View Full Code Here

    @Test
    public void testHttpAsyncClient()
            throws Exception
    {
        try (final HttpScribeServer server = new HttpScribeServer();
             ThriftClientManager clientManager = new ThriftClientManager())
        {
            server.start();
            final CountDownLatch latch = new CountDownLatch(1);

            // Server was just started, it shouldn't have recorded any messages yet
View Full Code Here

        // Stop server
        serverLifeCycleManager.stop();
    }

    private static void sendClientRequest(Injector clientInjector, int serverPort) throws InterruptedException, ExecutionException {
        ThriftClientManager clientManager = clientInjector.getInstance(ThriftClientManager.class);
        ThriftClient<HeaderUsageExampleClient> clientFactory = clientInjector.getInstance(Key.get(new TypeLiteral<ThriftClient<HeaderUsageExampleClient>>() {
        }));
        HeaderUsageExampleClient client = clientFactory.open(new HeaderClientConnector(HostAndPort.fromParts("localhost", serverPort))).get();

        TProtocol outputProtocol = clientManager.getOutputProtocol(client);
        TTransport outputTransport = outputProtocol.getTransport();
        if (outputTransport instanceof THeaderTransport) {
            LOG.info("adding headers to next client request");
            THeaderTransport headerTransport = (THeaderTransport) outputTransport;
            headerTransport.setHeader("header_from", "client");
        }
        else {
            LOG.info("output transport for client was not THeaderTransport, client cannot send headers");
        }

        client.headerUsageExampleMethod();

        TProtocol inputProtocol = clientManager.getInputProtocol(client);
        TTransport inputTransport = inputProtocol.getTransport();
        if (inputTransport instanceof THeaderTransport) {
            LOG.info("headers received from the server in the response:");
            THeaderTransport headerTransport = (THeaderTransport) outputTransport;
            for (String key : headerTransport.getReadHeaders().keySet()) {
View Full Code Here

     *
     * {@link ClientExampleHelper} is used only to make the actually thrift method calls
     */
    private static void plainClientExample() throws ExecutionException, InterruptedException
    {
        try (ThriftClientManager clientManager = new ThriftClientManager();
             ExampleService rawClient = clientManager.createClient(ClientExampleHelper.getConnector(),
                                                                    ExampleService.class).get())
        {
            ClientExampleHelper.executeWithClientAndInput(rawClient, "plainClientExample");
        }
    }
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.