@Test public void convertEncodedId() { String securityServerCode = "security-server-foo"; String memberCode = "XRD2:GOV:M4"; SecurityServerId id = securityServerConverter.convertId( memberCode + ":" + securityServerCode); assertEquals("XRD2", id.getXRoadInstance()); assertEquals("GOV", id.getMemberClass()); assertEquals("M4", id.getMemberCode()); assertEquals(securityServerCode, id.getServerCode()); String difficultServerCode = "FOO SS-;/?@=&-X<!-- o -->BAR"; id = securityServerConverter.convertId( memberCode + ":" + difficultServerCode); assertEquals("XRD2", id.getXRoadInstance()); assertEquals("GOV", id.getMemberClass()); assertEquals("M4", id.getMemberCode()); assertEquals(difficultServerCode, id.getServerCode()); }
public SecurityServerId convertId(String encodedId) { validateEncodedString(encodedId); int serverCodeSeparatorIndex = encodedId.lastIndexOf( ENCODED_ID_SEPARATOR); String encodedMemberClientId = encodedId.substring(0, serverCodeSeparatorIndex); ClientId memberClientId = clientConverter.convertId(encodedMemberClientId); String serverCode = encodedId.substring(serverCodeSeparatorIndex + 1); SecurityServerId securityServerId = SecurityServerId.create(memberClientId, serverCode); return securityServerId; }
SecurityServerConverter { public SecurityServerId convertId(String encodedId) { validateEncodedString(encodedId); int serverCodeSeparatorIndex = encodedId.lastIndexOf( ENCODED_ID_SEPARATOR); String encodedMemberClientId = encodedId.substring(0, serverCodeSeparatorIndex); ClientId memberClientId = clientConverter.convertId(encodedMemberClientId); String serverCode = encodedId.substring(serverCodeSeparatorIndex + 1); SecurityServerId securityServerId = SecurityServerId.create(memberClientId, serverCode); return securityServerId; } }
SecurityServerConverter { public SecurityServerId convertId(String encodedId) { validateEncodedString(encodedId); int serverCodeSeparatorIndex = encodedId.lastIndexOf( ENCODED_ID_SEPARATOR); String encodedMemberClientId = encodedId.substring(0, serverCodeSeparatorIndex); ClientId memberClientId = clientConverter.convertId(encodedMemberClientId); String serverCode = encodedId.substring(serverCodeSeparatorIndex + 1); SecurityServerId securityServerId = SecurityServerId.create(memberClientId, serverCode); return securityServerId; } @Autowired  SecurityServerConverter(ClientConverter clientConverter, GlobalConfFacade globalConfFacade); }
SecurityServerConverter { public SecurityServerId convertId(String encodedId) { validateEncodedString(encodedId); int serverCodeSeparatorIndex = encodedId.lastIndexOf( ENCODED_ID_SEPARATOR); String encodedMemberClientId = encodedId.substring(0, serverCodeSeparatorIndex); ClientId memberClientId = clientConverter.convertId(encodedMemberClientId); String serverCode = encodedId.substring(serverCodeSeparatorIndex + 1); SecurityServerId securityServerId = SecurityServerId.create(memberClientId, serverCode); return securityServerId; } @Autowired  SecurityServerConverter(ClientConverter clientConverter, GlobalConfFacade globalConfFacade); SecurityServerId convertId(String encodedId); String convertId(SecurityServerId securityServerId); SecurityServer convert(SecurityServerId securityServerId); List<SecurityServer> convert(Iterable<SecurityServerId> securityServerIds); }
SecurityServerConverter { public SecurityServerId convertId(String encodedId) { validateEncodedString(encodedId); int serverCodeSeparatorIndex = encodedId.lastIndexOf( ENCODED_ID_SEPARATOR); String encodedMemberClientId = encodedId.substring(0, serverCodeSeparatorIndex); ClientId memberClientId = clientConverter.convertId(encodedMemberClientId); String serverCode = encodedId.substring(serverCodeSeparatorIndex + 1); SecurityServerId securityServerId = SecurityServerId.create(memberClientId, serverCode); return securityServerId; } @Autowired  SecurityServerConverter(ClientConverter clientConverter, GlobalConfFacade globalConfFacade); SecurityServerId convertId(String encodedId); String convertId(SecurityServerId securityServerId); SecurityServer convert(SecurityServerId securityServerId); List<SecurityServer> convert(Iterable<SecurityServerId> securityServerIds); static final int SECURITY_SERVER_CODE_INDEX; }