Package org.sdnplatform.sync.client

Examples of org.sdnplatform.sync.client.SyncClient$GetCommand


        scs.storeName = "global";
        scs.debug = true;
        scs.authScheme = AuthScheme.CHALLENGE_RESPONSE;
        scs.keyStorePath = keyStoreFile.getAbsolutePath();
        scs.keyStorePassword = keyStorePassword;
        SyncClient client = new SyncClient(scs);
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        ByteArrayOutputStream err = new ByteArrayOutputStream();
        client.err = new PrintStream(err);
        client.connect();
        client.executeCommandLine("get \"key\"");
        assertEquals("", err.toString());
        assertEquals("Using remote sync service at localhost:40101\n" +
                "Getting Key:\n" +
                "\"key\"\n\n" +
                "Not found\n",
                out.toString());
       
        out = new ByteArrayOutputStream();
        err = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        client.err = new PrintStream(err);
        client.executeCommandLine("put \"key\" {\"field1\": \"value1\", \"field2\": \"value2\"}");
        assertEquals("", err.toString());
        assertEquals("Putting Key:\n" +
                "\"key\"\n\n" +
                "Value:\n" +
                "{\n" +
                "  \"field1\" : \"value1\",\n" +
                "  \"field2\" : \"value2\"\n" +
                "}\n" +
                "Success\n",
                out.toString());
       
        out = new ByteArrayOutputStream();
        err = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        client.err = new PrintStream(err);
        client.executeCommandLine("get \"key\"");
        assertEquals("", err.toString());
        assertEquals("Getting Key:\n" +
                "\"key\"\n\n" +
                "Value:\n" +
                "{\n" +
                "  \"field1\" : \"value1\",\n" +
                "  \"field2\" : \"value2\"\n" +
                "}\n",
                out.toString());
       
        out = new ByteArrayOutputStream();
        err = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        client.err = new PrintStream(err);
        client.executeCommandLine("delete \"key\"");
        assertEquals("", err.toString());
        assertEquals("Deleting Key:\n" +
                "\"key\"\n\n" +
                "Success\n",
                out.toString());
       
        out = new ByteArrayOutputStream();
        err = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        client.err = new PrintStream(err);
        client.executeCommandLine("get \"key\"");
        assertEquals("", err.toString());
        assertEquals("Getting Key:\n" +
                "\"key\"\n\n" +
                "Not found\n",
                out.toString());
       
        out = new ByteArrayOutputStream();
        err = new ByteArrayOutputStream();
        client.out = new PrintStream(out);
        client.err = new PrintStream(err);
        client.executeCommandLine("quit");
        assertEquals("", err.toString());
        assertEquals("",
                out.toString());
       
        client.executeCommandLine("help");
        assert(!"".equals(out.toString()));
    }
View Full Code Here

TOP

Related Classes of org.sdnplatform.sync.client.SyncClient$GetCommand

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.