コード例 #1
0
  @Test
  public void testDatabagAllInOne() throws Exception {
    final String bagContent = "{\"One\":\"one\", " + "\"Two\":\"two\"}";
    ChefUtil.createDatabagItem(bag1, "item1", bagContent);
    ChefUtil.createDatabagItem(bag1, "item2", bagContent);

    String json = ChefUtil.getDatabagItem(bag1, "item1");
    assertThat("Databag is created, item set.", json, containsString("Two"));

    ChefUtil.deleteDatabagItem(bag1, "item1");
    ChefUtil.deleteDatabag(bag1);
  }
コード例 #2
0
  @Test
  public void testDatabag() throws Exception {
    String json = ChefUtil.createDatabag(bag1);
    assertThat("Databag is created.", json, containsString(bag1));

    json = ChefUtil.createDatabagItem(bag1, "item1");
    assertThat("Databag item is created.", json, containsString("\"id\":\"item1\""));
    final String databag = ChefUtil.getDatabag(bag1);
    logger.debug("Got databag:" + databag);
    // final JsonNode json = JsonUtil.load(databag);
    ChefUtil.putDatabagItem(bag1, "item1", "{\"id\":\"item1\",\"f\":\"fff\"}");
    json = ChefUtil.getDatabagItem(bag1, "item1");
    assertThat("Databag item put ok.", json, containsString("\"f\":\"fff\""));

    ChefUtil.deleteDatabagItem(bag1, "item1");
    ChefUtil.deleteDatabag(bag1);
  }
コード例 #3
0
 @AfterClass
 public static void cleanupCreated() throws Exception {
   try {
     ChefUtil.deleteClient(name1);
   } catch (Exception e) {
     // ignore.
   }
   try {
     ChefUtil.deleteDatabag(bag1);
   } catch (Exception e) {
     // ignore.
   }
   try {
     ChefUtil.deleteNode(name1);
   } catch (Exception e) {
     // ignore.
   }
 }