@Override void perform() throws IOException { NamespaceDescriptor selected = selectNamespace(namespaceMap); if (selected == null) { return; } Admin admin = connection.getAdmin(); try { String namespaceName = selected.getName(); LOG.info("Modifying namespace :" + selected); NamespaceDescriptor modifiedNsd = NamespaceDescriptor.create(namespaceName).build(); String nsValueNew; do { nsValueNew = String.format("%010d", RandomUtils.nextInt(Integer.MAX_VALUE)); } while (selected.getConfigurationValue(nsTestConfigKey).equals(nsValueNew)); modifiedNsd.setConfiguration(nsTestConfigKey, nsValueNew); admin.modifyNamespace(modifiedNsd); NamespaceDescriptor freshNamespaceDesc = admin.getNamespaceDescriptor(namespaceName); Assert.assertTrue( "Namespace: " + selected + " was not modified", freshNamespaceDesc.getConfigurationValue(nsTestConfigKey).equals(nsValueNew)); LOG.info("Modified namespace :" + freshNamespaceDesc); namespaceMap.put(namespaceName, freshNamespaceDesc); } catch (Exception e) { LOG.warn("Caught exception in action: " + this.getClass()); throw e; } finally { admin.close(); } verifyNamespaces(); }
private NamespaceDescriptor createNamespaceDesc() { String namespaceName = "itnamespace" + String.format("%010d", RandomUtils.nextInt(Integer.MAX_VALUE)); NamespaceDescriptor nsd = NamespaceDescriptor.create(namespaceName).build(); nsd.setConfiguration( nsTestConfigKey, String.format("%010d", RandomUtils.nextInt(Integer.MAX_VALUE))); return nsd; }