From 467906eea4c6e62c7cc2ebb2eee4c570189acf14 Mon Sep 17 00:00:00 2001 From: Ilya Ksenofontov Date: Sat, 5 Sep 2020 00:16:13 +0300 Subject: [PATCH 1/2] # Fixed some code smells from sonar Signed-off-by: immmus --- ...OpenMetadataConformanceProfileResults.java | 1 - .../OpenMetadataConformanceTestEvidence.java | 1 - ...enMetadataConformanceWorkbenchWorkPad.java | 2 +- .../beans/OpenMetadataTestCase.java | 4 +- .../exception/AssertionFailureException.java | 2 +- .../ffdc/exception/CaughtException.java | 2 +- .../rest/WorkbenchStatusResponse.java | 1 - .../ConformanceServicesInstanceMap.java | 4 +- .../RepositoryConformanceTestCase.java | 64 ++-- .../instances/TestGraphQueries.java | 291 +++++++++--------- .../TestSupportedEntityProxyLifecycle.java | 34 +- ...SupportedEntityReferenceCopyLifecycle.java | 118 +++---- .../TestSupportedEntityReidentify.java | 21 +- .../instances/TestSupportedEntitySearch.java | 246 +++++++-------- .../TestSupportedRelationshipLifecycle.java | 14 +- .../types/TestGetTypeDefGallery.java | 2 - .../types/TestSupportedAttributeTypeDef.java | 1 - .../types/TestSupportedTypeDef.java | 1 - .../types/TestValidTypeDefEvent.java | 5 - .../auditlog/AnalyticsModelingAuditCode.java | 2 +- .../assetcatalog/AssetCatalog.java | 30 +- .../assetcatalog/AssetCatalogInterface.java | 26 +- .../ffdc/AssetConsumerAuditCode.java | 5 - .../ffdc/AssetConsumerErrorCode.java | 5 - .../assetowner/ffdc/AssetOwnerAuditCode.java | 1 - .../DerivedSchemaAttributeProperties.java | 1 - .../properties/EnumSchemaTypeProperties.java | 1 - .../PrimitiveSchemaTypeProperties.java | 1 - .../properties/SchemaElementProperties.java | 3 - .../StructDocumentTypeProperties.java | 6 +- .../properties/TabularColumnProperties.java | 1 - .../rest/NewFileAssetRequestBody.java | 1 - .../assetowner/client/AvroFileAssetOwner.java | 2 - .../client/FileSystemAssetOwner.java | 2 - .../api/UserIdentityManagementInterface.java | 1 - .../ffdc/CommunityProfileAuditCode.java | 5 - .../properties/CommonHeader.java | 3 - .../properties/NoteEntryHeader.java | 2 - .../dataengine/rest/ProcessListResponse.java | 1 - .../handlers/DataEngineSchemaTypeHandler.java | 3 - .../api/DataManagerEventListener.java | 4 +- .../ffdc/DataManagerErrorCode.java | 5 - .../metadataelements/DataFileElement.java | 1 - .../metadataelements/FileFolderElement.java | 1 - .../metadataelements/FileSystemElement.java | 1 - .../properties/DataManagerProperties.java | 3 - .../properties/DatabaseViewProperties.java | 6 +- .../DatabaseContextHandlerTest.java | 8 +- .../service/AssetCatalogOMASServiceTest.java | 6 +- 49 files changed, 400 insertions(+), 551 deletions(-) diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceProfileResults.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceProfileResults.java index d6652cab2ad..0ccbcb583f8 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceProfileResults.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceProfileResults.java @@ -8,7 +8,6 @@ import java.io.Serializable; import java.util.List; -import java.util.Map; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceTestEvidence.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceTestEvidence.java index d7023e47ce3..fb4b4160c8b 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceTestEvidence.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceTestEvidence.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.annotation.JsonInclude; import java.io.Serializable; -import java.util.Map; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceWorkbenchWorkPad.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceWorkbenchWorkPad.java index 87f274488ce..1b4c24f905f 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceWorkbenchWorkPad.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataConformanceWorkbenchWorkPad.java @@ -23,7 +23,7 @@ public abstract class OpenMetadataConformanceWorkbenchWorkPad protected String tutType; protected int maxPageSize; - protected Boolean workbenchComplete; + protected boolean workbenchComplete; protected List testEvidenceList = new ArrayList<>(); diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataTestCase.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataTestCase.java index b6b0731e156..2e31554d1d1 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataTestCase.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/beans/OpenMetadataTestCase.java @@ -37,7 +37,7 @@ public abstract class OpenMetadataTestCase /* * Enumerated type for control of multi-phase tests */ - public static enum TestPhase { + public enum TestPhase { SEED, EXECUTE, CLEAN @@ -66,8 +66,6 @@ public OpenMetadataTestCase(OpenMetadataConformanceWorkbenchWorkPad workPad, Integer defaultProfileId, Integer defaultRequirementId) { - final String methodName = "OpenMetadataTestCase"; - this.testCaseId = testCaseId; this.testCaseName = testCaseName; this.testCaseDescriptionURL = documentationRootURL + workPad.getWorkbenchId() + "/test-cases/" + testCaseId + "-test-case.md"; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/AssertionFailureException.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/AssertionFailureException.java index 23bc730472b..b1c28d3f5a6 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/AssertionFailureException.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/AssertionFailureException.java @@ -9,7 +9,7 @@ public class AssertionFailureException extends ConformanceException { private static final long serialVersionUID = 1L; - private String assertionId; + private final String assertionId; /** diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/CaughtException.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/CaughtException.java index 2dbc1f11d0c..8929921191f 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/CaughtException.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/ffdc/exception/CaughtException.java @@ -9,7 +9,7 @@ public class CaughtException extends ConformanceException { private static final long serialVersionUID = 1L; - Throwable caughtException; + private final Throwable caughtException; /** * The constructor captures the context of the exception. diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/rest/WorkbenchStatusResponse.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/rest/WorkbenchStatusResponse.java index 06b5327c01f..70e96a25eab 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/rest/WorkbenchStatusResponse.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-api/src/main/java/org/odpi/openmetadata/conformance/rest/WorkbenchStatusResponse.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.conformance.beans.OpenMetadataConformanceWorkbenchResults; import org.odpi.openmetadata.conformance.beans.OpenMetadataConformanceWorkbenchStatus; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/server/ConformanceServicesInstanceMap.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/server/ConformanceServicesInstanceMap.java index 5a35095ab04..df7f1fe0670 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/server/ConformanceServicesInstanceMap.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/server/ConformanceServicesInstanceMap.java @@ -43,9 +43,7 @@ private static synchronized void setNewInstanceForJVM(String */ private static synchronized ConformanceServicesInstance getInstanceForJVM(String serverName) { - ConformanceServicesInstance instance = instanceMap.get(serverName); - - return instance; + return instanceMap.get(serverName); } diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/RepositoryConformanceTestCase.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/RepositoryConformanceTestCase.java index ad2e672fa32..53711b2fbd0 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/RepositoryConformanceTestCase.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/RepositoryConformanceTestCase.java @@ -303,28 +303,28 @@ private PrimitivePropertyValue getPrimitivePropertyValue(String propertyN propertyValue.setPrimitiveValue(true); break; case OM_PRIMITIVE_TYPE_SHORT: - propertyValue.setPrimitiveValue(new Short("34")); + propertyValue.setPrimitiveValue(Short.valueOf("34")); break; case OM_PRIMITIVE_TYPE_BYTE: - propertyValue.setPrimitiveValue(new Byte("7")); + propertyValue.setPrimitiveValue(Byte.valueOf("7")); break; case OM_PRIMITIVE_TYPE_CHAR: - propertyValue.setPrimitiveValue(new Character('o')); + propertyValue.setPrimitiveValue('o'); break; case OM_PRIMITIVE_TYPE_LONG: - propertyValue.setPrimitiveValue(new Long(2452)); + propertyValue.setPrimitiveValue(2452L); break; case OM_PRIMITIVE_TYPE_FLOAT: - propertyValue.setPrimitiveValue(new Float(245332)); + propertyValue.setPrimitiveValue(245332f); break; case OM_PRIMITIVE_TYPE_DOUBLE: - propertyValue.setPrimitiveValue(new Double(2459992)); + propertyValue.setPrimitiveValue(2459992d); break; case OM_PRIMITIVE_TYPE_BIGDECIMAL: - propertyValue.setPrimitiveValue(new Double(245339992)); + propertyValue.setPrimitiveValue(245339992d); break; case OM_PRIMITIVE_TYPE_BIGINTEGER: - propertyValue.setPrimitiveValue(new Double(245559992)); + propertyValue.setPrimitiveValue(245559992d); break; case OM_PRIMITIVE_TYPE_UNKNOWN: break; @@ -408,11 +408,6 @@ private PrimitivePropertyValue getPrimitivePropertyValue(String propertyN propertyValue.setPrimitiveValue((double)(2459992)); break; case OM_PRIMITIVE_TYPE_BIGDECIMAL: - if (distinct) - propertyValue.setPrimitiveValue((double)(245339992+instanceCount)); // instanceCount is never 0 for distinct cases - else - propertyValue.setPrimitiveValue((double)(245339992)); - break; case OM_PRIMITIVE_TYPE_BIGINTEGER: if (distinct) propertyValue.setPrimitiveValue((double)(245339992+instanceCount)); // instanceCount is never 0 for distinct cases @@ -447,12 +442,9 @@ protected InstanceProperties getPropertiesForInstance(List ty AttributeTypeDef attributeType = typeDefAttribute.getAttributeType(); AttributeTypeDefCategory category = attributeType.getCategory(); - switch(category) - { - case PRIMITIVE: - PrimitiveDef primitiveDef = (PrimitiveDef)attributeType; - propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); - break; + if (category == AttributeTypeDefCategory.PRIMITIVE) { + PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; + propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); } } @@ -494,12 +486,9 @@ protected InstanceProperties getAllPropertiesForInstance(String userId, TypeDef AttributeTypeDef attributeType = typeDefAttribute.getAttributeType(); AttributeTypeDefCategory category = attributeType.getCategory(); - switch(category) - { - case PRIMITIVE: - PrimitiveDef primitiveDef = (PrimitiveDef)attributeType; - propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); - break; + if (category == AttributeTypeDefCategory.PRIMITIVE) { + PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; + propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); } } @@ -538,12 +527,9 @@ protected InstanceProperties generatePropertiesForInstance(String userId, List< AttributeTypeDefCategory category = attributeType.getCategory(); boolean attrUnique = typeDefAttribute.isUnique(); - switch(category) - { - case PRIMITIVE: - PrimitiveDef primitiveDef = (PrimitiveDef)attributeType; - propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef, attrUnique, instanceCount)); - break; + if (category == AttributeTypeDefCategory.PRIMITIVE) { + PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; + propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef, attrUnique, instanceCount)); } } @@ -586,11 +572,9 @@ protected InstanceProperties getAllUniquePropertiesForInstance(String userId, T AttributeTypeDefCategory category = attributeType.getCategory(); if (typeDefAttribute.isUnique()) { - switch (category) { - case PRIMITIVE: - PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; - propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); - break; + if (category == AttributeTypeDefCategory.PRIMITIVE) { + PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; + propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); } } } @@ -635,11 +619,9 @@ protected InstanceProperties getMinPropertiesForInstance(String userId, TypeDef if (attributeCardinality == AttributeCardinality.AT_LEAST_ONE_ORDERED || attributeCardinality == AttributeCardinality.AT_LEAST_ONE_UNORDERED) { - switch (category) { - case PRIMITIVE: - PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; - propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); - break; + if (category == AttributeTypeDefCategory.PRIMITIVE) { + PrimitiveDef primitiveDef = (PrimitiveDef) attributeType; + propertyMap.put(attributeName, this.getPrimitivePropertyValue(attributeName, primitiveDef)); } } } diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestGraphQueries.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestGraphQueries.java index 19283882e8a..3c2c445fd55 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestGraphQueries.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestGraphQueries.java @@ -95,18 +95,18 @@ public class TestGraphQueries extends RepositoryConformanceTestCase { private int edgeCount = 0; private int nodeCount = 0; - private int max_depth = 3; - private int max_fanout = 3; + private int maxDepth = 3; + private int maxFanout = 3; /* * The edgeToNodeMap is a map of relationshipGUID to a pair of entityGUIDs, ordered as end1 then end2 */ - private Map> edgeToNodesMap = new HashMap<>(); + private final Map> edgeToNodesMap = new HashMap<>(); /* * The nodeToEdgesMap is a map of entityGUID to a pair of lists of relationshipGUIDs, ordered as end1 then end2 */ - private Map>> nodeToEdgesMap = new HashMap<>(); + private final Map>> nodeToEdgesMap = new HashMap<>(); /* * Connectivity Map for convenient path finding traversal @@ -214,9 +214,7 @@ private void traverse(String curE, String tgtE, List curP, List routes = connMap.get(curE); Set routeKeys = routes.keySet(); - Iterator routeIterator = routeKeys.iterator(); - while (routeIterator.hasNext()) { - String routeKey = routeIterator.next(); + for (String routeKey : routeKeys) { if (curP == null || !curP.contains(routeKey)) { String remoteEntity = routes.get(routeKey); List curPex = new ArrayList<>(); @@ -233,7 +231,6 @@ private void traverse(String curE, String tgtE, List curP, List> exploreFromEntity(String entityGUID, String arrivalEd bothEdges.addAll(inOutEdges.get(1)); if (!(bothEdges.isEmpty())) { for (String edgeGUID : bothEdges) { - if (arrivalEdgeGUID==null || !edgeGUID.equals(arrivalEdgeGUID)) { + if (!edgeGUID.equals(arrivalEdgeGUID)) { /* For each untraversed edge from this entity, explore */ List end1end2 = this.edgeToNodesMap.get(edgeGUID); for (String entGUID : end1end2) { @@ -372,7 +369,7 @@ private void constructGraph() throws Exception { * Create a relationship and far end (only) and hook the relationship onto the current (end2) entity. */ - if (this.max_depth > 1) { + if (this.maxDepth > 1) { this.extendGraph(workPad.getLocalServerUserId(), end2GUID, 1); } @@ -388,10 +385,7 @@ private void destroyGraph() throws Exception */ Set nodeKeys = nodeToEdgesMap.keySet(); - Iterator nodeKeyIterator = nodeKeys.iterator(); - while (nodeKeyIterator.hasNext()) { - - String nodeKey = nodeKeyIterator.next(); + for (String nodeKey : nodeKeys) { /* * Need to get the entitiy so that we can note its type, needed for delete. @@ -407,8 +401,7 @@ private void destroyGraph() throws Exception entityToDelete.getType().getTypeDefName(), nodeKey); - } - catch (FunctionNotSupportedException exc) { + } catch (FunctionNotSupportedException exc) { /* NO OP - continue with purge */ } @@ -416,8 +409,7 @@ private void destroyGraph() throws Exception entityToDelete.getType().getTypeDefGUID(), entityToDelete.getType().getTypeDefName(), nodeKey); - } - catch (Exception exception) { + } catch (Exception exception) { /* * Rethrow the exception - this will cause a failure of the testcase, which is desirable. */ @@ -440,7 +432,7 @@ private void extendGraph(String userId, String entityGUID, int currentDepth) thr int fanout = 0; int endChoice = 1; - while (fanout < max_fanout) { + while (fanout < maxFanout) { /* * Find an available relationship type if possible, if not reuse types. @@ -512,7 +504,7 @@ private void extendGraph(String userId, String entityGUID, int currentDepth) thr currentDepth++; - if (this.max_depth > currentDepth) { + if (this.maxDepth > currentDepth) { this.extendGraph(userId, end2GUID, currentDepth); } @@ -581,7 +573,7 @@ private void extendGraph(String userId, String entityGUID, int currentDepth) thr currentDepth++; - if (this.max_depth > currentDepth) { + if (this.maxDepth > currentDepth) { this.extendGraph(userId, end1GUID, currentDepth); } } @@ -619,7 +611,10 @@ private List addFullEdgeToGraph(String relationshipTypeName) throws Exce repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); } - RelationshipDef knownRelationshipDef = (RelationshipDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), relationshipTypeName); + RelationshipDef knownRelationshipDef = null; + if (repositoryHelper != null) { + knownRelationshipDef = (RelationshipDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), relationshipTypeName); + } RelationshipDef repositoryRelationshipDef = relationshipDefs.get(relationshipTypeName); verifyCondition((repositoryRelationshipDef.equals(knownRelationshipDef)), assertion0, @@ -627,8 +622,6 @@ private List addFullEdgeToGraph(String relationshipTypeName) throws Exce RepositoryConformanceProfileRequirement.CONSISTENT_TYPES.getProfileId(), RepositoryConformanceProfileRequirement.CONSISTENT_TYPES.getRequirementId()); - RelationshipDef relationshipDef = knownRelationshipDef; - /* * In this testcase the repository is believed to support the relationship type defined by * relationshipDef - but may not support all of the entity inheritance hierarchy - it may only @@ -642,7 +635,10 @@ private List addFullEdgeToGraph(String relationshipTypeName) throws Exce * active set for this repository. */ - String end1DefName = relationshipDef.getEndDef1().getEntityType().getName(); + String end1DefName = null; + if (knownRelationshipDef != null) { + end1DefName = knownRelationshipDef.getEndDef1().getEntityType().getName(); + } List end1DefTypeNames = new ArrayList<>(); end1DefTypeNames.add(end1DefName); if (this.workPad.getEntitySubTypes(end1DefName) != null) { @@ -650,7 +646,7 @@ private List addFullEdgeToGraph(String relationshipTypeName) throws Exce } - String end2DefName = relationshipDef.getEndDef2().getEntityType().getName(); + String end2DefName = knownRelationshipDef.getEndDef2().getEntityType().getName(); List end2DefTypeNames = new ArrayList<>(); end2DefTypeNames.add(end2DefName); if (this.workPad.getEntitySubTypes(end2DefName) != null) { @@ -703,8 +699,8 @@ private List addFullEdgeToGraph(String relationshipTypeName) throws Exce EntityDetail end2 = this.addEntityToRepository(workPad.getLocalServerUserId(), metadataCollection, end2Type); Relationship newRelationship = metadataCollection.addRelationship(workPad.getLocalServerUserId(), - relationshipDef.getGUID(), - super.getPropertiesForInstance(relationshipDef.getPropertiesDefinition()), + knownRelationshipDef.getGUID(), + super.getPropertiesForInstance(knownRelationshipDef.getPropertiesDefinition()), end1.getGUID(), end2.getGUID(), null); @@ -739,7 +735,10 @@ private List addPartialEdgeToGraph(String relationshipTypeName, String e repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); } - RelationshipDef knownRelationshipDef = (RelationshipDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), relationshipTypeName); + RelationshipDef knownRelationshipDef = null; + if (repositoryHelper != null) { + knownRelationshipDef = (RelationshipDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), relationshipTypeName); + } RelationshipDef repositoryRelationshipDef = relationshipDefs.get(relationshipTypeName); verifyCondition((repositoryRelationshipDef.equals(knownRelationshipDef)), assertion0, @@ -859,10 +858,7 @@ private void getEntityNeighborhood() throws Exception * There is no type filtering on these queries. */ Set entityGUIDs = this.nodeToEdgesMap.keySet(); - Iterator entityGUIDIterator = entityGUIDs.iterator(); - while (entityGUIDIterator.hasNext()) { - - String entityGUID = entityGUIDIterator.next(); + for (String entityGUID : entityGUIDs) { for (int level = 0; level < 4; level++) { @@ -871,20 +867,20 @@ private void getEntityNeighborhood() throws Exception try { instGraph = metadataCollection.getEntityNeighborhood(workPad.getLocalServerUserId(), - entityGUID, - null, - null, - null, - null, - null, - level); + entityGUID, + null, + null, + null, + null, + null, + level); } catch (FunctionNotSupportedException exception) { super.addNotSupportedAssertion(assertion14, - assertionMsg14, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + assertionMsg14, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); return; @@ -910,10 +906,10 @@ private void getEntityNeighborhood() throws Exception assertCondition((true), - assertion14, - testTypeName + assertionMsg14, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + assertion14, + testTypeName + assertionMsg14, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); /* @@ -922,32 +918,32 @@ private void getEntityNeighborhood() throws Exception /* Add the current entity and then navigate each of its edges recursively amalgamating what you discover down that edge */ - List expectedEntityGUIDs = new ArrayList<>(); - List expectedRelationshipGUIDs = new ArrayList<>(); List> subgraph = this.exploreFromEntity(entityGUID, null, level); - expectedEntityGUIDs.addAll(subgraph.get(0)); - expectedRelationshipGUIDs.addAll(subgraph.get(1)); + List expectedEntityGUIDs = new ArrayList<>(subgraph.get(0)); + List expectedRelationshipGUIDs = new ArrayList<>(subgraph.get(1)); assertCondition((instGraph != null), - assertion1, - testTypeName + assertionMsg1, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + assertion1, + testTypeName + assertionMsg1, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); /* Check entities */ /* Always expect to get at least one entity - the root of the query */ - assertCondition((instGraph.getEntities() != null && !(instGraph.getEntities().isEmpty()) && instGraph.getEntities().size() == expectedEntityGUIDs.size()), - assertion2, - testTypeName + assertionMsg2, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + if (instGraph != null) { + assertCondition((instGraph.getEntities() != null && !(instGraph.getEntities().isEmpty()) && instGraph.getEntities().size() == expectedEntityGUIDs.size()), + assertion2, + testTypeName + assertionMsg2, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + } List returnedEntityGUIDs = new ArrayList<>(); - if (instGraph.getEntities() != null) { + if (instGraph != null && instGraph.getEntities() != null) { for (EntityDetail entity : instGraph.getEntities()) { if (entity != null) { returnedEntityGUIDs.add(entity.getGUID()); @@ -955,10 +951,10 @@ private void getEntityNeighborhood() throws Exception } } assertCondition((returnedEntityGUIDs.containsAll(expectedEntityGUIDs)), - assertion3, - testTypeName + assertionMsg3, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + assertion3, + testTypeName + assertionMsg3, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); /* Check relationships */ @@ -966,18 +962,22 @@ private void getEntityNeighborhood() throws Exception /* Don't always expect to get at least one relationship */ if (expectedRelationshipGUIDs.isEmpty()) { - assertCondition((instGraph.getRelationships() == null), - assertion4, - testTypeName + assertionMsg4, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + if (instGraph != null) { + assertCondition((instGraph.getRelationships() == null), + assertion4, + testTypeName + assertionMsg4, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + } } else { - assertCondition((instGraph.getRelationships().size() == expectedRelationshipGUIDs.size()), - assertion4, - testTypeName + assertionMsg4, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + if (instGraph != null) { + assertCondition((instGraph.getRelationships().size() == expectedRelationshipGUIDs.size()), + assertion4, + testTypeName + assertionMsg4, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + } List returnedRelationshipGUIDs = new ArrayList<>(); @@ -989,10 +989,10 @@ private void getEntityNeighborhood() throws Exception } } assertCondition((returnedRelationshipGUIDs.containsAll(expectedRelationshipGUIDs)), - assertion5, - testTypeName + assertionMsg5, - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); + assertion5, + testTypeName + assertionMsg5, + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_NEIGHBORHOOD.getRequirementId()); } } } @@ -1011,33 +1011,30 @@ private void getRelatedEntities() throws Exception */ Set entityGUIDs = this.nodeToEdgesMap.keySet(); - Iterator entityGUIDIterator = entityGUIDs.iterator(); - while (entityGUIDIterator.hasNext()) { - - String entityGUID = entityGUIDIterator.next(); + for (String entityGUID : entityGUIDs) { List relatedEntities = null; try { relatedEntities = metadataCollection.getRelatedEntities(workPad.getLocalServerUserId(), - entityGUID, - null, - 0, - null, - null, - null, - null, - null, - 0); + entityGUID, + null, + 0, + null, + null, + null, + null, + null, + 0); } catch (FunctionNotSupportedException exception) { super.addNotSupportedAssertion(assertion15, - assertionMsg15, - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); + assertionMsg15, + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); return; @@ -1065,10 +1062,10 @@ private void getRelatedEntities() throws Exception assertCondition((true), - assertion15, - testTypeName + assertionMsg15, - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); + assertion15, + testTypeName + assertionMsg15, + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); @@ -1078,11 +1075,10 @@ private void getRelatedEntities() throws Exception /* Add the current entity and then navigate each of its edges recursively amalgamating what you discover down that edge */ - List expectedEntityGUIDs = new ArrayList<>(); //List expectedRelationshipGUIDs = new ArrayList<>(); List> subgraph = this.exploreFromEntity(entityGUID, null, -1); - expectedEntityGUIDs.addAll(subgraph.get(0)); + List expectedEntityGUIDs = new ArrayList<>(subgraph.get(0)); //expectedRelationshipGUIDs.addAll(subgraph.get(1)); @@ -1091,10 +1087,10 @@ private void getRelatedEntities() throws Exception /* Always expect to get at least one entity - the root of the query */ assertCondition((relatedEntities != null && !(relatedEntities.isEmpty()) && relatedEntities.size() == expectedEntityGUIDs.size()), - assertion6, - testTypeName + assertionMsg6, - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); + assertion6, + testTypeName + assertionMsg6, + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); List returnedEntityGUIDs = new ArrayList<>(); if (relatedEntities != null) { @@ -1105,10 +1101,10 @@ private void getRelatedEntities() throws Exception } } assertCondition((returnedEntityGUIDs.containsAll(expectedEntityGUIDs)), - assertion7, - testTypeName + assertionMsg7, - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); + assertion7, + testTypeName + assertionMsg7, + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); } @@ -1161,16 +1157,9 @@ private void getlinkingEntities() throws Exception * Traverse the connMap to find the available paths, from A to B */ - Iterator entityAGUIDIterator = entityGUIDs.iterator(); - while (entityAGUIDIterator.hasNext()) { + for (String entityAGUID : entityGUIDs) { - String entityAGUID = entityAGUIDIterator.next(); - - Iterator entityBGUIDIterator = entityGUIDs.iterator(); - - while (entityBGUIDIterator.hasNext()) { - - String entityBGUID = entityBGUIDIterator.next(); + for (String entityBGUID : entityGUIDs) { /* * Calculate the expected result @@ -1222,17 +1211,17 @@ private void getlinkingEntities() throws Exception try { instanceGraph = metadataCollection.getLinkingEntities(workPad.getLocalServerUserId(), - entityAGUID, - entityBGUID, - null, - null); + entityAGUID, + entityBGUID, + null, + null); } catch (FunctionNotSupportedException exception) { super.addNotSupportedAssertion(assertion16, - assertionMsg16, - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); + assertionMsg16, + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.CONNECTED_ENTITIES.getRequirementId()); return; @@ -1254,10 +1243,10 @@ private void getlinkingEntities() throws Exception assertCondition((true), - assertion16, - testTypeName + assertionMsg16, - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); + assertion16, + testTypeName + assertionMsg16, + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); /* Check results */ @@ -1277,13 +1266,13 @@ private void getlinkingEntities() throws Exception /* Check entities */ assertCondition(((!expectedEntityGUIDs.isEmpty() && returnedEntities != null - && !(returnedEntities.isEmpty()) - && returnedEntities.size() == expectedEntityGUIDs.size()) - || expectedEntityGUIDs.isEmpty() && returnedEntities == null), - assertion8, - testTypeName + assertionMsg8, - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); + && !(returnedEntities.isEmpty()) + && returnedEntities.size() == expectedEntityGUIDs.size()) + || expectedEntityGUIDs.isEmpty() && returnedEntities == null), + assertion8, + testTypeName + assertionMsg8, + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); /* Extract the GUIDs so they are easier to check */ @@ -1296,21 +1285,21 @@ private void getlinkingEntities() throws Exception } } assertCondition((returnedEntityGUIDs.containsAll(expectedEntityGUIDs)), - assertion9, - testTypeName + assertionMsg9, - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); + assertion9, + testTypeName + assertionMsg9, + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); /* Check relationships */ assertCondition(((!expectedRelationshipGUIDs.isEmpty() && returnedRelationships != null - && !(returnedRelationships.isEmpty()) - && returnedRelationships.size() == expectedRelationshipGUIDs.size()) - || expectedRelationshipGUIDs.isEmpty() && returnedRelationships == null), - assertion10, - testTypeName + assertionMsg10, - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); + && !(returnedRelationships.isEmpty()) + && returnedRelationships.size() == expectedRelationshipGUIDs.size()) + || expectedRelationshipGUIDs.isEmpty() && returnedRelationships == null), + assertion10, + testTypeName + assertionMsg10, + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); /* Extract the GUIDs so they are easier to check */ @@ -1323,10 +1312,10 @@ private void getlinkingEntities() throws Exception } } assertCondition((returnedRelationshipGUIDs.containsAll(expectedRelationshipGUIDs)), - assertion11, - testTypeName + assertionMsg11, - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), - RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); + assertion11, + testTypeName + assertionMsg11, + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getProfileId(), + RepositoryConformanceProfileRequirement.LINKED_ENTITIES.getRequirementId()); } diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityProxyLifecycle.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityProxyLifecycle.java index 4215741565f..b4c6c46f851 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityProxyLifecycle.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityProxyLifecycle.java @@ -6,7 +6,6 @@ import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.MatchCriteria; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityProxy; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntitySummary; @@ -23,7 +22,6 @@ import org.odpi.openmetadata.repositoryservices.ffdc.exception.InvalidParameterException; import org.odpi.openmetadata.repositoryservices.ffdc.exception.RelationshipNotKnownException; -import java.io.Serializable; import java.util.ArrayList; import java.util.HashMap; import java.util.List; @@ -76,11 +74,11 @@ public class TestSupportedEntityProxyLifecycle extends RepositoryConformanceTest private static final String assertionMsg12 = " entity proxy identity cannot be updated "; - private List createdEntitiesCTS = new ArrayList<>(); // these are all master instances - private List createdEntitiesTUT = new ArrayList<>(); // these are all master instances - private List createdEntityRefCopiesTUT = new ArrayList<>(); // these are all ref copies - private List createdEntityProxiesTUT = new ArrayList<>(); // these are all proxy instances - private List createdRelationshipsTUT = new ArrayList<>(); // these are all master instances + private final List createdEntitiesCTS = new ArrayList<>(); // these are all master instances + private final List createdEntitiesTUT = new ArrayList<>(); // these are all master instances + private final List createdEntityRefCopiesTUT = new ArrayList<>(); // these are all ref copies + private final List createdEntityProxiesTUT = new ArrayList<>(); // these are all proxy instances + private final List createdRelationshipsTUT = new ArrayList<>(); // these are all master instances @@ -130,12 +128,10 @@ public class TestSupportedEntityProxyLifecycle extends RepositoryConformanceTest - private RepositoryConformanceWorkPad workPad; - private String metadataCollectionId; - private Map entityDefs; - private RelationshipDef relationshipDef; - private String testTypeName; - private OMRSMetadataCollection localMetadataCollection; + private final RepositoryConformanceWorkPad workPad; + private final Map entityDefs; + private final RelationshipDef relationshipDef; + private final String testTypeName; /* @@ -167,7 +163,6 @@ public TestSupportedEntityProxyLifecycle(RepositoryConformanceWorkPad workPad, RepositoryConformanceProfileRequirement.RETRIEVE_ENTITY_PROXIES.getRequirementId()); this.workPad = workPad; - this.metadataCollectionId = workPad.getTutMetadataCollectionId(); this.relationshipDef = relationshipDef; this.entityDefs = entityDefs; @@ -250,7 +245,7 @@ protected void run() throws Exception String end1DefName = relationshipDef.getEndDef1().getEntityType().getName(); List end1DefTypeNames = new ArrayList<>(); end1DefTypeNames.add(end1DefName); - if (this.workPad.getEntitySubTypes(end1DefName) != null) { + if (this.workPad != null && this.workPad.getEntitySubTypes(end1DefName) != null) { end1DefTypeNames.addAll(this.workPad.getEntitySubTypes(end1DefName)); } @@ -424,10 +419,8 @@ protected void run() throws Exception EntityDetail retrievedEntity1 = ctsMetadataCollection.getEntityDetail(workPad.getLocalServerUserId(), entity1.getGUID()); EntityProxy entity1Proxy; - if (retrievedEntity1 != null) { - + if (retrievedEntity1 != null && repositoryHelper != null) { entity1Proxy = repositoryHelper.getNewEntityProxy(ctsMetadataCollectionName, retrievedEntity1); - } else { /* * If we cannot retrieve the entity (detail) from the CTS repository then we are in deep trouble. @@ -1413,7 +1406,4 @@ public void cleanup() throws Exception } } } - - - -} +} \ No newline at end of file diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReferenceCopyLifecycle.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReferenceCopyLifecycle.java index d6c91eb703e..f4626f8b449 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReferenceCopyLifecycle.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReferenceCopyLifecycle.java @@ -6,7 +6,6 @@ import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.MatchCriteria; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceStatus; @@ -86,15 +85,14 @@ public class TestSupportedEntityReferenceCopyLifecycle extends RepositoryConform - private RepositoryConformanceWorkPad workPad; - private String metadataCollectionId; - private EntityDef entityDef; - private String testTypeName; - private OMRSMetadataCollection localMetadataCollection; + private final RepositoryConformanceWorkPad workPad; + private final String metadataCollectionId; + private final EntityDef entityDef; + private final String testTypeName; - private List createdEntitiesCTS = new ArrayList<>(); // these are all master instances - private List createdEntitiesTUT = new ArrayList<>(); // these are all master instances - private List createdEntityRefCopiesTUT = new ArrayList<>(); // these are all ref copies + private final List createdEntitiesCTS = new ArrayList<>(); // these are all master instances + private final List createdEntitiesTUT = new ArrayList<>(); // these are all master instances + private final List createdEntityRefCopiesTUT = new ArrayList<>(); // these are all ref copies /* @@ -159,7 +157,10 @@ protected void run() throws Exception repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); } - EntityDef knownEntityDef = (EntityDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), entityDef.getName()); + EntityDef knownEntityDef = null; + if (repositoryHelper != null) { + knownEntityDef = (EntityDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), entityDef.getName()); + } verifyCondition((entityDef.equals(knownEntityDef)), assertion0, testTypeName + assertionMsg0, @@ -222,11 +223,14 @@ protected void run() throws Exception * entity that is logically complete - versus an instance with just the locally-defined properties. */ - EntityDetail newEntity = ctsMetadataCollection.addEntity(workPad.getLocalServerUserId(), - entityDef.getGUID(), - super.getAllPropertiesForInstance(workPad.getLocalServerUserId(), entityDef), - null, - null); + EntityDetail newEntity = null; + if (workPad != null) { + newEntity = ctsMetadataCollection.addEntity(workPad.getLocalServerUserId(), + entityDef.getGUID(), + super.getAllPropertiesForInstance(workPad.getLocalServerUserId(), entityDef), + null, + null); + } createdEntitiesCTS.add(newEntity); @@ -252,7 +256,9 @@ protected void run() throws Exception Integer remainingCount = this.pollCount; while (refEntity == null && remainingCount > 0) { - refEntity = metadataCollection.isEntityKnown(workPad.getLocalServerUserId(), newEntity.getGUID()); + if (workPad != null) { + refEntity = metadataCollection.isEntityKnown(workPad.getLocalServerUserId(), newEntity.getGUID()); + } Thread.sleep(this.pollPeriod); remainingCount--; @@ -265,7 +271,9 @@ protected void run() throws Exception String methodName = "isEntityKnown"; String operationDescription = "retrieve an entity of type " + entityDef.getName(); Map parameters = new HashMap<>(); - parameters.put("entityGUID", newEntity.getGUID()); + if (newEntity != null) { + parameters.put("entityGUID", newEntity.getGUID()); + } String msg = this.buildExceptionMessage(testCaseId, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); throw new Exception(msg, exc); @@ -343,11 +351,10 @@ protected void run() throws Exception * We are not expecting any exceptions from this method call. Log and fail the test. */ - String methodName = retrievalOperationName; String operationDescription = "retrieve an entity of type " + entityDef.getName(); Map parameters = new HashMap<>(); parameters.put("entityGUID", newEntity.getGUID()); - String msg = this.buildExceptionMessage(testCaseId, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); + String msg = this.buildExceptionMessage(testCaseId, retrievalOperationName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); throw new Exception(msg, exc); @@ -369,19 +376,21 @@ protected void run() throws Exception * No relationships have been created so none should be returned. */ try { - verifyCondition((metadataCollection.getRelationshipsForEntity(workPad.getLocalServerUserId(), - retrievedReferenceCopy.getGUID(), - null, - 0, - null, - null, - null, - null, - 0) == null), - assertion5, - testTypeName + assertionMsg5, - RepositoryConformanceProfileRequirement.REFERENCE_COPY_STORAGE.getProfileId(), - RepositoryConformanceProfileRequirement.REFERENCE_COPY_STORAGE.getRequirementId()); + if (retrievedReferenceCopy != null) { + verifyCondition((metadataCollection.getRelationshipsForEntity(workPad.getLocalServerUserId(), + retrievedReferenceCopy.getGUID(), + null, + 0, + null, + null, + null, + null, + 0) == null), + assertion5, + testTypeName + assertionMsg5, + RepositoryConformanceProfileRequirement.REFERENCE_COPY_STORAGE.getProfileId(), + RepositoryConformanceProfileRequirement.REFERENCE_COPY_STORAGE.getRequirementId()); + } } catch (Exception exc) { /* * We are not expecting any exceptions from this method call. Log and fail the test. @@ -440,7 +449,9 @@ protected void run() throws Exception String methodName = "updateEntityStatus"; String operationDescription = "update the status of an entity of type " + entityDef.getName(); Map parameters = new HashMap<>(); - parameters.put("entityGUID", retrievedReferenceCopy.getGUID()); + if (retrievedReferenceCopy != null) { + parameters.put("entityGUID", retrievedReferenceCopy.getGUID()); + } parameters.put("newStatus", validInstanceStatus.toString()); String msg = this.buildExceptionMessage(testCaseId, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); @@ -456,7 +467,7 @@ protected void run() throws Exception */ - if ((retrievedReferenceCopy.getProperties() != null) && + if (retrievedReferenceCopy != null && (retrievedReferenceCopy.getProperties() != null) && (retrievedReferenceCopy.getProperties().getInstanceProperties() != null) && (!retrievedReferenceCopy.getProperties().getInstanceProperties().isEmpty())) { InstanceProperties minEntityProps = super.getMinPropertiesForInstance(workPad.getLocalServerUserId(), entityDef); @@ -466,10 +477,10 @@ protected void run() throws Exception EntityDetail minPropertiesEntity = metadataCollection.updateEntityProperties(workPad.getLocalServerUserId(), retrievedReferenceCopy.getGUID(), minEntityProps); assertCondition((false), - assertion7, - testTypeName + assertionMsg7, - RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getProfileId(), - RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getRequirementId()); + assertion7, + testTypeName + assertionMsg7, + RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getProfileId(), + RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getRequirementId()); } catch (InvalidParameterException e) { /* @@ -477,10 +488,10 @@ protected void run() throws Exception */ assertCondition((true), - assertion7, - testTypeName + assertionMsg7, - RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getProfileId(), - RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getRequirementId()); + assertion7, + testTypeName + assertionMsg7, + RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getProfileId(), + RepositoryConformanceProfileRequirement.REFERENCE_COPY_LOCKING.getRequirementId()); } catch (Exception exc) { /* * We are not expecting any other exceptions from this method call. Log and fail the test. @@ -1023,7 +1034,7 @@ protected void run() throws Exception Map mappingProperties = new HashMap<>(); mappingProperties.put("stringMappingPropertyKey", "stringMappingPropertyValue"); - mappingProperties.put("integerMappingPropertyKey", new Integer(12)); + mappingProperties.put("integerMappingPropertyKey", 12); /* * Save a reference copy of the 'remote' entity @@ -1148,14 +1159,15 @@ protected void run() throws Exception /* * Verify that the new master instance has the local metadataCollectionId */ - String instanceHome = retrievedReferenceCopyWithMappingProperties.getMetadataCollectionId(); - assertCondition((instanceHome.equals(metadataCollectionId)), - assertion20, - assertionMsg20 + entityDef.getName(), - RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_HOME.getProfileId(), - RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_HOME.getRequirementId()); - - + String instanceHome; + if (retrievedReferenceCopyWithMappingProperties != null) { + instanceHome = retrievedReferenceCopyWithMappingProperties.getMetadataCollectionId(); + assertCondition((instanceHome.equals(metadataCollectionId)), + assertion20, + assertionMsg20 + entityDef.getName(), + RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_HOME.getProfileId(), + RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_HOME.getRequirementId()); + } /* * Now clean up. @@ -1380,6 +1392,4 @@ public void cleanup() throws Exception } } } - - -} +} \ No newline at end of file diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReidentify.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReidentify.java index 69c58abf852..7fe8310e1e6 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReidentify.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntityReidentify.java @@ -15,7 +15,6 @@ import java.util.ArrayList; import java.util.HashMap; -import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; @@ -55,12 +54,11 @@ public class TestSupportedEntityReidentify extends RepositoryConformanceTestCase private static final String assertionMsg8 = " repository supports reidentify of instances."; - private String metadataCollectionId; - private EntityDef entityDef; - private String testTypeName; + private final EntityDef entityDef; + private final String testTypeName; - private List createdEntitiesTUT = new ArrayList<>(); + private final List createdEntitiesTUT = new ArrayList<>(); /** @@ -76,9 +74,7 @@ public TestSupportedEntityReidentify(RepositoryConformanceWorkPad workPad, RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_IDENTIFIER.getProfileId(), RepositoryConformanceProfileRequirement.UPDATE_INSTANCE_IDENTIFIER.getRequirementId()); - this.metadataCollectionId = workPad.getTutMetadataCollectionId(); this.entityDef = entityDef; - this.testTypeName = this.updateTestIdByType(entityDef.getName(), testCaseId, testCaseName); @@ -433,12 +429,8 @@ private boolean doPropertiesMatch(InstanceProperties firstInstanceProps, Instanc // Assume the values match and prove it if they don't... boolean matchValues = true; - Iterator secondPropertiesKeyIterator = secondPropertiesKeySet.iterator(); - while (secondPropertiesKeyIterator.hasNext()) - { - String key = secondPropertiesKeyIterator.next(); - if (!(secondPropertiesMap.get(key).equals(firstPropertiesMap.get(key)))) - { + for (String key : secondPropertiesKeySet) { + if (!(secondPropertiesMap.get(key).equals(firstPropertiesMap.get(key)))) { matchValues = false; } } @@ -454,5 +446,4 @@ private boolean doPropertiesMatch(InstanceProperties firstInstanceProps, Instanc return matchProperties; } - -} +} \ No newline at end of file diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntitySearch.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntitySearch.java index 82e6bfa6fd6..86e14b07e6d 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntitySearch.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedEntitySearch.java @@ -95,7 +95,6 @@ public class TestSupportedEntitySearch extends RepositoryConformanceTestCase private static final String V_NULL = "null"; private RepositoryConformanceWorkPad workPad; - private String metadataCollectionId; private OMRSMetadataCollection metadataCollection; private EntityDef entityDef; private List attrList; @@ -129,7 +128,6 @@ public TestSupportedEntitySearch(RepositoryConformanceWorkPad workPad, RepositoryConformanceProfileRequirement.ENTITY_PROPERTY_SEARCH.getRequirementId()); this.workPad = workPad; - this.metadataCollectionId = workPad.getTutMetadataCollectionId(); this.entityDef = entityDef; this.testTypeName = this.updateTestIdByType(entityDef.getName(), TEST_CASE_ID, TEST_CASE_NAME); @@ -157,10 +155,8 @@ public TestSupportedEntitySearch(RepositoryConformanceWorkPad workPad, */ OMRSRepositoryConnector cohortRepositoryConnector = null; OMRSRepositoryHelper repositoryHelper = null; - if (workPad != null) { - cohortRepositoryConnector = workPad.getTutRepositoryConnector(); - repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - } + cohortRepositoryConnector = workPad.getTutRepositoryConnector(); + repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); EntityDef knownEntityDef = (EntityDef) repositoryHelper.getTypeDefByName(workPad.getLocalServerUserId(), entityDef.getName()); verifyCondition((entityDef.equals(knownEntityDef)), @@ -1278,11 +1274,10 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat */ Set possibleValues = propertyValueMap.get(attributeName).keySet(); - Iterator possibleValueIterator = possibleValues.iterator(); - while (possibleValueIterator.hasNext()) { + for (Object possibleValue : possibleValues) { - String stringValue = (String) (possibleValueIterator.next()); + String stringValue = (String) possibleValue; String truncatedStringValue = null; String literalisedValue = null; int stringValueLength; @@ -1311,7 +1306,7 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat return; /* not a long enough string to perform a meaningful test */ } truncatedLength = (int) (Math.ceil(stringValueLength / 2.0)); - truncatedStringValue = stringValue.substring(stringValueLength-truncatedLength, stringValueLength); + truncatedStringValue = stringValue.substring(stringValueLength - truncatedLength, stringValueLength); literalisedValue = literaliseStringPropertyEndsWith(truncatedStringValue); break; case Contains: @@ -1322,8 +1317,8 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat } truncatedLength = (int) (Math.floor(stringValueLength / 2.0)); int diff = stringValueLength - truncatedLength; - int halfDiff = diff/2; - truncatedStringValue = stringValue.substring(halfDiff, stringValueLength-halfDiff); + int halfDiff = diff / 2; + truncatedStringValue = stringValue.substring(halfDiff, stringValueLength - halfDiff); literalisedValue = literaliseStringPropertyContains(truncatedStringValue); break; } @@ -1340,9 +1335,7 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat int expectedEntityCount = 0; List expectedGUIDs = new ArrayList<>(); Set propertyNamesSet = propertyValueMap.keySet(); - Iterator propertyNamesSetIterator = propertyNamesSet.iterator(); - while (propertyNamesSetIterator.hasNext()) { - String propName = propertyNamesSetIterator.next(); + for (String propName : propertyNamesSet) { if (propertyCatMap.get(propName) == OM_PRIMITIVE_TYPE_STRING) { Map> propValues = propertyValueMap.get(propName); Set propertyValuesSet = propValues.keySet(); @@ -1405,22 +1398,21 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat List result; - Map parameters = getParameters(entityDef.getGUID(), literalisedValue); + Map parameters = getParameters(entityDef.getGUID(), literalisedValue); try { result = metadataCollection.findEntitiesByPropertyValue(workPad.getLocalServerUserId(), - entityDef.getGUID(), - literalisedValue, - 0, - null, - null, - null, - null, - null, - pageSize); - } - catch(Exception exc) { + entityDef.getGUID(), + literalisedValue, + 0, + null, + null, + null, + null, + null, + pageSize); + } catch (Exception exc) { /* * We are not expecting any exceptions from this method call. Log and fail the test. */ @@ -1429,7 +1421,7 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat String operationDescription = "find entities using repository helper regex for type " + entityDef.getName(); String msg = this.buildExceptionMessage(TEST_CASE_ID, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); - throw new Exception( msg , exc ); + throw new Exception(msg, exc); } @@ -1448,15 +1440,15 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat * So in that latter case we need to accept Min(). */ boolean limited_large_case = pageLimited && expectedEntityCount >= pageSize && resultCount == pageSize; - boolean limited_small_case = pageLimited && expectedEntityCount < pageSize && resultCount >= expectedEntityCount; + boolean limited_small_case = pageLimited && expectedEntityCount < pageSize && resultCount >= expectedEntityCount; boolean acceptable_result_size = unlimited_case || limited_large_case || limited_small_case; String assertionMessage = MessageFormat.format(ASSERTION_MSG_7, resultCount, expectedEntityCount, parameters); assertCondition((acceptable_result_size), - ASSERTION_7, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getRequirementId()); + ASSERTION_7, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getRequirementId()); /* @@ -1495,9 +1487,7 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat InstanceProperties entityProperties = entity.getProperties(); if (entityProperties != null) { Set entityPropertyNames = entityProperties.getInstanceProperties().keySet(); - Iterator entityPropertyNameIterator = entityPropertyNames.iterator(); - while (entityPropertyNameIterator.hasNext()) { - String propertyName = entityPropertyNameIterator.next(); + for (String propertyName : entityPropertyNames) { InstancePropertyValue ipValue = entityProperties.getPropertyValue(attributeName); if (ipValue != null) { InstancePropertyCategory ipCategory = ipValue.getInstancePropertyCategory(); @@ -1547,10 +1537,10 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat assertionMessage = MessageFormat.format(ASSERTION_MSG_8, unexpectedResult, parameters.toString()); assertCondition(unexpectedResult.equals("0"), - ASSERTION_8, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getRequirementId()); + ASSERTION_8, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_VALUE_SEARCH.getRequirementId()); } } @@ -1566,14 +1556,8 @@ private void performSearchCriteriaTests(String attributeName, RegexMatchType mat */ protected List getAllPropertiesForTypedef(String userId, TypeDef typeDef) { - - // Recursively gather all the TypeDefAttributes for the supertype hierarchy... - List allTypeDefAttributes = getPropertiesForTypeDef(userId, typeDef); - - - return allTypeDefAttributes; - + return getPropertiesForTypeDef(userId, typeDef); } @@ -1689,9 +1673,7 @@ private List diff(List lu, List ld) { List comp = new ArrayList<>(lu); if (ld != null) { for (String s : ld) { - if (comp.contains(s)) { - comp.remove(s); - } + comp.remove(s); } } return comp; @@ -1704,8 +1686,7 @@ private List diff(List lu, List ld) { public String literaliseStringProperty(String value) { OMRSRepositoryHelper repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - String litValue = repositoryHelper.getExactMatchRegex(value); - return litValue; + return repositoryHelper.getExactMatchRegex(value); } /* @@ -1715,8 +1696,7 @@ public String literaliseStringProperty(String value) public String literaliseStringPropertyExact(String value) { OMRSRepositoryHelper repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - String litValue = repositoryHelper.getExactMatchRegex(value); - return litValue; + return repositoryHelper.getExactMatchRegex(value); } /* @@ -1726,8 +1706,7 @@ public String literaliseStringPropertyExact(String value) public String literaliseStringPropertyStartsWith(String value) { OMRSRepositoryHelper repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - String litValue = repositoryHelper.getStartsWithRegex(value); - return litValue; + return repositoryHelper.getStartsWithRegex(value); } /* @@ -1737,8 +1716,7 @@ public String literaliseStringPropertyStartsWith(String value) public String literaliseStringPropertyEndsWith(String value) { OMRSRepositoryHelper repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - String litValue = repositoryHelper.getEndsWithRegex(value); - return litValue; + return repositoryHelper.getEndsWithRegex(value); } /* @@ -1748,8 +1726,7 @@ public String literaliseStringPropertyEndsWith(String value) public String literaliseStringPropertyContains(String value) { OMRSRepositoryHelper repositoryHelper = cohortRepositoryConnector.getRepositoryHelper(); - String litValue = repositoryHelper.getContainsRegex(value); - return litValue; + return repositoryHelper.getContainsRegex(value); } @@ -2001,11 +1978,10 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat */ Set possibleValues = propertyValueMap.get(attributeName).keySet(); - Iterator possibleValueIterator = possibleValues.iterator(); - while (possibleValueIterator.hasNext()) { + for (Object possibleValue : possibleValues) { - String stringValue = (String) (possibleValueIterator.next()); + String stringValue = (String) possibleValue; String truncatedStringValue = null; String regexValue = null; int stringValueLength; @@ -2067,15 +2043,12 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat int expectedEntityCount = 0; List expectedGUIDs = new ArrayList<>(); Set propertyNamesSet = propertyValueMap.keySet(); - Iterator propertyNamesSetIterator = propertyNamesSet.iterator(); - while (propertyNamesSetIterator.hasNext()) { - String propName = propertyNamesSetIterator.next(); + for (String propName : propertyNamesSet) { if (propertyCatMap.get(propName) == OM_PRIMITIVE_TYPE_STRING) { Map> propValues = propertyValueMap.get(propName); Set propertyValuesSet = propValues.keySet(); - Iterator propertyValuesSetIterator = propertyValuesSet.iterator(); - while (propertyValuesSetIterator.hasNext()) { - String knownStringValue = (String) (propertyValuesSetIterator.next()); + for (Object o : propertyValuesSet) { + String knownStringValue = (String) o; switch (matchType) { @@ -2091,7 +2064,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat break; case Prefix: /* PREFIX MATCH */ - if (knownStringValue.matches(truncatedStringValue+".*")) { + if (knownStringValue.matches(truncatedStringValue + ".*")) { for (String matchGUID : propValues.get(knownStringValue)) { if (!expectedGUIDs.contains(matchGUID)) { expectedGUIDs.add(matchGUID); @@ -2101,7 +2074,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat break; case Suffix: /* SUFFIX MATCH */ - if (knownStringValue.matches(".*"+truncatedStringValue)) { + if (knownStringValue.matches(".*" + truncatedStringValue)) { for (String matchGUID : propValues.get(knownStringValue)) { if (!expectedGUIDs.contains(matchGUID)) { expectedGUIDs.add(matchGUID); @@ -2111,7 +2084,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat break; case Contains: /* CONTAINS MATCH */ - if (knownStringValue.matches(".*"+truncatedStringValue+".*")) { + if (knownStringValue.matches(".*" + truncatedStringValue + ".*")) { for (String matchGUID : propValues.get(knownStringValue)) { if (!expectedGUIDs.contains(matchGUID)) { expectedGUIDs.add(matchGUID); @@ -2132,23 +2105,22 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat List result; - Map parameters = getParameters(entityDef.getGUID(), regexValue); + Map parameters = getParameters(entityDef.getGUID(), regexValue); try { result = metadataCollection.findEntitiesByPropertyValue(workPad.getLocalServerUserId(), - entityDef.getGUID(), - regexValue, - 0, - null, - null, - null, - null, - null, - pageSize); - - } - catch (FunctionNotSupportedException exc) { + entityDef.getGUID(), + regexValue, + 0, + null, + null, + null, + null, + null, + pageSize); + + } catch (FunctionNotSupportedException exc) { /* * Because the above test only exercises one optional function (advanced regex support) @@ -2156,14 +2128,13 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat */ super.addNotSupportedAssertion(ASSERTION_101, - ASSERTION_MSG_101 + exc.getMessage(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); + ASSERTION_MSG_101 + exc.getMessage(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); return; - } - catch(Exception exc) { + } catch (Exception exc) { /* * We are not expecting any exceptions from this method call. Log and fail the test. */ @@ -2172,7 +2143,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat String operationDescription = "find entities using general regex for type " + entityDef.getName(); String msg = this.buildExceptionMessage(TEST_CASE_ID, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); - throw new Exception( msg , exc ); + throw new Exception(msg, exc); } @@ -2197,10 +2168,10 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat String assertionMessage = MessageFormat.format(ASSERTION_MSG_11, resultCount, expectedEntityCount, parameters); assertCondition((acceptable_result_size), - ASSERTION_11, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); + ASSERTION_11, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); /* @@ -2239,9 +2210,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat InstanceProperties entityProperties = entity.getProperties(); if (entityProperties != null) { Set entityPropertyNames = entityProperties.getInstanceProperties().keySet(); - Iterator entityPropertyNameIterator = entityPropertyNames.iterator(); - while (entityPropertyNameIterator.hasNext()) { - String propertyName = entityPropertyNameIterator.next(); + for (String propertyName : entityPropertyNames) { InstancePropertyValue ipValue = entityProperties.getPropertyValue(attributeName); if (ipValue != null) { InstancePropertyCategory ipCategory = ipValue.getInstancePropertyCategory(); @@ -2260,19 +2229,19 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat break; case Prefix: /* PREFIX MATCH */ - if (propertyValueAsString.matches(truncatedStringValue+".*")) { + if (propertyValueAsString.matches(truncatedStringValue + ".*")) { validEntity = true; } break; case Suffix: /* SUFFIX MATCH */ - if (propertyValueAsString.matches(".*"+truncatedStringValue)) { + if (propertyValueAsString.matches(".*" + truncatedStringValue)) { validEntity = true; } break; case Contains: /* CONTAINS MATCH */ - if (propertyValueAsString.matches(".*"+truncatedStringValue+".*")) { + if (propertyValueAsString.matches(".*" + truncatedStringValue + ".*")) { validEntity = true; } break; @@ -2291,10 +2260,10 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat assertionMessage = MessageFormat.format(ASSERTION_MSG_12, unexpectedResult, parameters); assertCondition(unexpectedResult.equals("0"), - ASSERTION_12, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); + ASSERTION_12, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_VALUE_SEARCH.getRequirementId()); } @@ -2317,18 +2286,17 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat try { result = metadataCollection.findEntitiesByProperty(workPad.getLocalServerUserId(), - entityDef.getGUID(), - matchProperties, - MatchCriteria.ALL, - 0, - null, - null, - null, - null, - null, - pageSize); - } - catch (FunctionNotSupportedException exc) { + entityDef.getGUID(), + matchProperties, + MatchCriteria.ALL, + 0, + null, + null, + null, + null, + null, + pageSize); + } catch (FunctionNotSupportedException exc) { /* * Because the above test only exercises one optional function (advanced regex support) @@ -2336,14 +2304,13 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat */ super.addNotSupportedAssertion(ASSERTION_102, - ASSERTION_MSG_102 + exc.getMessage(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); + ASSERTION_MSG_102 + exc.getMessage(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); return; - } - catch(Exception exc) { + } catch (Exception exc) { /* * We are not expecting any exceptions from this method call. Log and fail the test. */ @@ -2352,7 +2319,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat String operationDescription = "find entities using general regex for type " + entityDef.getName(); String msg = this.buildExceptionMessage(TEST_CASE_ID, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); - throw new Exception( msg , exc ); + throw new Exception(msg, exc); } @@ -2377,10 +2344,10 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat assertionMessage = MessageFormat.format(ASSERTION_MSG_13, resultCount, expectedEntityCount, parameters); assertCondition((acceptable_result_size), - ASSERTION_13, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); + ASSERTION_13, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); /* @@ -2419,9 +2386,7 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat InstanceProperties entityProperties = entity.getProperties(); if (entityProperties != null) { Set entityPropertyNames = entityProperties.getInstanceProperties().keySet(); - Iterator entityPropertyNameIterator = entityPropertyNames.iterator(); - while (entityPropertyNameIterator.hasNext()) { - String propertyName = entityPropertyNameIterator.next(); + for (String propertyName : entityPropertyNames) { InstancePropertyValue ipValue = entityProperties.getPropertyValue(attributeName); if (ipValue != null) { InstancePropertyCategory ipCategory = ipValue.getInstancePropertyCategory(); @@ -2440,19 +2405,19 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat break; case Prefix: /* PREFIX MATCH */ - if (propertyValueAsString.matches(truncatedStringValue+".*")) { + if (propertyValueAsString.matches(truncatedStringValue + ".*")) { validEntity = true; } break; case Suffix: /* SUFFIX MATCH */ - if (propertyValueAsString.matches(".*"+truncatedStringValue)) { + if (propertyValueAsString.matches(".*" + truncatedStringValue)) { validEntity = true; } break; case Contains: /* CONTAINS MATCH */ - if (propertyValueAsString.matches(".*"+truncatedStringValue+".*")) { + if (propertyValueAsString.matches(".*" + truncatedStringValue + ".*")) { validEntity = true; } break; @@ -2471,10 +2436,10 @@ private void performAdvancedSearchTests(String attributeName, RegexMatchType mat assertionMessage = MessageFormat.format(ASSERTION_MSG_14, unexpectedResult, parameters); assertCondition(unexpectedResult.equals("0"), - ASSERTION_14, - assertionMessage, - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), - RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); + ASSERTION_14, + assertionMessage, + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getProfileId(), + RepositoryConformanceProfileRequirement.ENTITY_ADVANCED_PROPERTY_SEARCH.getRequirementId()); } } @@ -2556,9 +2521,6 @@ private String escapeRegexSpecials(String inputString) { outputStringBldr.append(c); } - String outputString = outputStringBldr.toString(); - - return outputString; + return outputStringBldr.toString(); } - -} +} \ No newline at end of file diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedRelationshipLifecycle.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedRelationshipLifecycle.java index ea65a3f57e1..e5589b70737 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedRelationshipLifecycle.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/instances/TestSupportedRelationshipLifecycle.java @@ -6,10 +6,7 @@ import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.MatchCriteria; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityDetail; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntityProxy; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.EntitySummary; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProperties; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstancePropertyValue; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.instances.InstanceProvenanceType; @@ -474,11 +471,10 @@ protected void run() throws Exception * We are not expecting any exceptions from this method call. Log and fail the test. */ - String methodName = retrievalOperationName; String operationDescription = "retrieve a relationship of type " + relationshipDef.getName(); Map parameters = new HashMap<>(); parameters.put("relationshipGUID", newRelationship.getGUID()); - String msg = this.buildExceptionMessage(testCaseId, methodName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); + String msg = this.buildExceptionMessage(testCaseId, retrievalOperationName, operationDescription, parameters, exc.getClass().getSimpleName(), exc.getMessage()); throw new Exception(msg, exc); @@ -1210,12 +1206,8 @@ private boolean doPropertiesMatch(InstanceProperties firstInstanceProps, Instanc // Assume the values match and prove it if they don't... boolean matchValues = true; - Iterator secondPropertiesKeyIterator = secondPropertiesKeySet.iterator(); - while (secondPropertiesKeyIterator.hasNext()) - { - String key = secondPropertiesKeyIterator.next(); - if (!(secondPropertiesMap.get(key).equals(firstPropertiesMap.get(key)))) - { + for (String key : secondPropertiesKeySet) { + if (!(secondPropertiesMap.get(key).equals(firstPropertiesMap.get(key)))) { matchValues = false; } } diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestGetTypeDefGallery.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestGetTypeDefGallery.java index e3852576a82..1978e9b8c2f 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestGetTypeDefGallery.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestGetTypeDefGallery.java @@ -11,9 +11,7 @@ import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefGallery; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; public class TestGetTypeDefGallery extends RepositoryConformanceTestCase { diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedAttributeTypeDef.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedAttributeTypeDef.java index ec8ac27d672..a6eccabf620 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedAttributeTypeDef.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedAttributeTypeDef.java @@ -3,7 +3,6 @@ package org.odpi.openmetadata.conformance.tests.repository.types; import org.odpi.openmetadata.conformance.tests.repository.RepositoryConformanceTestCase; -import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.*; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedTypeDef.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedTypeDef.java index 43f9f1b711f..06562f00f77 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedTypeDef.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestSupportedTypeDef.java @@ -3,7 +3,6 @@ package org.odpi.openmetadata.conformance.tests.repository.types; import org.odpi.openmetadata.conformance.tests.repository.RepositoryConformanceTestCase; -import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.*; diff --git a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestValidTypeDefEvent.java b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestValidTypeDefEvent.java index 715cf395954..4ada1c42057 100644 --- a/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestValidTypeDefEvent.java +++ b/open-metadata-conformance-suite/open-metadata-conformance-suite-server/src/main/java/org/odpi/openmetadata/conformance/tests/repository/types/TestValidTypeDefEvent.java @@ -5,20 +5,15 @@ import org.odpi.openmetadata.conformance.tests.repository.RepositoryConformanceTestCase; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceProfileRequirement; import org.odpi.openmetadata.conformance.workbenches.repository.RepositoryConformanceWorkPad; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.OMRSMetadataCollection; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.AttributeTypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDefPatch; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryConnector; -import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; import org.odpi.openmetadata.repositoryservices.events.OMRSEventOriginator; import org.odpi.openmetadata.repositoryservices.events.OMRSTypeDefEvent; import org.odpi.openmetadata.repositoryservices.events.OMRSTypeDefEventType; import java.util.Date; -import static org.odpi.openmetadata.repositoryservices.events.OMRSTypeDefEventType.UPDATED_TYPEDEF_EVENT; - /** * TestValidTypeDefEvent validates the format of an incoming TypeDefEvent diff --git a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java index a8e6134e3ec..777d5bfda82 100644 --- a/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java +++ b/open-metadata-implementation/access-services/analytics-modeling/analytics-modeling-server/src/main/java/org/odpi/openmetadata/accessservices/analyticsmodeling/auditlog/AnalyticsModelingAuditCode.java @@ -67,7 +67,7 @@ public enum AnalyticsModelingAuditCode implements AuditLogMessageSet { ; - private AuditLogMessageDefinition messageDefinition; + private final AuditLogMessageDefinition messageDefinition; AnalyticsModelingAuditCode(String logMessageId, OMRSAuditLogRecordSeverity severity, String logMessage, String systemAction, String userAction) { diff --git a/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalog.java b/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalog.java index 8506048e603..21e1636cd3f 100644 --- a/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalog.java +++ b/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalog.java @@ -14,8 +14,8 @@ import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.RelationshipResponse; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; import org.odpi.openmetadata.commonservices.ffdc.rest.FFDCRESTClient; +import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; /** @@ -60,12 +60,12 @@ public class AssetCatalog extends FFDCRESTClient implements AssetCatalogInterfac * @param serverPlatformURLRoot the network address of the server running the OMAS REST servers * @throws InvalidParameterException if parameter validation fails */ - public AssetCatalog(String serverName, String serverPlatformURLRoot) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + public AssetCatalog(String serverName, String serverPlatformURLRoot) throws InvalidParameterException { super(serverName, serverPlatformURLRoot); } public AssetCatalog(String serverName, String serverPlatformURLRoot, String userId, String password) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + throws InvalidParameterException { super(serverName, serverPlatformURLRoot, userId, password); } @@ -76,7 +76,7 @@ public AssetCatalog(String serverName, String serverPlatformURLRoot, String user public AssetDescriptionResponse getAssetDetails(String userId, String assetGUID, String assetType) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getAssetDetails"; validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER); @@ -95,7 +95,7 @@ public AssetDescriptionResponse getAssetDetails(String userId, public AssetDescriptionResponse getAssetUniverse(String userId, String assetGUID, String assetType) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getAssetUniverse"; validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER); @@ -118,7 +118,7 @@ public RelationshipListResponse getAssetRelationships(String userId, String relationshipType, Integer from, Integer pageSize) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getAssetRelationships"; validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER); @@ -140,7 +140,7 @@ public ClassificationListResponse getClassificationsForAsset(String userId, String assetGUID, String assetType, String classificationName) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getClassificationsForAsset"; validateUserAndAssetGUID(userId, assetGUID, methodName, GUID_PARAMETER); @@ -160,7 +160,7 @@ public ClassificationListResponse getClassificationsForAsset(String userId, public AssetDescriptionListResponse getLinkingAssets(String userId, String startAssetGUID, String endAssetGUID) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getLinkingAssets"; validateStartAndEndAssetsGUIDs(userId, startAssetGUID, endAssetGUID, methodName); @@ -180,7 +180,7 @@ public AssetDescriptionListResponse getLinkingAssets(String userId, public RelationshipListResponse getLinkingRelationships(String userId, String startAssetGUID, String endAssetGUID) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getLinkingRelationships"; validateStartAndEndAssetsGUIDs(userId, startAssetGUID, endAssetGUID, methodName); @@ -200,7 +200,7 @@ public RelationshipListResponse getLinkingRelationships(String userId, public AssetDescriptionListResponse getAssetsFromNeighborhood(String userId, String assetGUID, SearchParameters searchParameters) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getAssetsFromNeighborhood"; validateSearchParams(userId, assetGUID, searchParameters, methodName); @@ -220,7 +220,7 @@ public AssetDescriptionListResponse getAssetsFromNeighborhood(String userId, public AssetListResponse searchByType(String userId, String searchCriteria, SearchParameters searchParameters) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "searchByType"; invalidParameterHandler.validateUserId(methodName, userId); @@ -242,7 +242,7 @@ public AssetListResponse searchByType(String userId, public AssetResponse getAssetContext(String userId, String assetGUID, String assetType) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getAssetContext"; invalidParameterHandler.validateUserId(methodName, userId); @@ -264,7 +264,7 @@ public RelationshipResponse getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { String methodName = "getRelationshipBetweenEntities"; validateStartAndEndAssetsGUIDs(userId, entity1GUID, entity2GUID, methodName); @@ -280,7 +280,7 @@ public RelationshipResponse getRelationshipBetweenEntities(String userId, @Override public AssetCatalogSupportedTypes getSupportedTypes(String userId, String type) - throws PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + throws PropertyServerException, InvalidParameterException { String methodName = "getSupportedTypes"; AssetCatalogSupportedTypes assetCatalogSupportedTypes = callGetRESTCall(methodName, AssetCatalogSupportedTypes.class, @@ -317,7 +317,7 @@ private void validateSearchParams(String userId, } private void detectExceptions(AssetCatalogOMASAPIResponse response) - throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException { + throws InvalidParameterException, PropertyServerException { restExceptionHandler.detectAndThrowInvalidParameterException(response); restExceptionHandler.detectAndThrowPropertyServerException(response); } diff --git a/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalogInterface.java b/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalogInterface.java index 2a49ffa5804..434e57e8f8c 100644 --- a/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalogInterface.java +++ b/open-metadata-implementation/access-services/asset-catalog/asset-catalog-client/src/main/java/org/odpi/openmetadata/accessservices/assetcatalog/AssetCatalogInterface.java @@ -10,7 +10,7 @@ import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.ClassificationListResponse; import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.RelationshipListResponse; import org.odpi.openmetadata.accessservices.assetcatalog.model.rest.responses.RelationshipResponse; -import org.odpi.openmetadata.commonservices.ffdc.exceptions.InvalidParameterException; +import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; /** @@ -35,7 +35,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetDescriptionResponse getAssetDetails(String userId, String assetGUID, String assetType) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetDescriptionResponse getAssetDetails(String userId, String assetGUID, String assetType) throws InvalidParameterException, PropertyServerException; /** * Fetch asset's header, classification, properties and relationships @@ -47,7 +47,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetDescriptionResponse getAssetUniverse(String userId, String assetGUID, String assetType) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetDescriptionResponse getAssetUniverse(String userId, String assetGUID, String assetType) throws InvalidParameterException, PropertyServerException; /** * Fetch the relationships for a specific asset @@ -62,7 +62,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - RelationshipListResponse getAssetRelationships(String userId, String assetGUID, String assetType, String relationshipType, Integer from, Integer pageSize) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + RelationshipListResponse getAssetRelationships(String userId, String assetGUID, String assetType, String relationshipType, Integer from, Integer pageSize) throws InvalidParameterException, PropertyServerException; /** * Fetch the classification for a specific asset @@ -75,7 +75,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - ClassificationListResponse getClassificationsForAsset(String userId, String assetGUID, String assetType, String classificationName) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + ClassificationListResponse getClassificationsForAsset(String userId, String assetGUID, String assetType, String classificationName) throws InvalidParameterException, PropertyServerException; /** * Returns a sub-graph of intermediate assets that connected two assets @@ -87,7 +87,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetDescriptionListResponse getLinkingAssets(String userId, String startAssetGUID, String endAssetGUID) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetDescriptionListResponse getLinkingAssets(String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException; /** * Return a sub-graph of relationships that connect two assets @@ -99,7 +99,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - RelationshipListResponse getLinkingRelationships(String userId, String startAssetGUID, String endAssetGUID) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + RelationshipListResponse getLinkingRelationships(String userId, String startAssetGUID, String endAssetGUID) throws InvalidParameterException, PropertyServerException; /** * Returns the sub-graph that represents the list of assets that in neighborhood of the given asset @@ -111,7 +111,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetDescriptionListResponse getAssetsFromNeighborhood(String userId, String assetGUID, SearchParameters searchParameters) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetDescriptionListResponse getAssetsFromNeighborhood(String userId, String assetGUID, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException; /** * Return a list of assets matching the search criteria without the full context @@ -123,7 +123,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetListResponse searchByType(String userId, String searchCriteria, SearchParameters searchParameters) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetListResponse searchByType(String userId, String searchCriteria, SearchParameters searchParameters) throws InvalidParameterException, PropertyServerException; /** * Return the full context of an asset/glossary term based on its identifier. @@ -136,7 +136,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - AssetResponse getAssetContext(String userId, String assetGUID, String assetType) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + AssetResponse getAssetContext(String userId, String assetGUID, String assetType) throws InvalidParameterException, PropertyServerException; /** @@ -151,7 +151,7 @@ public interface AssetCatalogInterface { * @throws PropertyServerException if a problem occurs while serving the request * @throws InvalidParameterException if parameter validation fails */ - RelationshipResponse getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, PropertyServerException; + RelationshipResponse getRelationshipBetweenEntities(String userId, String entity1GUID, String entity2GUID, String relationshipType) throws InvalidParameterException, PropertyServerException; /** * Returns the list with supported types for search, including the sub-types supported @@ -161,7 +161,5 @@ public interface AssetCatalogInterface { * @return list of types and sub-types supported for search */ - AssetCatalogSupportedTypes getSupportedTypes(String userId, String type) throws org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException, - org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException, - org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; + AssetCatalogSupportedTypes getSupportedTypes(String userId, String type) throws InvalidParameterException, PropertyServerException; } \ No newline at end of file diff --git a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerAuditCode.java b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerAuditCode.java index c356f8235de..7e6ea604387 100644 --- a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerAuditCode.java +++ b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerAuditCode.java @@ -4,13 +4,8 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageDefinition; import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLogRecordSeverity; -import java.text.MessageFormat; -import java.util.Arrays; - /** * The AssetConsumerAuditCode is used to define the message content for the OMRS Audit Log. * diff --git a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerErrorCode.java b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerErrorCode.java index af4478bce96..1afdb87e7e4 100644 --- a/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerErrorCode.java +++ b/open-metadata-implementation/access-services/asset-consumer/asset-consumer-api/src/main/java/org/odpi/openmetadata/accessservices/assetconsumer/ffdc/AssetConsumerErrorCode.java @@ -4,11 +4,6 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.MessageFormat; -import java.util.Arrays; /** * The AssetConsumerErrorCode is used to define first failure data capture (FFDC) for errors that occur when working with diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/ffdc/AssetOwnerAuditCode.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/ffdc/AssetOwnerAuditCode.java index f97fb2826bc..7b643cb953f 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/ffdc/AssetOwnerAuditCode.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/ffdc/AssetOwnerAuditCode.java @@ -4,7 +4,6 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageDefinition; import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageSet; -import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogRecordSeverity; import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLogRecordSeverity; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DerivedSchemaAttributeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DerivedSchemaAttributeProperties.java index c9c64014141..f932879782f 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DerivedSchemaAttributeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/DerivedSchemaAttributeProperties.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import org.odpi.openmetadata.frameworks.connectors.properties.beans.DerivedSchemaAttribute; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaAttribute; import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaImplementationQuery; import java.util.ArrayList; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java index df9ba2c2755..3b2afe60fd2 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/EnumSchemaTypeProperties.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import org.odpi.openmetadata.frameworks.connectors.properties.beans.EnumSchemaType; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaType; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java index a3fa51dc8aa..e5478d12897 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/PrimitiveSchemaTypeProperties.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import org.odpi.openmetadata.frameworks.connectors.properties.beans.PrimitiveSchemaType; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaType; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaElementProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaElementProperties.java index 83225a809d2..cb0eb3eb959 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaElementProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/SchemaElementProperties.java @@ -3,9 +3,6 @@ package org.odpi.openmetadata.accessservices.assetowner.properties; import com.fasterxml.jackson.annotation.*; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaElement; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaType; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SimpleSchemaType; import java.util.Objects; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java index df1142a0c31..900871fe205 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/StructDocumentTypeProperties.java @@ -3,9 +3,9 @@ package org.odpi.openmetadata.accessservices.assetowner.properties; -import com.fasterxml.jackson.annotation.*; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaElement; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaType; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java index 64a1b8ec5e0..0e618df7720 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/properties/TabularColumnProperties.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.frameworks.connectors.properties.beans.SchemaElement; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/rest/NewFileAssetRequestBody.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/rest/NewFileAssetRequestBody.java index 61ed735c5d3..e56943fa8b5 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/rest/NewFileAssetRequestBody.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-api/src/main/java/org/odpi/openmetadata/accessservices/assetowner/rest/NewFileAssetRequestBody.java @@ -4,7 +4,6 @@ import com.fasterxml.jackson.annotation.*; -import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/AvroFileAssetOwner.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/AvroFileAssetOwner.java index c5a36cd5f79..83e77f7683c 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/AvroFileAssetOwner.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/AvroFileAssetOwner.java @@ -4,8 +4,6 @@ import org.odpi.openmetadata.accessservices.assetowner.api.AssetOnboardingAvroFileInterface; import org.odpi.openmetadata.accessservices.assetowner.rest.NewFileAssetRequestBody; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ffdc.RESTExceptionHandler; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; diff --git a/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/FileSystemAssetOwner.java b/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/FileSystemAssetOwner.java index 3879b2d9a4e..1772b346c48 100644 --- a/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/FileSystemAssetOwner.java +++ b/open-metadata-implementation/access-services/asset-owner/asset-owner-client/src/main/java/org/odpi/openmetadata/accessservices/assetowner/client/FileSystemAssetOwner.java @@ -6,10 +6,8 @@ import org.odpi.openmetadata.accessservices.assetowner.properties.FileSystem; import org.odpi.openmetadata.accessservices.assetowner.properties.Folder; import org.odpi.openmetadata.accessservices.assetowner.rest.*; -import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDResponse; -import org.odpi.openmetadata.commonservices.ffdc.rest.NullRequestBody; import org.odpi.openmetadata.frameworks.auditlog.AuditLog; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/UserIdentityManagementInterface.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/UserIdentityManagementInterface.java index 3f678b7e679..0e2c24993c4 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/UserIdentityManagementInterface.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/api/UserIdentityManagementInterface.java @@ -2,7 +2,6 @@ /* Copyright Contributors to the ODPi Egeria project. */ package org.odpi.openmetadata.accessservices.communityprofile.api; -import org.odpi.openmetadata.accessservices.communityprofile.ffdc.exceptions.NoProfileForUserException; import org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException; import org.odpi.openmetadata.frameworks.connectors.ffdc.PropertyServerException; import org.odpi.openmetadata.frameworks.connectors.ffdc.UserNotAuthorizedException; diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/ffdc/CommunityProfileAuditCode.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/ffdc/CommunityProfileAuditCode.java index 8b3518fe1bf..b4eb93e0518 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/ffdc/CommunityProfileAuditCode.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/ffdc/CommunityProfileAuditCode.java @@ -5,11 +5,6 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageDefinition; import org.odpi.openmetadata.frameworks.auditlog.messagesets.AuditLogMessageSet; import org.odpi.openmetadata.repositoryservices.auditlog.OMRSAuditLogRecordSeverity; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.MessageFormat; -import java.util.Arrays; /** * The CommunityProfileAuditCode is used to define the message content for the OMRS Audit Log. diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/CommonHeader.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/CommonHeader.java index 634a73571cf..b70692c7cd3 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/CommonHeader.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/CommonHeader.java @@ -5,9 +5,6 @@ import com.fasterxml.jackson.annotation.*; -import java.util.HashMap; -import java.util.List; -import java.util.Map; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; diff --git a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/NoteEntryHeader.java b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/NoteEntryHeader.java index b8e77bb0baf..c8b474fcbbd 100644 --- a/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/NoteEntryHeader.java +++ b/open-metadata-implementation/access-services/community-profile/community-profile-api/src/main/java/org/odpi/openmetadata/accessservices/communityprofile/properties/NoteEntryHeader.java @@ -5,8 +5,6 @@ import com.fasterxml.jackson.annotation.*; -import java.util.ArrayList; -import java.util.List; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessListResponse.java b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessListResponse.java index 43374c17760..50698e30757 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessListResponse.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-api/src/main/java/org/odpi/openmetadata/accessservices/dataengine/rest/ProcessListResponse.java @@ -5,7 +5,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.odpi.openmetadata.commonservices.ffdc.rest.GUIDListResponse; -import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Objects; diff --git a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineSchemaTypeHandler.java b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineSchemaTypeHandler.java index 404a53e5449..01719186888 100644 --- a/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineSchemaTypeHandler.java +++ b/open-metadata-implementation/access-services/data-engine/data-engine-server/src/main/java/org/odpi/openmetadata/accessservices/dataengine/server/handlers/DataEngineSchemaTypeHandler.java @@ -8,7 +8,6 @@ import org.odpi.openmetadata.accessservices.dataengine.server.mappers.PortPropertiesMapper; import org.odpi.openmetadata.accessservices.dataengine.server.mappers.SchemaTypePropertiesMapper; import org.odpi.openmetadata.commonservices.ffdc.InvalidParameterHandler; -import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.builders.ComplexSchemaTypeBuilder; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.builders.SchemaAttributeBuilder; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.builders.SchemaTypeBuilder; import org.odpi.openmetadata.commonservices.ocf.metadatamanagement.handlers.SchemaTypeHandler; @@ -27,10 +26,8 @@ import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.properties.typedefs.TypeDef; import org.odpi.openmetadata.repositoryservices.connectors.stores.metadatacollectionstore.repositoryconnector.OMRSRepositoryHelper; -import java.util.HashMap; import java.util.HashSet; import java.util.List; -import java.util.Map; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/api/DataManagerEventListener.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/api/DataManagerEventListener.java index 7a388947b2a..1b50189964e 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/api/DataManagerEventListener.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/api/DataManagerEventListener.java @@ -10,12 +10,12 @@ * DataManagerEventListener is the interface that a client implements to * register to receive the events from the Data Manager OMAS's out topic. */ -public abstract class DataManagerEventListener +public interface DataManagerEventListener { /** * Process an event that was published by the Data Manager OMAS. * * @param event event object - call getEventType to find out what type of event. */ - public abstract void processEvent(DataManagerOutTopicEvent event); + void processEvent(DataManagerOutTopicEvent event); } diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/ffdc/DataManagerErrorCode.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/ffdc/DataManagerErrorCode.java index 75e9e7c1589..57d0546d1a6 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/ffdc/DataManagerErrorCode.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/ffdc/DataManagerErrorCode.java @@ -4,11 +4,6 @@ import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageDefinition; import org.odpi.openmetadata.frameworks.auditlog.messagesets.ExceptionMessageSet; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.text.MessageFormat; -import java.util.Arrays; /** * The DataManagerErrorCode is used to define first failure data capture (FFDC) for errors that occur when working with diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/DataFileElement.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/DataFileElement.java index 4b824dd99d1..95e45175887 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/DataFileElement.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/DataFileElement.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; import org.odpi.openmetadata.accessservices.datamanager.properties.DataFileProperties; -import org.odpi.openmetadata.accessservices.datamanager.properties.DatabaseProperties; import java.io.Serializable; import java.util.Objects; diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileFolderElement.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileFolderElement.java index fb36cb0db58..70e0730c8f0 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileFolderElement.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileFolderElement.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.accessservices.datamanager.properties.DatabaseProperties; import org.odpi.openmetadata.accessservices.datamanager.properties.FileFolderProperties; import java.io.Serializable; diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileSystemElement.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileSystemElement.java index 84231721987..cab543aa676 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileSystemElement.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/metadataelements/FileSystemElement.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import org.odpi.openmetadata.accessservices.datamanager.properties.DatabaseProperties; import org.odpi.openmetadata.accessservices.datamanager.properties.FileSystemProperties; import java.io.Serializable; diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DataManagerProperties.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DataManagerProperties.java index 89b7c60ca5c..f14ff6ae563 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DataManagerProperties.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DataManagerProperties.java @@ -7,9 +7,6 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties; import com.fasterxml.jackson.annotation.JsonInclude; -import java.io.Serializable; -import java.util.Objects; - import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.PUBLIC_ONLY; diff --git a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DatabaseViewProperties.java b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DatabaseViewProperties.java index a603c61b617..37f5fb4d94b 100644 --- a/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DatabaseViewProperties.java +++ b/open-metadata-implementation/access-services/data-manager/data-manager-api/src/main/java/org/odpi/openmetadata/accessservices/datamanager/properties/DatabaseViewProperties.java @@ -3,10 +3,10 @@ package org.odpi.openmetadata.accessservices.datamanager.properties; -import com.fasterxml.jackson.annotation.*; +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonInclude; -import java.util.Date; -import java.util.Map; import java.util.Objects; import static com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility.NONE; diff --git a/open-metadata-implementation/access-services/information-view/information-view-server/src/test/java/org/odpi/openmetadata/accessservices/informationview/DatabaseContextHandlerTest.java b/open-metadata-implementation/access-services/information-view/information-view-server/src/test/java/org/odpi/openmetadata/accessservices/informationview/DatabaseContextHandlerTest.java index ade5990ccad..6a2c59f427e 100644 --- a/open-metadata-implementation/access-services/information-view/information-view-server/src/test/java/org/odpi/openmetadata/accessservices/informationview/DatabaseContextHandlerTest.java +++ b/open-metadata-implementation/access-services/information-view/information-view-server/src/test/java/org/odpi/openmetadata/accessservices/informationview/DatabaseContextHandlerTest.java @@ -5,9 +5,10 @@ import org.junit.Before; import org.junit.Ignore; import org.junit.Test; -import org.junit.jupiter.api.Disabled; +import org.junit.jupiter.api.Assertions; import org.odpi.openmetadata.accessservices.informationview.assets.DatabaseContextHandler; import org.odpi.openmetadata.accessservices.informationview.events.DatabaseSource; +import org.odpi.openmetadata.accessservices.informationview.events.TableColumn; import org.odpi.openmetadata.accessservices.informationview.events.TableContextEvent; import org.odpi.openmetadata.accessservices.informationview.events.TableSource; @@ -18,7 +19,6 @@ import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; -import static org.junit.jupiter.api.Assertions.assertTrue; public class DatabaseContextHandlerTest extends InMemoryRepositoryTest{ @@ -35,7 +35,7 @@ public void setup() throws Exception { public void testDatabaseContextServices() { List databases = databaseContextHandler.getDatabases(0, 10); assertNotNull(databases); - assertTrue( databases.size() == 1, "Database was not retrieved"); + Assertions.assertEquals(1, databases.size(), "Database was not retrieved"); List tables = databaseContextHandler.getTables(databases.get(0).getGuid(), 0, 10); @@ -51,7 +51,7 @@ public void testDatabaseContextServices() { assertEquals("host", contexts.get(0).getTableSource().getDatabaseSource().getEndpointSource().getNetworkAddress()); assertNotNull(contexts.get(0).getTableColumns()); assertEquals(3, contexts.get(0).getTableColumns().size()); - List columnNames = contexts.get(0).getTableColumns().stream().map(c -> c.getName()).collect(Collectors.toList()); + List columnNames = contexts.get(0).getTableColumns().stream().map(TableColumn::getName).collect(Collectors.toList()); List expectedNames = new ArrayList<>(); expectedNames.add("ROLE"); expectedNames.add("FNAME"); diff --git a/open-metadata-implementation/user-interfaces/ui-chassis/ui-chassis-spring/src/test/java/org/odpi/openmetadata/userinterface/uichassis/springboot/service/AssetCatalogOMASServiceTest.java b/open-metadata-implementation/user-interfaces/ui-chassis/ui-chassis-spring/src/test/java/org/odpi/openmetadata/userinterface/uichassis/springboot/service/AssetCatalogOMASServiceTest.java index c2623e88e0b..15374e0d631 100644 --- a/open-metadata-implementation/user-interfaces/ui-chassis/ui-chassis-spring/src/test/java/org/odpi/openmetadata/userinterface/uichassis/springboot/service/AssetCatalogOMASServiceTest.java +++ b/open-metadata-implementation/user-interfaces/ui-chassis/ui-chassis-spring/src/test/java/org/odpi/openmetadata/userinterface/uichassis/springboot/service/AssetCatalogOMASServiceTest.java @@ -53,7 +53,7 @@ class AssetCatalogOMASServiceTest { @Test @DisplayName("Asset Details") - void testGetAssetDetails() throws PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + void testGetAssetDetails() throws PropertyServerException, InvalidParameterException { AssetDescriptionResponse expectedResponse = mockAssetDescriptionResponse(); when(assetCatalog.getAssetDetails(anyString(), anyString(), anyString())).thenReturn(expectedResponse); AssetDescription response = assetCatalogOMASService.getAssetDetails(user, assetId, typeDef); @@ -62,7 +62,7 @@ void testGetAssetDetails() throws PropertyServerException, org.odpi.openmetadata @Test @DisplayName("Asset Universe") - void testGetAssetUniverse() throws PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + void testGetAssetUniverse() throws PropertyServerException, InvalidParameterException { AssetDescriptionResponse expectedResponse = mockAssetDescriptionResponse(); when(assetCatalog.getAssetUniverse(anyString(), anyString(), anyString())).thenReturn(expectedResponse); AssetDescription response = assetCatalogOMASService.getAssetUniverse(user, assetId, typeDef); @@ -80,7 +80,7 @@ void testGetAssetRelationships() throws PropertyServerException, InvalidParamete @Test @DisplayName("Asset Classification") - void testGetClassificationForAsset() throws PropertyServerException, org.odpi.openmetadata.frameworks.connectors.ffdc.InvalidParameterException { + void testGetClassificationForAsset() throws PropertyServerException, InvalidParameterException { ClassificationListResponse expectedResponse = mockClassificationsResponse(); when(assetCatalog.getClassificationsForAsset(anyString(), anyString(), anyString(), anyString())).thenReturn(expectedResponse); List resultList = assetCatalogOMASService.getClassificationsForAsset(user, assetId, typeDef, CONFIDENTIALITY); From 4d15eddc4aaf00bfc84f76b028ff30130e399d0a Mon Sep 17 00:00:00 2001 From: Ilya Ksenofontov Date: Sat, 5 Sep 2020 09:23:09 +0300 Subject: [PATCH 2/2] # Fixed some code smells from sonar Signed-off-by: immmus --- .../topic/kafka/KafkaOpenMetadataEventConsumer.java | 4 ++-- .../topic/kafka/KafkaOpenMetadataEventConsumerProperty.java | 4 ++-- .../topic/kafka/KafkaOpenMetadataTopicConnector.java | 6 ++---- .../kafka/KafkaOpenMetadataTopicConnectorAuditCode.java | 2 +- .../kafka/KafkaOpenMetadataTopicConnectorErrorCode.java | 2 +- 5 files changed, 8 insertions(+), 10 deletions(-) diff --git a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumer.java b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumer.java index 0100631c229..fba1cbbb663 100644 --- a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumer.java +++ b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumer.java @@ -58,7 +58,7 @@ public class KafkaOpenMetadataEventConsumer implements Runnable private final long messageProcessingStatusCheckIntervalMs; private final long messageProcessingTimeoutMs; - private Map> unprocessedEventQueues = new HashMap<>(); + private final Map> unprocessedEventQueues = new HashMap<>(); @@ -114,7 +114,7 @@ private static boolean getBooleanProperty(Properties p, String name, boolean def if (value == null) { return defaultValue; } - return Boolean.valueOf(value).booleanValue(); + return Boolean.parseBoolean(value); } diff --git a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumerProperty.java b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumerProperty.java index dffce91c0b4..bf5a8806ebf 100644 --- a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumerProperty.java +++ b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataEventConsumerProperty.java @@ -56,8 +56,8 @@ public enum KafkaOpenMetadataEventConsumerProperty */ COMMIT_CHECK_INTERVAL_MS("commit_check_interval_ms", "5000"); - private String propertyName; - private String defaultValue; + private final String propertyName; + private final String defaultValue; KafkaOpenMetadataEventConsumerProperty(String name, String defaultValue) { diff --git a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnector.java b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnector.java index 2b1f06815bb..2bb169680e7 100644 --- a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnector.java +++ b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnector.java @@ -296,7 +296,7 @@ protected List checkForIncomingEvents() if ((incomingEventsList != null) && (!incomingEventsList.isEmpty())) { - log.debug("Checking for events. Number of found events: {0}", incomingEventsList.size()); + log.debug("Checking for events. Number of found events: {}", incomingEventsList.size()); newEvents = new ArrayList<>(incomingEventsList); // empty incomingEventsList otherwise same events will be sent again @@ -460,7 +460,5 @@ public Exception getLastException() { return lastException; } - - } -} +} \ No newline at end of file diff --git a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorAuditCode.java b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorAuditCode.java index 8d2f2ca4573..a42e57b2393 100644 --- a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorAuditCode.java +++ b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorAuditCode.java @@ -125,7 +125,7 @@ public enum KafkaOpenMetadataTopicConnectorAuditCode implements AuditLogMessageS "Ensure the server has shutdown cleanly") ; - private AuditLogMessageDefinition messageDefinition; + private final AuditLogMessageDefinition messageDefinition; /** diff --git a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorErrorCode.java b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorErrorCode.java index d14c4f3f64d..4f6defd1d7c 100644 --- a/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorErrorCode.java +++ b/open-metadata-implementation/adapters/open-connectors/event-bus-connectors/open-metadata-topic-connectors/kafka-open-metadata-topic-connector/src/main/java/org/odpi/openmetadata/adapters/eventbus/topic/kafka/KafkaOpenMetadataTopicConnectorErrorCode.java @@ -37,7 +37,7 @@ public enum KafkaOpenMetadataTopicConnectorErrorCode implements ExceptionMessage "The system is unable initialize.", "Ensure that Kafka is available") ; - private ExceptionMessageDefinition messageDefinition; + private final ExceptionMessageDefinition messageDefinition; /**