CreateSecondaryStagingStoreCmd extends BaseCmd { public Map<String, String> getDetails() { Map<String, String> detailsMap = null; if (details != null && !details.isEmpty()) { detailsMap = new HashMap<String, String>(); for (Map<String, String> detail : details.values()) { detailsMap.put(detail.get("key"), detail.get("value")); } } return detailsMap; }  String getUrl(); Long getZoneId(); Map<String, String> getDetails(); String getScope(); String getProviderName(); @Override String getCommandName(); @Override long getEntityOwnerId(); @Override void execute(); static final Logger s_logger; }
@Test public void getDetails() throws IllegalArgumentException, IllegalAccessException { CreateSecondaryStagingStoreCmd cmd = new CreateSecondaryStagingStoreCmd(); HashMap<String, Map<String, String>> details = new HashMap<String, Map<String, String>>(); HashMap<String, String> kv = new HashMap<String, String>(); kv.put("key", "TEST-KEY"); kv.put("value", "TEST-VALUE"); details.put("does not matter", kv); ApiCmdTestUtil.set(cmd, "details", details); Map<String, String> detailsMap = cmd.getDetails(); Assert.assertNotNull(detailsMap); Assert.assertEquals(1, detailsMap.size()); Assert.assertTrue(detailsMap.containsKey("TEST-KEY")); Assert.assertEquals("TEST-VALUE", detailsMap.get("TEST-KEY")); }
@Test public void getDetailsEmpty() throws IllegalArgumentException, IllegalAccessException { CreateSecondaryStagingStoreCmd cmd = new CreateSecondaryStagingStoreCmd(); ApiCmdTestUtil.set(cmd, "details", new HashMap<String, Map<String, String>>()); Assert.assertNull(cmd.getDetails()); }
@Test public void getDetailsNull() throws IllegalArgumentException, IllegalAccessException { CreateSecondaryStagingStoreCmd cmd = new CreateSecondaryStagingStoreCmd(); ApiCmdTestUtil.set(cmd, "details", null); Assert.assertNull(cmd.getDetails()); }