Package com.facebook.nifty.test

Examples of com.facebook.nifty.test.LogEntry


    public void testMethodCalls()
            throws Exception
    {
        startServer();
        scribe.Client client = makeClient();
        client.Log(Arrays.asList(new LogEntry("hello", "world")));
    }
View Full Code Here


    {
        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)));
        }
    }
View Full Code Here

            throws InterruptedException, TException
    {
        startServer(getThriftServerDefBuilder());
        scribe.Client client = makeNiftyClient();
        Thread.sleep(500);
        client.Log(Arrays.asList(new LogEntry("hello", "world")));
    }
View Full Code Here

            throws InterruptedException, TException
    {
        startServer(getThriftServerDefBuilder().clientIdleTimeout(new Duration(250, TimeUnit.MILLISECONDS)));
        scribe.Client client = makeNiftyClient();
        Thread.sleep(500);
        client.Log(Arrays.asList(new LogEntry("hello", "world")));
    }
View Full Code Here

    @Test
    public void testBasic() throws InterruptedException, TException
    {
        startServer();
        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();
        Assert.assertEquals(client2.Log(Arrays.asList(new LogEntry("client2", "ccc"))), ResultCode.OK);
    }
View Full Code Here

    @Test
    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
        }
    }
View Full Code Here

    @Test
    public void testMaxConnections2() 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
        }
        // now need to make sure we didn't double-decrement the number of connections, so try again
        scribe.Client client3 = makeNiftyClient();
        try {
            client3.Log(Arrays.asList(new LogEntry("client3", "ddd")));
            Assert.fail();
        } catch (TTransportException e) {
            // expected
        }
    }
View Full Code Here

        int max = (int) (Math.random() * 100) + 10;
        int exceptionCount = 0;
        for (int i = 0; i < max; i++) {
            Thread.sleep(100L);
            try {
                client.Log(Arrays.asList(new LogEntry("hello", "world " + i)));
            }
            catch (TException e) {
                log.info("caught expected exception " + e.toString());
                exceptionCount++;
            }
View Full Code Here

    @Test
    public void testBasic() throws InterruptedException, TException
    {
        startServer();
        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();
        Assert.assertEquals(client2.Log(Arrays.asList(new LogEntry("client2", "ccc"))), ResultCode.OK);
    }
View Full Code Here

    @Test
    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
        }
    }
View Full Code Here

TOP

Related Classes of com.facebook.nifty.test.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.