Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 405cba6b authored by rodrfla's avatar rodrfla
Browse files

EDELIVERY-2641

parents c2b09785 d35f4854
Branches
Tags
1 merge request!26Merge master to development
...@@ -146,17 +146,20 @@ Default implementation example: ...@@ -146,17 +146,20 @@ Default implementation example:
## LIST OF DOCUMENTS ## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier); ServiceGroup serviceGroup = smpClient.getServiceGroup(participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup(); List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); // DEPRECATED
String responseBody = serviceGroup.getResponseBody(); Sring sgResponseBody = serviceGroup.getResponseBody(); // XML RESPONSE
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); ServiceGroupType serviceGroupType = serviceGroup.getOriginalServiceGroup(); // ROOT ELEMENT
List<ServiceMetadataReferenceType> documents = serviceGroupType.getServiceMetadataReferenceCollection().getServiceMetadataReference();
## DOCUMENT DETAIL ## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns")); ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); Endpoint endpoint = serviceMetadata.getEndpoints().get(0); // DEPRECATED
String responseBody = serviceMetadata.getResponseBody(); SignedServiceMetadataType xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); // ROOT ELEMENT
List<ExtensionType> extensions = serviceMetadata.getExtensions(); String smResponseBody = serviceMetadata.getResponseBody(); // XML RESPONSE
EndpointType endpoint = xmlSignedServiceMetadata.getServiceMetadata().getServiceInformation()
.getProcessList().getProcess().get(0).getServiceEndpointList().getEndpoint().get(0);
Customized implementation example: Customized implementation example:
...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende ...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende
.build(); .build();
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis"); ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis");
## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup();
String responseBody = serviceGroup.getResponseBody();
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers();
## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata();
String responseBody = serviceMetadata.getResponseBody();
List<ExtensionType> extensions = serviceMetadata.getExtensions();
## 5. TRUSTABILITY MODEL ## 5. TRUSTABILITY MODEL
......
...@@ -146,17 +146,20 @@ Default implementation example: ...@@ -146,17 +146,20 @@ Default implementation example:
## LIST OF DOCUMENTS ## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier); ServiceGroup serviceGroup = smpClient.getServiceGroup(participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup(); List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); // DEPRECATED
String responseBody = serviceGroup.getResponseBody(); Sring sgResponseBody = serviceGroup.getResponseBody(); // XML RESPONSE
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); ServiceGroupType serviceGroupType = serviceGroup.getOriginalServiceGroup(); // ROOT ELEMENT
List<ServiceMetadataReferenceType> documents = serviceGroupType.getServiceMetadataReferenceCollection().getServiceMetadataReference();
## DOCUMENT DETAIL ## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns")); ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); Endpoint endpoint = serviceMetadata.getEndpoints().get(0); // DEPRECATED
String responseBody = serviceMetadata.getResponseBody(); SignedServiceMetadataType xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); // ROOT ELEMENT
List<ExtensionType> extensions = serviceMetadata.getExtensions(); String smResponseBody = serviceMetadata.getResponseBody(); // XML RESPONSE
EndpointType endpoint = xmlSignedServiceMetadata.getServiceMetadata().getServiceInformation()
.getProcessList().getProcess().get(0).getServiceEndpointList().getEndpoint().get(0);
Customized implementation example: Customized implementation example:
...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende ...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende
.build(); .build();
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis"); ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis");
## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup();
String responseBody = serviceGroup.getResponseBody();
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers();
## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata();
String responseBody = serviceMetadata.getResponseBody();
List<ExtensionType> extensions = serviceMetadata.getExtensions();
## 5. TRUSTABILITY MODEL ## 5. TRUSTABILITY MODEL
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<parent> <parent>
<groupId>eu.europa.ec.dynamic-discovery</groupId> <groupId>eu.europa.ec.dynamic-discovery</groupId>
<artifactId>dynamic-discovery-parent</artifactId> <artifactId>dynamic-discovery-parent</artifactId>
<version>1.4</version> <version>1.5</version>
<relativePath>../dynamic-discovery-parent/pom.xml</relativePath> <relativePath>../dynamic-discovery-parent/pom.xml</relativePath>
</parent> </parent>
<artifactId>dynamic-discovery-client</artifactId> <artifactId>dynamic-discovery-client</artifactId>
......
...@@ -31,11 +31,12 @@ public class DefaultProvider implements IMetadataProvider { ...@@ -31,11 +31,12 @@ public class DefaultProvider implements IMetadataProvider {
@Override @Override
public URI resolveDocumentIdentifiers(URI smpURI, ParticipantIdentifier participantIdentifier) { public URI resolveDocumentIdentifiers(URI smpURI, ParticipantIdentifier participantIdentifier) {
return smpURI.resolve(String.format("/%s", participantIdentifier.urlencoded())); return URI.create(smpURI.toString() + String.format("/%s", participantIdentifier.urlencoded())).normalize();
} }
@Override @Override
public URI resolveServiceMetadata(URI smpURI, ParticipantIdentifier participantIdentifier, DocumentIdentifier documentIdentifier) { public URI resolveServiceMetadata(URI smpURI, ParticipantIdentifier participantIdentifier, DocumentIdentifier
return smpURI.resolve(String.format("/%s/services/%s", participantIdentifier.urlencoded(), documentIdentifier.urlencoded())); documentIdentifier) {
return URI.create(smpURI.toString() + String.format("/%s/services/%s", participantIdentifier.urlencoded(), documentIdentifier.urlencoded())).normalize();
} }
} }
...@@ -50,4 +50,59 @@ public class DefaultProviderTest { ...@@ -50,4 +50,59 @@ public class DefaultProviderTest {
Assert.assertEquals("ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb", participantIdentifier.urlencoded()); Assert.assertEquals("ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb", participantIdentifier.urlencoded());
Assert.assertEquals("ehealth-resid-qns%3A%3Aurn%3A%3Aepsos%23%23services%3Aextended%3Aepsos%3A%3A107", documentIdentifier.urlencoded()); Assert.assertEquals("ehealth-resid-qns%3A%3Aurn%3A%3Aepsos%23%23services%3Aextended%3Aepsos%3A%3A107", documentIdentifier.urlencoded());
} }
@Test
public void resolveDocumentIdentifiersForSmpUnderNonRootContextTest() throws Exception {
//given
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("urn:poland:ncpb", "ehealth-actorid-qns");
DefaultProvider defaultProvider = new DefaultProvider();
//when
String url = defaultProvider.resolveDocumentIdentifiers(new URI("http://host:666/smp_context"), participantIdentifier).toString();
//then
Assert.assertEquals("http://host:666/smp_context/ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb", url);
}
@Test
public void resolveDocumentIdentifiersForSmpUnderRootContextWithExtraSlashTest() throws Exception {
//given
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("urn:poland:ncpb", "ehealth-actorid-qns");
DefaultProvider defaultProvider = new DefaultProvider();
//when
String url = defaultProvider.resolveDocumentIdentifiers(new URI("http://host:666/"), participantIdentifier).toString();
//then
Assert.assertEquals("http://host:666/ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb", url);
}
@Test
public void resolveServiceMetadataForSmpUnderRootContextWithoutLastSlashTest() throws Exception {
//given
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("urn:poland:ncpb", "ehealth-actorid-qns");
DocumentIdentifier documentIdentifier = new DocumentIdentifier("doc_id", "ehealth-resid-qns");
DefaultProvider defaultProvider = new DefaultProvider();
//when
String url = defaultProvider.resolveServiceMetadata(new URI("http://host:666"), participantIdentifier, documentIdentifier).toString();
//then
Assert.assertEquals("http://host:666/ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb/services/ehealth-resid-qns%3A%3Adoc_id", url);
}
@Test
public void resolveServiceMetadataForSmpUnderNonRootContextTest() throws Exception {
//given
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("urn:poland:ncpb", "ehealth-actorid-qns");
DocumentIdentifier documentIdentifier = new DocumentIdentifier("doc_id", "ehealth-resid-qns");
DefaultProvider defaultProvider = new DefaultProvider();
//when
String url = defaultProvider.resolveServiceMetadata(new URI("http://host:666/smp_context"), participantIdentifier, documentIdentifier).toString();
//then
Assert.assertEquals("http://host:666/smp_context/ehealth-actorid-qns%3A%3Aurn%3Apoland%3Ancpb/services/ehealth-resid-qns%3A%3Adoc_id", url);
}
} }
...@@ -146,17 +146,20 @@ Default implementation example: ...@@ -146,17 +146,20 @@ Default implementation example:
## LIST OF DOCUMENTS ## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier); ServiceGroup serviceGroup = smpClient.getServiceGroup(participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup(); List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); // DEPRECATED
String responseBody = serviceGroup.getResponseBody(); Sring sgResponseBody = serviceGroup.getResponseBody(); // XML RESPONSE
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers(); ServiceGroupType serviceGroupType = serviceGroup.getOriginalServiceGroup(); // ROOT ELEMENT
List<ServiceMetadataReferenceType> documents = serviceGroupType.getServiceMetadataReferenceCollection().getServiceMetadataReference();
## DOCUMENT DETAIL ## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns")); ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); Endpoint endpoint = serviceMetadata.getEndpoints().get(0); // DEPRECATED
String responseBody = serviceMetadata.getResponseBody(); SignedServiceMetadataType xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata(); // ROOT ELEMENT
List<ExtensionType> extensions = serviceMetadata.getExtensions(); String smResponseBody = serviceMetadata.getResponseBody(); // XML RESPONSE
EndpointType endpoint = xmlSignedServiceMetadata.getServiceMetadata().getServiceInformation()
.getProcessList().getProcess().get(0).getServiceEndpointList().getEndpoint().get(0);
Customized implementation example: Customized implementation example:
...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende ...@@ -173,19 +176,6 @@ Please replace classes starting with **"Customized"** by implementations extende
.build(); .build();
ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis"); ParticipantIdentifier participantIdentifier = new ParticipantIdentifier("9925:0367302178", "iso6523-actorid-upis");
## LIST OF DOCUMENTS
ServiceGroup serviceGroup = smpClient.getServiceGroup(ParticipantIdentifier participantIdentifier);
ServiceGroupType xmlServiceGroupType = serviceGroup.getOriginalServiceGroup();
String responseBody = serviceGroup.getResponseBody();
List<DocumentIdentifier> documents = serviceGroup.getDocumentIdentifiers();
## DOCUMENT DETAIL
ServiceMetadata serviceMetadata = smpClient.getServiceMetadata(participantIdentifier, new DocumentIdentifier("urn::epsos:services## epsos-21", "epsos-docid-qns"));
SignedServiceMetadata xmlSignedServiceMetadata = serviceMetadata.getOriginalServiceMetadata();
String responseBody = serviceMetadata.getResponseBody();
List<ExtensionType> extensions = serviceMetadata.getExtensions();
## 5. TRUSTABILITY MODEL ## 5. TRUSTABILITY MODEL
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<groupId>eu.europa.ec.dynamic-discovery</groupId> <groupId>eu.europa.ec.dynamic-discovery</groupId>
<artifactId>dynamic-discovery-parent</artifactId> <artifactId>dynamic-discovery-parent</artifactId>
<version>1.4</version> <version>1.5</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<groupId>eu.europa.ec.dynamic-discovery</groupId> <groupId>eu.europa.ec.dynamic-discovery</groupId>
<artifactId>dynamic-discovery-builder</artifactId> <artifactId>dynamic-discovery-builder</artifactId>
<version>1.4</version> <version>1.5</version>
<packaging>pom</packaging> <packaging>pom</packaging>
<name>dynamic-discovery-builder</name> <name>dynamic-discovery-builder</name>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment