public static String getConnectorOid(ResourceType resource) { if (resource.getConnectorRef() != null) { return resource.getConnectorRef().getOid(); } else if (resource.getConnector() != null) { return resource.getConnector().getOid(); } else { return null; } }
private boolean compareConnectors(PrismObject<ConnectorType> prismA, PrismObject<ConnectorType> prismB) { ConnectorType a = prismA.asObjectable(); ConnectorType b = prismB.asObjectable(); if (!a.getFramework().equals(b.getFramework())) { return false; } if (!a.getConnectorType().equals(b.getConnectorType())) { return false; } if (!compareConnectorHost(a, b)) { return false; } if (a.getConnectorVersion() == null && b.getConnectorVersion() == null) { // Both connectors without version. This is OK. return true; } if (a.getConnectorVersion() != null && b.getConnectorVersion() != null) { // Both connectors with version. This is OK. return a.getConnectorVersion().equals(b.getConnectorVersion()); } // One connector has version and other does not. This is inconsistency LOGGER.error("Inconsistent representation of ConnectorType, one has connectorVersion and other does not. OIDs: " + a.getOid() + " and " + b.getOid()); // Obviously they don't match return false; }
/** * Test listing connectors. Very simple. Just test that the list is * non-empty and that there are mandatory values filled in. * @throws CommunicationException */ @Test public void test010ListConnectors() throws Exception { final String TEST_NAME = "test010ListConnectors"; TestUtil.displayTestTitle(TEST_NAME); OperationResult result = new OperationResult(TestUcfDummy.class+"."+TEST_NAME); Set<ConnectorType> connectors = connectorFactory.listConnectors(null, result); System.out.println("---------------------------------------------------------------------"); assertNotNull(connectors); assertFalse(connectors.isEmpty()); for (ConnectorType connector : connectors) { assertNotNull(connector.getName()); System.out.println("CONNECTOR OID=" + connector.getOid() + ", name=" + connector.getName() + ", version=" + connector.getConnectorVersion()); System.out.println("--"); System.out.println(ObjectTypeUtil.dump(connector)); System.out.println("--"); } System.out.println("---------------------------------------------------------------------"); assertEquals("Unexpected number of connectors discovered", 7, connectors.size()); }
if (StringUtils.isNotEmpty(foundConnector.getOid())) { LOGGER.warn("Provisioning framework {} supplied OID for connector {}", foundConnector.getFramework(), foundConnector); foundConnector.setOid(null);