Code example for JSONArray

Methods: put

0
      builder.addRiakObject("first", "key1");
      builder.addRiakObject("second", "key1");
      builder.map(new ErlangFunction("foo", "bar"), true);
 
      JSONObject expected = new JSONObject();
      JSONArray inputs = new JSONArray();
      inputs.put(new String[] {"first", "key1"});
      inputs.put(new String[] {"second", "key1"});
      expected.put("inputs", inputs);
      JSONArray query = new JSONArray("[{\"map\":{\"module\":\"foo\",\"language\":\"erlang\",\"keep\":true,\"function\":\"bar\"}}]");
      expected.put("query", query);
 
      assertTrue("Generated JSON not as expected", JSONEquals.equals(expected, builder.toJSON()));
   } 
 
   @Test public void canBuildErlangMapReduceJobWitObjects() throws JSONException { 
      MapReduceBuilder builder = new MapReduceBuilder();
      builder.setBucket("wubba");
      builder.map(new ErlangFunction("foo", "bar"), false);
      builder.reduce(new ErlangFunction("baz", "quux"), true);