Package com.facebook.swift.service

Examples of com.facebook.swift.service.LogEntry


        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);
        }

        stopServer(info);
    }
View Full Code Here


            @Override
            public void onSuccess(AsyncScribe client)
            {
                try {
                    ListenableFuture<ResultCode> methodFuture =
                            client.log(Lists.newArrayList(new LogEntry("testCategory", "testMessage")));
                    Futures.addCallback(methodFuture, new FutureCallback<ResultCode>()
                    {
                        @Override
                        public void onSuccess(ResultCode result)
                        {
View Full Code Here

    {
        // 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

    {
        // 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

        // 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

            assertEquals(server.getLogEntries().size(), 0);

            int serverPort = server.getLocalPort();

            try (Scribe client = createHttpClient(Scribe.class, serverPort).get()) {
                client.log(Lists.newArrayList(new LogEntry("testCategory", "testMessage")));
            }

            // Blocking call completed, check that it was successful in logging a message.
            assertEquals(server.getLogEntries().size(), 1);
        }
View Full Code Here

            {
                @Override
                public void onSuccess(AsyncScribe client)
                {
                    try {
                        ListenableFuture<ResultCode> methodFuture = client.log(Lists.newArrayList(new LogEntry("testCategory", "testMessage")));

                        // Connected a client, and made an async call against it, but the call shouldn't
                        // be completed right away. Check that it isn't.
                        assertEquals(server.getLogEntries().size(), 0);
View Full Code Here

        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);
        }

        stopServer(info);
    }
View Full Code Here

            @Override
            public void onSuccess(AsyncScribe client)
            {
                try {
                    ListenableFuture<ResultCode> methodFuture =
                            client.log(Lists.newArrayList(new LogEntry("testCategory", "testMessage")));
                    Futures.addCallback(methodFuture, new FutureCallback<ResultCode>()
                    {
                        @Override
                        public void onSuccess(ResultCode result)
                        {
View Full Code Here

        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);
        }

        stopServer(info);
    }
View Full Code Here

TOP

Related Classes of com.facebook.swift.service.LogEntry

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.