APISonar


com.facebook.nifty.test.scribe.Client.Log

> com > facebook > nifty > test > scribe > Client > Log
com APIs facebook APIs nifty APIs test APIs scribe APIs Client APIs Log APIs

Example 1
public void testMethodCallsWithNiftyClient()
            throws Exception
    {
        startServer();
        scribe.Client client = makeNiftyClient();
        int max = (int) (Math.random() * 100);
        for (int i = 0; i < max; i++) {
            client.Log(Arrays.asList(new LogEntry("hello", "world " + i)));
        }
    }
Example 2
public void testMaxConnections() throws InterruptedException, TException
    {
        startServer(getThriftServerDefBuilder().limitConnectionsTo(1));
        scribe.Client client1 = makeNiftyClient();
        Assert.assertEquals(client1.Log(Arrays.asList(new LogEntry("client1", "aaa"))), ResultCode.OK);
        Assert.assertEquals(client1.Log(Arrays.asList(new LogEntry("client1", "bbb"))), ResultCode.OK);
        scribe.Client client2 = makeNiftyClient();
        try {
            client2.Log(Arrays.asList(new LogEntry("client2", "ccc")));
        } catch (TTransportException e) {
            // expected
        }
    }
Example 3
public void testClientWithoutCerts() throws InterruptedException, IOException, TException {
        SslServerConfiguration serverConfig = OpenSslServerConfiguration.newBuilder()
                .certFile(getServerCertFile())
                .keyFile(getPrivateKeyFile())
                .allowPlaintext(false)
                .sslVerification(OpenSslServerConfiguration.SSLVerification.VERIFY_REQUIRE)
                .clientCAFile(getClientCertFile())
                .build();

        startServer(getThriftServerDefBuilder(serverConfig, null));
        scribe.Client client = makeNiftyClient(getClientSSLConfiguration());
        client.Log(Arrays.asList(new LogEntry("client", "aaa")));
    }
Example 4
public void testDefaultServerWithClientCert() throws InterruptedException, IOException, TException {
        SslServerConfiguration serverConfig = OpenSslServerConfiguration.newBuilder()
                .certFile(getServerCertFile())
                .keyFile(getPrivateKeyFile())
                .allowPlaintext(false)
                .clientCAFile(getClientCertFile())
                .build();
        ThriftServerDefBuilder builder = getThriftServerDefBuilder(serverConfig, null);
        startServer(builder);
        scribe.Client client1 = makeNiftyClient(getClientSSLConfiguration(null, getClientKeyManagers()));
        Assert.assertEquals(client1.Log(Arrays.asList(new LogEntry("client1", "aaa"))), ResultCode.OK);
    }