@Test void load() { StoredPasswordLoader loader = new StoredPasswordLoader(); Bundle bundle = new Bundle(); Element password = createStoredPasswordXml(DocumentTools.INSTANCE.getDocumentBuilder().newDocument()); loader.load(bundle, password); assertFalse(bundle.getStoredPasswords().isEmpty()); assertEquals(1, bundle.getStoredPasswords().size()); assertNotNull(bundle.getStoredPasswords().get("Test")); StoredPassword entity = bundle.getStoredPasswords().get("Test"); assertNotNull(entity); assertEquals("Test", entity.getName()); assertEquals("123qwe", entity.getId()); assertNull(entity.getPassword()); assertPropertiesContent(ImmutableMap.of( "description", "gateway", "usageFromVariable", true ), entity.getProperties()); }
@Override public void load(final Bundle bundle, final Element element) { final Element storedPass = getSingleChildElement(getSingleChildElement(element, RESOURCE), STORED_PASSWD); final String name = getSingleChildElementTextContent(storedPass, NAME); final Map<String, Object> properties = BuilderUtils.mapPropertiesElements(getSingleChildElement(storedPass, PROPERTIES, true), PROPERTIES); StoredPassword password = new StoredPassword(); password.setId(storedPass.getAttribute(ATTRIBUTE_ID)); password.setName(name); password.setProperties(properties); bundle.getStoredPasswords().put(name, password); }
StoredPasswordLoader implements BundleEntityLoader { @Override public void load(final Bundle bundle, final Element element) { final Element storedPass = getSingleChildElement(getSingleChildElement(element, RESOURCE), STORED_PASSWD); final String name = getSingleChildElementTextContent(storedPass, NAME); final Map<String, Object> properties = BuilderUtils.mapPropertiesElements(getSingleChildElement(storedPass, PROPERTIES, true), PROPERTIES); StoredPassword password = new StoredPassword(); password.setId(storedPass.getAttribute(ATTRIBUTE_ID)); password.setName(name); password.setProperties(properties); bundle.getStoredPasswords().put(name, password); } }
StoredPasswordLoader implements BundleEntityLoader { @Override public void load(final Bundle bundle, final Element element) { final Element storedPass = getSingleChildElement(getSingleChildElement(element, RESOURCE), STORED_PASSWD); final String name = getSingleChildElementTextContent(storedPass, NAME); final Map<String, Object> properties = BuilderUtils.mapPropertiesElements(getSingleChildElement(storedPass, PROPERTIES, true), PROPERTIES); StoredPassword password = new StoredPassword(); password.setId(storedPass.getAttribute(ATTRIBUTE_ID)); password.setName(name); password.setProperties(properties); bundle.getStoredPasswords().put(name, password); }  }
StoredPasswordLoader implements BundleEntityLoader { @Override public void load(final Bundle bundle, final Element element) { final Element storedPass = getSingleChildElement(getSingleChildElement(element, RESOURCE), STORED_PASSWD); final String name = getSingleChildElementTextContent(storedPass, NAME); final Map<String, Object> properties = BuilderUtils.mapPropertiesElements(getSingleChildElement(storedPass, PROPERTIES, true), PROPERTIES); StoredPassword password = new StoredPassword(); password.setId(storedPass.getAttribute(ATTRIBUTE_ID)); password.setName(name); password.setProperties(properties); bundle.getStoredPasswords().put(name, password); }  @Override void load(final Bundle bundle, final Element element); @Override String getEntityType(); }
StoredPasswordLoader implements BundleEntityLoader { @Override public void load(final Bundle bundle, final Element element) { final Element storedPass = getSingleChildElement(getSingleChildElement(element, RESOURCE), STORED_PASSWD); final String name = getSingleChildElementTextContent(storedPass, NAME); final Map<String, Object> properties = BuilderUtils.mapPropertiesElements(getSingleChildElement(storedPass, PROPERTIES, true), PROPERTIES); StoredPassword password = new StoredPassword(); password.setId(storedPass.getAttribute(ATTRIBUTE_ID)); password.setName(name); password.setProperties(properties); bundle.getStoredPasswords().put(name, password); }  @Override void load(final Bundle bundle, final Element element); @Override String getEntityType();  }