Skip to content

Commit

Permalink
Merge pull request #7327 from planetf1/issue7324
Browse files Browse the repository at this point in the history
#7324 Ensure Open Types tests are run (gradle)
  • Loading branch information
planetf1 authored Mar 7, 2023
2 parents eab9551 + 73f6c1e commit 5789589
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 33 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-v4.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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'
]
Expand All @@ -117,4 +119,4 @@ test {
// Resolves logging conflict with Jena
loggingCapabilities {
enforceLogback()// Configuration goes here
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -24,3 +31,5 @@ shadowJar {
mainClassName = 'org.odpi.openmetadata.fvt.opentypes.generators.OmrsBeanGenerator'
archiveClassifier = 'jar-with-dependencies'
}


Original file line number Diff line number Diff line change
Expand Up @@ -673,13 +673,13 @@ private void mapOMRSToOMAS(String omrsType, Map<String, String> 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")) {
Expand Down Expand Up @@ -746,13 +746,13 @@ private void mapOMRSToOMAS(String omrsType, Map<String, String> 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")) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public class <$$uname$$> implements Serializable {
* @return Set of Strings of the <$$uname$$> map property names
*/
public static java.util.Set<String> getMapPropertyNames() {
return ENUM_NAMES_SET;
return MAP_NAMES_SET;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ public class <$$uname$$> extends OMRSLine {
* @return Set of Strings of the <$$uname$$> map property names
*/
public static java.util.Set<String> getMapPropertyNames() {
return ENUM_NAMES_SET;
return MAP_NAMES_SET;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<String,String> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
20 changes: 8 additions & 12 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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')
}

0 comments on commit 5789589

Please sign in to comment.