@Test public void testParseProducer1() throws XRd4JException { String serviceId = "FI_PILOT.GOV.0245437-2.ConsumerService.getOrganizationList.v1"; ConsumerEndpoint consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals("ConsumerService", consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("v1", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.ConsumerService2.getOrganizationList.V1"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals("ConsumerService2", consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("V1", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.ConsumerService2.getOrganizationList.V1_0"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals("ConsumerService2", consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("V1_0", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.ConsumerService.getOrganizationList1"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals("ConsumerService", consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList1", consumerEndpoint.getProducer().getServiceCode()); assertEquals(null, consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList2"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList2", consumerEndpoint.getProducer().getServiceCode()); assertEquals(null, consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.v1"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("v1", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.V11"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("V11", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.1"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("1", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.1_0"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("1_0", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.1-0"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals(null, consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getServiceCode()); assertEquals("1-0", consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV.0245437-2.getOrganizationList.ve1"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(true, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); assertEquals(serviceId, consumerEndpoint.getProducer().toString()); assertEquals("FI_PILOT", consumerEndpoint.getProducer().getXRoadInstance()); assertEquals("GOV", consumerEndpoint.getProducer().getMemberClass()); assertEquals("0245437-2", consumerEndpoint.getProducer().getMemberCode()); assertEquals("getOrganizationList", consumerEndpoint.getProducer().getSubsystemCode()); assertEquals("ve1", consumerEndpoint.getProducer().getServiceCode()); assertEquals(null, consumerEndpoint.getProducer().getServiceVersion()); serviceId = "FI_PILOT.GOV"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(false, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); serviceId = "FI_PILOT.GOV.0245437-2"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(false, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); serviceId = "FI_PILOT.GOV.0245437-2.subsystem.service.v1.0"; consumerEndpoint = new ConsumerEndpoint(serviceId, null, null); assertEquals(false, ConsumerGatewayUtil.setProducerMember(consumerEndpoint)); }
protected static boolean setProducerMember(ConsumerEndpoint endpoint) { ProducerMember producer = ConfigurationHelper.parseProducerMember(endpoint.getServiceId()); if (producer == null) { log.warn("ProducerMember not found."); return false; } endpoint.setProducer(producer); log.debug("ProducerMember id : \"{}\".", producer.toString()); return true; }
ConsumerGatewayUtil { protected static boolean setProducerMember(ConsumerEndpoint endpoint) { ProducerMember producer = ConfigurationHelper.parseProducerMember(endpoint.getServiceId()); if (producer == null) { log.warn("ProducerMember not found."); return false; } endpoint.setProducer(producer); log.debug("ProducerMember id : \"{}\".", producer.toString()); return true; } }
ConsumerGatewayUtil { protected static boolean setProducerMember(ConsumerEndpoint endpoint) { ProducerMember producer = ConfigurationHelper.parseProducerMember(endpoint.getServiceId()); if (producer == null) { log.warn("ProducerMember not found."); return false; } endpoint.setProducer(producer); log.debug("ProducerMember id : \"{}\".", producer.toString()); return true; } private  ConsumerGatewayUtil(); }
ConsumerGatewayUtil { protected static boolean setProducerMember(ConsumerEndpoint endpoint) { ProducerMember producer = ConfigurationHelper.parseProducerMember(endpoint.getServiceId()); if (producer == null) { log.warn("ProducerMember not found."); return false; } endpoint.setProducer(producer); log.debug("ProducerMember id : \"{}\".", producer.toString()); return true; } private  ConsumerGatewayUtil(); static Map<String, ConsumerEndpoint> extractConsumers(Properties endpoints, Properties gatewayProperties); static void extractEndpoints(String key, Properties endpoints, ConsumerEndpoint endpoint); static ConsumerEndpoint findMatch(String serviceId, Map<String, ConsumerEndpoint> endpoints); static String rewriteUrl(String servletUrl, String pathToResource, String responseStr); static ConsumerEndpoint createUnconfiguredEndpoint(Properties props, String pathToResource); static String removeResponseTag(String message); static boolean checkEncryptionProperties(Properties props, Map<String, ConsumerEndpoint> endpoints,
                                                    Map<String, Encrypter> asymmetricEncrypterCache); }
ConsumerGatewayUtil { protected static boolean setProducerMember(ConsumerEndpoint endpoint) { ProducerMember producer = ConfigurationHelper.parseProducerMember(endpoint.getServiceId()); if (producer == null) { log.warn("ProducerMember not found."); return false; } endpoint.setProducer(producer); log.debug("ProducerMember id : \"{}\".", producer.toString()); return true; } private  ConsumerGatewayUtil(); static Map<String, ConsumerEndpoint> extractConsumers(Properties endpoints, Properties gatewayProperties); static void extractEndpoints(String key, Properties endpoints, ConsumerEndpoint endpoint); static ConsumerEndpoint findMatch(String serviceId, Map<String, ConsumerEndpoint> endpoints); static String rewriteUrl(String servletUrl, String pathToResource, String responseStr); static ConsumerEndpoint createUnconfiguredEndpoint(Properties props, String pathToResource); static String removeResponseTag(String message); static boolean checkEncryptionProperties(Properties props, Map<String, ConsumerEndpoint> endpoints,
                                                    Map<String, Encrypter> asymmetricEncrypterCache);  }