@Test public void convertList() throws InvalidRoleNameException { Set<Role> roles1 = Role.getForNames(Arrays.asList("XROAD_SECURITY_OFFICER")); PersistentApiKeyType key1 = new PersistentApiKeyType(ENCODED, roles1); Set<Role> roles2 = Role.getForNames(Arrays.asList("XROAD_SECURITY_OFFICER", "XROAD_REGISTRATION_OFFICER")); PersistentApiKeyType key2 = new PersistentApiKeyType(ENCODED, roles2); List<PublicApiKeyData> list = publicApiKeyDataConverter.convert(Arrays.asList(key1, key2)); assertEquals(2, list.size()); }
public PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType) { PublicApiKeyData publicApiKeyData = new PublicApiKeyData(); publicApiKeyData.setId(persistentApiKeyType.getId()); publicApiKeyData.setKey(persistentApiKeyType.getPlaintTextKey()); publicApiKeyData.setRoles(persistentApiKeyType.getRoles()); return publicApiKeyData; }
PublicApiKeyDataConverter { public PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType) { PublicApiKeyData publicApiKeyData = new PublicApiKeyData(); publicApiKeyData.setId(persistentApiKeyType.getId()); publicApiKeyData.setKey(persistentApiKeyType.getPlaintTextKey()); publicApiKeyData.setRoles(persistentApiKeyType.getRoles()); return publicApiKeyData; } }
PublicApiKeyDataConverter { public PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType) { PublicApiKeyData publicApiKeyData = new PublicApiKeyData(); publicApiKeyData.setId(persistentApiKeyType.getId()); publicApiKeyData.setKey(persistentApiKeyType.getPlaintTextKey()); publicApiKeyData.setRoles(persistentApiKeyType.getRoles()); return publicApiKeyData; }  }
PublicApiKeyDataConverter { public PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType) { PublicApiKeyData publicApiKeyData = new PublicApiKeyData(); publicApiKeyData.setId(persistentApiKeyType.getId()); publicApiKeyData.setKey(persistentApiKeyType.getPlaintTextKey()); publicApiKeyData.setRoles(persistentApiKeyType.getRoles()); return publicApiKeyData; }  PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType); List<PublicApiKeyData> convert(Iterable<PersistentApiKeyType> apiKeys); }
PublicApiKeyDataConverter { public PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType) { PublicApiKeyData publicApiKeyData = new PublicApiKeyData(); publicApiKeyData.setId(persistentApiKeyType.getId()); publicApiKeyData.setKey(persistentApiKeyType.getPlaintTextKey()); publicApiKeyData.setRoles(persistentApiKeyType.getRoles()); return publicApiKeyData; }  PublicApiKeyData convert(PersistentApiKeyType persistentApiKeyType); List<PublicApiKeyData> convert(Iterable<PersistentApiKeyType> apiKeys);  }