use of net.opengis.sos.x20.CapabilitiesType in project midpoint by Evolveum.
the class AbstractBasicDummyTest method test025CapabilitiesRepo.
/**
* Check if the cached native capabilities were properly stored in the repo
*/
@Test
public void test025CapabilitiesRepo() throws Exception {
final String TEST_NAME = "test025CapabilitiesRepo";
TestUtil.displayTestTile(TEST_NAME);
// GIVEN
OperationResult result = new OperationResult(AbstractBasicDummyTest.class.getName() + "." + TEST_NAME);
// WHEN
PrismObject<ResourceType> resource = repositoryService.getObject(ResourceType.class, RESOURCE_DUMMY_OID, null, result);
;
// THEN
result.computeStatus();
display("getObject result", result);
TestUtil.assertSuccess(result);
// Check native capabilities
ResourceType resourceType = resource.asObjectable();
CapabilitiesType capabilitiesType = resourceType.getCapabilities();
assertNotNull("No capabilities in repo, the capabilities were not cached", capabilitiesType);
CapabilityCollectionType nativeCapabilities = capabilitiesType.getNative();
System.out.println("Native capabilities: " + PrismTestUtil.serializeAnyDataWrapped(nativeCapabilities));
System.out.println("resource: " + resourceType.asPrismObject().debugDump());
List<Object> nativeCapabilitiesList = nativeCapabilities.getAny();
assertFalse("Empty capabilities returned", nativeCapabilitiesList.isEmpty());
CredentialsCapabilityType capCred = CapabilityUtil.getCapability(nativeCapabilitiesList, CredentialsCapabilityType.class);
assertNotNull("password native capability not present", capCred.getPassword());
ActivationCapabilityType capAct = CapabilityUtil.getCapability(nativeCapabilitiesList, ActivationCapabilityType.class);
if (supportsActivation()) {
assertNotNull("native activation capability not present", capAct);
assertNotNull("native activation status capability not present", capAct.getStatus());
} else {
assertNull("native activation capability sneaked in", capAct);
}
TestConnectionCapabilityType capTest = CapabilityUtil.getCapability(nativeCapabilitiesList, TestConnectionCapabilityType.class);
assertNotNull("native test capability not present", capTest);
ScriptCapabilityType capScript = CapabilityUtil.getCapability(nativeCapabilitiesList, ScriptCapabilityType.class);
assertNotNull("native script capability not present", capScript);
assertNotNull("No host in native script capability", capScript.getHost());
assertFalse("No host in native script capability", capScript.getHost().isEmpty());
// TODO: better look inside
CachingMetadataType repoCapabilitiesCachingMetadataType = capabilitiesType.getCachingMetadata();
assertNotNull("No repo capabilities caching metadata", repoCapabilitiesCachingMetadataType);
assertNotNull("No repo capabilities caching metadata timestamp", repoCapabilitiesCachingMetadataType.getRetrievalTimestamp());
assertNotNull("No repo capabilities caching metadata serial number", repoCapabilitiesCachingMetadataType.getSerialNumber());
assertEquals("Repo capabilities caching metadata timestamp does not match previously returned value", capabilitiesCachingMetadataType.getRetrievalTimestamp(), repoCapabilitiesCachingMetadataType.getRetrievalTimestamp());
assertEquals("Repo capabilities caching metadata serial does not match previously returned value", capabilitiesCachingMetadataType.getSerialNumber(), repoCapabilitiesCachingMetadataType.getSerialNumber());
assertSteadyResource();
}
use of net.opengis.sos.x20.CapabilitiesType in project midpoint by Evolveum.
the class ResourceManager method completeCapabilities.
private void completeCapabilities(PrismObject<ResourceType> resource, boolean forceRefresh, Map<String, Collection<Object>> capabilityMap, Collection<ItemDelta<?, ?>> modifications, OperationResult result) throws SchemaException, ObjectNotFoundException, CommunicationException, ConfigurationException {
ResourceType resourceType = resource.asObjectable();
ConnectorSpec defaultConnectorSpec = getDefaultConnectorSpec(resource);
CapabilitiesType resourceCapType = resourceType.getCapabilities();
if (resourceCapType == null) {
resourceCapType = new CapabilitiesType();
resourceType.setCapabilities(resourceCapType);
}
completeConnectorCapabilities(defaultConnectorSpec, resourceCapType, new ItemPath(ResourceType.F_CAPABILITIES), forceRefresh, capabilityMap == null ? null : capabilityMap.get(null), modifications, result);
for (ConnectorInstanceSpecificationType additionalConnectorType : resource.asObjectable().getAdditionalConnector()) {
ConnectorSpec connectorSpec = getConnectorSpec(resource, additionalConnectorType);
CapabilitiesType connectorCapType = additionalConnectorType.getCapabilities();
if (connectorCapType == null) {
connectorCapType = new CapabilitiesType();
additionalConnectorType.setCapabilities(connectorCapType);
}
ItemPath itemPath = additionalConnectorType.asPrismContainerValue().getPath().subPath(ConnectorInstanceSpecificationType.F_CAPABILITIES);
completeConnectorCapabilities(connectorSpec, connectorCapType, itemPath, forceRefresh, capabilityMap == null ? null : capabilityMap.get(additionalConnectorType.getName()), modifications, result);
}
}
use of net.opengis.sos.x20.CapabilitiesType in project midpoint by Evolveum.
the class ResourceManager method isComplete.
private boolean isComplete(PrismObject<ResourceType> resource) {
ResourceType resourceType = resource.asObjectable();
Element xsdSchema = ResourceTypeUtil.getResourceXsdSchema(resource);
if (xsdSchema == null) {
return false;
}
CapabilitiesType capabilitiesType = resourceType.getCapabilities();
if (capabilitiesType == null) {
return false;
}
CachingMetadataType capCachingMetadata = capabilitiesType.getCachingMetadata();
if (capCachingMetadata == null) {
return false;
}
return true;
}
use of net.opengis.sos.x20.CapabilitiesType in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesRequestServiceProvider.
@Test
public void testCapabilitiesRequestServiceProvider() {
// Should only return the ServiceProvider section
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
gcr.setSections(CswEndpoint.SERVICE_PROVIDER);
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), nullValue());
assertThat(ct.getServiceIdentification(), nullValue());
verifyFilterCapabilities(ct);
verifyServiceProvider(ct);
}
use of net.opengis.sos.x20.CapabilitiesType in project ddf by codice.
the class TestCswEndpoint method testCapabilitiesFederatedCatalogs.
@Test
public void testCapabilitiesFederatedCatalogs() {
GetCapabilitiesRequest gcr = createDefaultGetCapabilitiesRequest();
CapabilitiesType ct = null;
try {
ct = csw.getCapabilities(gcr);
} catch (CswException e) {
fail("CswException caught during getCapabilities GET request: " + e.getMessage());
}
assertThat(ct, notNullValue());
assertThat(ct.getOperationsMetadata(), notNullValue());
for (Operation operation : ct.getOperationsMetadata().getOperation()) {
if (StringUtils.equals(operation.getName(), CswConstants.GET_RECORDS)) {
for (DomainType constraint : operation.getConstraint()) {
if (StringUtils.equals(constraint.getName(), CswConstants.FEDERATED_CATALOGS)) {
assertThat(constraint.getValue().size(), is(3));
return;
}
}
}
}
fail("Didn't find [" + CswConstants.FEDERATED_CATALOGS + "] in request [" + CswConstants.GET_RECORDS + "]");
}
Aggregations