diff --git a/.github/workflows/codeql-v4.yml b/.github/workflows/codeql-v4.yml index c7930d3e4bb..30b687acd44 100644 --- a/.github/workflows/codeql-v4.yml +++ b/.github/workflows/codeql-v4.yml @@ -47,6 +47,6 @@ jobs: # codeQL requires a full before/after build to compare results. Caching can result in action failing #cache-read-only: true cache-disabled: true - arguments: -x javadoc -x test build + arguments: -x javadoc -x test build -PskipOpenTypesFVT - name: Perform CodeQL Analysis uses: github/codeql-action/analyze@v2 diff --git a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle index 1c36fc11cb7..29a97b88c01 100644 --- a/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle +++ b/open-metadata-test/open-metadata-fvt/access-services-fvt/asset-consumer-fvt/build.gradle @@ -104,7 +104,9 @@ task cleanData(type: Delete) { test { description 'Run Integration Tests' group = 'verification' - outputs.upToDateWhen {return false} + outputs.upToDateWhen { + + } systemProperties = [ 'fvt.url': 'https://localhost:10443' ] @@ -117,4 +119,4 @@ test { // Resolves logging conflict with Jena loggingCapabilities { enforceLogback()// Configuration goes here -} \ No newline at end of file +} diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/build.gradle b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/build.gradle index 1a360a5c4cb..a15c5fc0a22 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/build.gradle +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/build.gradle @@ -3,14 +3,21 @@ * Copyright Contributors to the ODPi Egeria project. */ +plugins { + id 'application' + id "com.github.johnrengelman.shadow" +} + dependencies { implementation 'org.slf4j:slf4j-api' implementation 'com.fasterxml.jackson.core:jackson-databind' compileOnly 'com.fasterxml.jackson.core:jackson-annotations' implementation project(':open-metadata-implementation:repository-services:repository-services-apis') implementation project(':open-metadata-resources:open-metadata-archives:open-metadata-types') - implementation project(':open-metadata-implementation:frameworks:open-connector-framework') - implementation project(':open-metadata-implementation:frameworks:audit-log-framework') + compileOnly project(':open-metadata-implementation:frameworks:open-connector-framework') + compileOnly project(':open-metadata-implementation:frameworks:audit-log-framework') + runtimeOnly 'ch.qos.logback:logback-classic' + } description = 'Open Types Test generator' @@ -24,3 +31,5 @@ shadowJar { mainClassName = 'org.odpi.openmetadata.fvt.opentypes.generators.OmrsBeanGenerator' archiveClassifier = 'jar-with-dependencies' } + + diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/generators/OmrsBeanGenerator.java b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/generators/OmrsBeanGenerator.java index 16bcf575d80..27fc0ac10af 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/generators/OmrsBeanGenerator.java +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/generators/OmrsBeanGenerator.java @@ -673,13 +673,13 @@ private void mapOMRSToOMAS(String omrsType, Map replacementMap, attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "String"); attrValue = "\"string" + attributeNumber + "\""; - } else if (uppercaseattributeType.equals("DATE")) { - attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "java.util.Date"); - attrValue = "new java.util.Date()"; +// } else if (uppercaseattributeType.equals("DATE")) { +// attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "java.util.Date"); +// attrValue = "new java.util.Date()"; } else if (uppercaseattributeType.equals("INT")) { attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "Integer"); attrValue = String.valueOf(attributeNumber); - } else if (uppercaseattributeType.equals("LONG")) { + } else if (uppercaseattributeType.equals("LONG") || uppercaseattributeType.equals("DATE")) { attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "Long"); attrValue = String.valueOf(attributeNumber) +"L"; } else if (uppercaseattributeType.equals("FLOAT")) { @@ -746,13 +746,13 @@ private void mapOMRSToOMAS(String omrsType, Map replacementMap, attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "String"); attrValue = "\"string" + attributeNumber + "\""; - } else if (uppercaseattributeType.equals("DATE")) { - attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "java.util.Date"); - attrValue = "new java.util.Date()"; +// } else if (uppercaseattributeType.equals("DATE")) { +// attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "java.util.Date"); +// attrValue = "new java.util.Date()"; } else if (uppercaseattributeType.equals("INT")) { attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "Integer"); attrValue = String.valueOf(attributeNumber); - } else if (uppercaseattributeType.equals("LONG")) { + } else if (uppercaseattributeType.equals("LONG") || uppercaseattributeType.equals("DATE")) { attrLine = attrLine.replaceAll(GeneratorUtilities.getRegexToken("AttrType"), "Long"); attrValue = String.valueOf(attributeNumber) +"L"; } else if (uppercaseattributeType.equals("FLOAT")) { diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/model/OmrsBeanModel.java b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/model/OmrsBeanModel.java index 4f43f85ae0b..19c6cfc86bd 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/model/OmrsBeanModel.java +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/java/org/odpi/openmetadata/fvt/opentypes/model/OmrsBeanModel.java @@ -483,6 +483,10 @@ private String normalizeTypeName(String typeName) { if (typeName.equals("int")) { normalizedTypeName = "Integer"; } + //TODO do we need to get the primitive class name from the PrimitiveDefCategory javaClassName + if (typeName.equals("date")) { + normalizedTypeName = "Long"; + } return normalizedTypeName; } } diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanEntityTemplate b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanEntityTemplate index 6373edf0987..94525a403e4 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanEntityTemplate +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanEntityTemplate @@ -162,7 +162,7 @@ public class <$$uname$$> implements Serializable { * @return Set of Strings of the <$$uname$$> map property names */ public static java.util.Set getMapPropertyNames() { - return ENUM_NAMES_SET; + return MAP_NAMES_SET; } /** diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanRelationshipTemplate b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanRelationshipTemplate index 70608ec23d7..be897b0e2ef 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanRelationshipTemplate +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/OmrsBeanRelationshipTemplate @@ -171,7 +171,7 @@ public class <$$uname$$> extends OMRSLine { * @return Set of Strings of the <$$uname$$> map property names */ public static java.util.Set getMapPropertyNames() { - return ENUM_NAMES_SET; + return MAP_NAMES_SET; } /** diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/TestOmrsBeanAccessorTemplate b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/TestOmrsBeanAccessorTemplate index 2279257266f..6e00eb03c23 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/TestOmrsBeanAccessorTemplate +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator/src/main/resources/templates/TestOmrsBeanAccessorTemplate @@ -368,14 +368,16 @@ public class TestBeansToAccessOMRS { $$Enum$$> MapPropertyValue mapTypePropertyValue; + PrimitivePropertyValue primitivePropertyValueForMap; + InstanceProperties mapValues; // In the models we are generating from we only have map types, this code assumes those types. <$$Map$$ mapTypePropertyValue = new MapPropertyValue(); - PrimitivePropertyValue primitivePropertyValueForMap = new PrimitivePropertyValue(); + primitivePropertyValueForMap = new PrimitivePropertyValue(); primitivePropertyValueForMap.setPrimitiveDefCategory(PrimitiveDefCategory.OM_PRIMITIVE_TYPE_STRING); primitivePropertyValueForMap.setPrimitiveValue("test string value for map"); - InstanceProperties mapValues = new InstanceProperties(); + mapValues = new InstanceProperties(); mapValues.setProperty("a_new_property_name",primitivePropertyValueForMap); mapTypePropertyValue.setMapValues(mapValues); instanceProperties.setProperty("<$$uMapName$$>", mapTypePropertyValue); diff --git a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test/build.gradle b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test/build.gradle index ec4da3e18ba..bae674e3ef5 100644 --- a/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test/build.gradle +++ b/open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test/build.gradle @@ -3,16 +3,48 @@ * Copyright Contributors to the ODPi Egeria project. */ + dependencies { implementation 'org.slf4j:slf4j-api' implementation 'com.fasterxml.jackson.core:jackson-databind' compileOnly 'com.fasterxml.jackson.core:jackson-annotations' implementation project(':open-metadata-implementation:repository-services:repository-services-apis') implementation project(':open-metadata-resources:open-metadata-archives:open-metadata-types') + implementation project(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator') + implementation project(':open-metadata-implementation:frameworks:open-connector-framework') + implementation project(':open-metadata-implementation:frameworks:audit-log-framework') + + testImplementation 'org.mockito:mockito-core' + testImplementation 'org.junit.jupiter:junit-jupiter-api' + testImplementation 'org.junit.jupiter:junit-jupiter-params' + testImplementation 'org.junit.jupiter:junit-jupiter-engine' + testImplementation 'org.testng:testng' + +} + +description = 'Open Types Test' + +test { + useTestNG() } -description = 'Open Types Test generator' +java { + // no javadoc for this module + //withJavadocJar() +} + +task cleanGeneratedSrc(type: Delete) { + delete 'src' +} + +clean.dependsOn(cleanGeneratedSrc) + +task createTestSrc(type: Exec) { + dependsOn ':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator:shadowJar' + group = "Execution" + description = "Create test source" + workingDir '../../../..' + commandLine "java", "-jar", "${project.projectDir}/../open-types-test-generator/build/libs/open-types-test-generator-${project.version}-jar-with-dependencies.jar" +} -//java { -// withJavadocJar() -//} +compileJava.dependsOn(createTestSrc) diff --git a/settings.gradle b/settings.gradle index eacc4d37b10..a7481754935 100644 --- a/settings.gradle +++ b/settings.gradle @@ -444,12 +444,10 @@ include(':open-metadata-test:open-metadata-fvt:access-services-fvt:stewardship-a include(':open-metadata-test:open-metadata-fvt:access-services-fvt:subject-area-fvt') include(':open-metadata-test:open-metadata-fvt:access-services-fvt') include(':open-metadata-test:open-metadata-fvt:fvt-utilities') -//TODO: restore tests once ready -//include(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator') -//include(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test') -//include(':open-metadata-test:open-metadata-fvt:open-types-fvt') -//include(':open-metadata-test:open-metadata-fvt') -//include(':open-metadata-test') +if (!startParameter.projectProperties.hasProperty("skipOpenTypesFVT")) { + include(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator') + include(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test') +} project(':open-metadata-implementation:frameworks:audit-log-framework').projectDir = file('open-metadata-implementation/frameworks/audit-log-framework') project(':open-metadata-implementation:frameworks:open-connector-framework').projectDir = file('open-metadata-implementation/frameworks/open-connector-framework') project(':open-metadata-implementation:frameworks:open-discovery-framework').projectDir = file('open-metadata-implementation/frameworks/open-discovery-framework') @@ -862,9 +860,7 @@ project(':open-metadata-test:open-metadata-fvt:view-services-fvt:glossary-author project(':open-metadata-test:open-metadata-fvt:access-services-fvt').projectDir = file('open-metadata-test/open-metadata-fvt/access-services-fvt') project(':open-metadata-test:open-metadata-fvt:fvt-utilities').projectDir = file('open-metadata-test/open-metadata-fvt/fvt-utilities') project(':open-metadata-distribution:open-metadata-assemblies').projectDir = file('open-metadata-distribution/open-metadata-assemblies') - -//TODO: restore tests -//project(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator').projectDir = file('open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator') -//project(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test').projectDir = file('open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test') -//project(':open-metadata-test:open-metadata-fvt:open-types-fvt').projectDir = file('open-metadata-test/open-metadata-fvt/open-types-fvt') -//project(':open-metadata-test:open-metadata-fvt').projectDir = file('open-metadata-test/open-metadata-fvt') +if (!startParameter.projectProperties.hasProperty("skipOpenTypesFVT")) { + project(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test-generator').projectDir = file('open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test-generator') + project(':open-metadata-test:open-metadata-fvt:open-types-fvt:open-types-test').projectDir = file('open-metadata-test/open-metadata-fvt/open-types-fvt/open-types-test') +}