use of org.geosdi.geoplatform.connector.server.security.BasicPreemptiveSecurityConnector in project geo-platform by geosdi.
the class CatalogCapabilitiesTest method testSecureGetCapabilities.
@Ignore("Require to add the SNIPC certificate into default keystore")
@Test
public void testSecureGetCapabilities() throws Exception {
GPCatalogConnectorStore serverConnector = newConnector().withServerUrl(new URL(snipcUrl)).withClientSecurity(new BasicPreemptiveSecurityConnector(snipcUsername, snipcPassword)).build();
CatalogGetCapabilitiesRequest<CapabilitiesType> request = serverConnector.createGetCapabilitiesRequest();
CapabilitiesType response = request.getResponse();
logger.info("CSW SECURE GET_CAPABILITIES VERSION @@@@@@@@@@@@@@@@@@@@@@@ {}", response.getVersion());
}
use of org.geosdi.geoplatform.connector.server.security.BasicPreemptiveSecurityConnector in project geo-platform by geosdi.
the class CatalogGetRecordByIdTest method testSecureSnipc.
@Ignore("Require to add the SNIPC certificate into default keystore")
@Test
public void testSecureSnipc() throws Exception {
URL url = new URL(snipcUrl);
GPSecurityConnector securityConnector = new BasicPreemptiveSecurityConnector(snipcUsername, snipcPassword);
GPCatalogConnectorStore snipcConnector = GPCSWConnectorBuilder.newConnector().withServerUrl(url).withClientSecurity(securityConnector).build();
CatalogGetRecordByIdRequest<GetRecordByIdResponseType> request = snipcConnector.createGetRecordByIdRequest();
request.setId("PCM:901:20101021:112931");
request.setElementSetType(ElementSetType.FULL.toString());
// request.setOutputSchema(OutputSchema.CSW_V202);
GetRecordByIdResponseType response = request.getResponse();
assertEquals(true, response.isSetAbstractRecord());
assertEquals(false, response.isSetAny());
List<JAXBElement<? extends AbstractRecordType>> abstractRecord = response.getAbstractRecord();
assertEquals(1, abstractRecord.size());
logger.info("RECORD @@@@@@@@@@@@@@@@@@ {}", abstractRecord.get(0).getValue());
}
use of org.geosdi.geoplatform.connector.server.security.BasicPreemptiveSecurityConnector in project geo-platform by geosdi.
the class CatalogGetRecordByIdTest method testSecureOutputOriginalSnipc.
/**
* <p>
* SNIPC catalogue is ambiguous so we can't know the OUTPUT SCHEMA and the
* returned Object. For ISO - 19110 the Obeject is
* {@link FCFeatureCatalogueType}. For ISO - 19139 the Object is
* {@link MDMetadataType} </p>
*/
@Ignore("Require to add the SNIPC certificate into default keystore")
@Test
public void testSecureOutputOriginalSnipc() throws Exception {
URL url = new URL(snipcUrl);
GPSecurityConnector securityConnector = new BasicPreemptiveSecurityConnector(snipcUsername, snipcPassword);
GPCatalogConnectorStore snipcConnector = GPCSWConnectorBuilder.newConnector().withServerUrl(url).withClientSecurity(securityConnector).build();
CatalogGetCapabilitiesRequest<CapabilitiesType> requestGetCap = snipcConnector.createGetCapabilitiesRequest();
logger.info("GetCapabilities SNIPC @@@@@@@@@@@@@@@@@@@@@@@@ {}\n", requestGetCap.getResponse());
CatalogGetRecordByIdRequest<GetRecordByIdResponseType> request = snipcConnector.createGetRecordByIdRequest();
request.setId("{3DEE88CB-A0DB-4794-941A-FD8119621A2F}");
request.setElementSetType(ElementSetType.FULL.toString());
request.setOutputSchema(OutputSchema.ORIGINAL);
Object o = request.getResponse();
// MDMetadataType metadata = (MDMetadataType) o;
// Assert.assertNotNull(metadata);
logger.info("FULL METADATA @@@@@@@@@@@@@@@@@@@@@@@@@@@ {}", request.getResponseAsString());
String snipcGetRecordById = "target/snipcGetRecordById.xml";
FileOutputStream fos = null;
try {
fos = new FileOutputStream(snipcGetRecordById);
request.getMarshaller().marshal(o, fos);
} finally {
if (fos != null) {
fos.close();
}
}
}
Aggregations