@Test public void convertNewKey() throws InvalidRoleNameException { Set<Role> roles = Role.getForNames(Arrays.asList("XROAD_SECURITY_OFFICER", "XROAD_REGISTRATION_OFFICER")); PersistentApiKeyType key = new PersistentApiKeyType(PLAIN, ENCODED, roles); PublicApiKeyData publicApiKeyData = publicApiKeyDataConverter.convert(key); assertEquals(null, publicApiKeyData.getId()); assertEquals(PLAIN, publicApiKeyData.getKey()); assertEquals(2, publicApiKeyData.getRoles().size()); assertTrue(publicApiKeyData.getRoles().contains(Role.XROAD_REGISTRATION_OFFICER)); }
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);  }