Upgrade dependencies (#5079)

This commit is contained in:
Suresh Srinivas 2022-05-20 15:05:10 -07:00 committed by GitHub
parent 8be4507006
commit c939360d1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 34 additions and 28 deletions

View File

@ -13,12 +13,12 @@
<properties> <properties>
<dropwizard.swagger.version>2.0.12-1</dropwizard.swagger.version> <dropwizard.swagger.version>2.0.12-1</dropwizard.swagger.version>
<testng.version>7.5</testng.version>
<selenium.version>4.1.2</selenium.version> <selenium.version>4.1.2</selenium.version>
<sonar.junit.reportPaths>${project.basedir}/target/surefire-reports</sonar.junit.reportPaths> <sonar.junit.reportPaths>${project.basedir}/target/surefire-reports</sonar.junit.reportPaths>
<sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths> <sonar.coverage.jacoco.xmlReportPaths>${project.basedir}/target/site/jacoco-aggregate/jacoco.xml</sonar.coverage.jacoco.xmlReportPaths>
<sonar.tests>${project.basedir}/src/test/java</sonar.tests> <sonar.tests>${project.basedir}/src/test/java</sonar.tests>
<sonar.tests>${project.basedir}/src/test/java</sonar.tests>
<org.testcontainers.version>1.17.2</org.testcontainers.version>
</properties> </properties>
<dependencies> <dependencies>
@ -262,25 +262,25 @@
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId> <artifactId>testcontainers</artifactId>
<version>1.17.1</version> <version>${org.testcontainers.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>junit-jupiter</artifactId> <artifactId>junit-jupiter</artifactId>
<version>1.17.1</version> <version>${org.testcontainers.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>postgresql</artifactId> <artifactId>postgresql</artifactId>
<version>1.17.1</version> <version>${org.testcontainers.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.testcontainers</groupId> <groupId>org.testcontainers</groupId>
<artifactId>mysql</artifactId> <artifactId>mysql</artifactId>
<version>1.17.1</version> <version>${org.testcontainers.version}</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<!-- JSON-P: Java API for JSON Processing (JSR 374) --> <!-- JSON-P: Java API for JSON Processing (JSR 374) -->

View File

@ -27,16 +27,16 @@ import org.openmetadata.catalog.util.JsonUtils;
/** Type registry used for storing Types in OpenMetadata and customFields of entity types. */ /** Type registry used for storing Types in OpenMetadata and customFields of entity types. */
@Slf4j @Slf4j
public class TypeRegistry { public class TypeRegistry {
/** Type map used for extending entities with customFields */ /** Type map used for storing both Field Types and Entity Types */
public static final Map<String, Type> TYPES = new ConcurrentHashMap<>(); protected static final Map<String, Type> TYPES = new ConcurrentHashMap<>();
/** Custom field map (fully qualified customFieldName) to (customField) */ /** Custom field map (fully qualified customFieldName) to (customField) */
public static final Map<String, CustomField> CUSTOM_FIELDS = new ConcurrentHashMap<>(); protected static final Map<String, CustomField> CUSTOM_FIELDS = new ConcurrentHashMap<>();
/** Custom field map (fully qualified customFieldName) to (jsonSchema) */ /** Custom field map (fully qualified customFieldName) to (jsonSchema) */
public static final Map<String, JsonSchema> CUSTOM_FIELD_SCHEMAS = new ConcurrentHashMap<>(); protected static final Map<String, JsonSchema> CUSTOM_FIELD_SCHEMAS = new ConcurrentHashMap<>();
public static final TypeRegistry INSTANCE = new TypeRegistry(); private static final TypeRegistry INSTANCE = new TypeRegistry();
private TypeRegistry() { private TypeRegistry() {
/* Singleton instance */ /* Singleton instance */
@ -56,10 +56,6 @@ public class TypeRegistry {
} }
} }
public void getType(String typeName) {
TYPES.get(typeName);
}
public static void removeType(String typeName) { public static void removeType(String typeName) {
TYPES.remove(typeName); TYPES.remove(typeName);
LOG.info("Deleted type {}\n", typeName); LOG.info("Deleted type {}\n", typeName);

View File

@ -107,6 +107,9 @@ public class TypeRepository extends EntityRepository<Type> {
} }
private List<CustomField> getCustomFields(Type type) throws IOException { private List<CustomField> getCustomFields(Type type) throws IOException {
if (type.getCategory().equals(Category.Field)) {
return null; // Field types don't support custom fields
}
List<CustomField> customFields = new ArrayList<>(); List<CustomField> customFields = new ArrayList<>();
List<List<String>> results = List<List<String>> results =
daoCollection daoCollection

View File

@ -55,6 +55,7 @@ public final class JsonUtils {
public static final String FIELD_TYPE_ANNOTATION = "@om-field-type"; public static final String FIELD_TYPE_ANNOTATION = "@om-field-type";
public static final String ENTITY_TYPE_ANNOTATION = "@om-entity-type"; public static final String ENTITY_TYPE_ANNOTATION = "@om-entity-type";
public static final MediaType DEFAULT_MEDIA_TYPE = MediaType.APPLICATION_JSON_TYPE; public static final MediaType DEFAULT_MEDIA_TYPE = MediaType.APPLICATION_JSON_TYPE;
public static final String JSON_FILE_EXTENSION = ".json";
private static final ObjectMapper OBJECT_MAPPER; private static final ObjectMapper OBJECT_MAPPER;
private static final JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(VersionFlag.V7); private static final JsonSchemaFactory schemaFactory = JsonSchemaFactory.getInstance(VersionFlag.V7);
@ -270,8 +271,7 @@ public final class JsonUtils {
return Collections.emptyList(); return Collections.emptyList();
} }
String fileName = Paths.get(jsonSchemaFile).getFileName().toString(); String jsonNamespace = getSchemaName(jsonSchemaFile);
String jsonNamespace = fileName.replace(" ", "").replace(".json", "");
List<Type> types = new ArrayList<>(); List<Type> types = new ArrayList<>();
Iterator<Entry<String, JsonNode>> definitions = node.get("definitions").fields(); Iterator<Entry<String, JsonNode>> definitions = node.get("definitions").fields();
@ -308,11 +308,8 @@ public final class JsonUtils {
return null; return null;
} }
String fileName = Paths.get(jsonSchemaFile).getFileName().toString(); String entityName = getSchemaName(jsonSchemaFile);
String entityName = fileName.replace(" ", "").replace(".json", ""); String namespace = getSchemaGroup(jsonSchemaFile);
String namespaceFile = Paths.get(jsonSchemaFile).getParent().getFileName().toString();
String namespace = namespaceFile.replace(" ", "").replace(".json", "");
String description = String.valueOf(node.get("description")); String description = String.valueOf(node.get("description"));
return new Type() return new Type()
@ -324,4 +321,15 @@ public final class JsonUtils {
.withDisplayName(entityName) .withDisplayName(entityName)
.withSchema(node.toPrettyString()); .withSchema(node.toPrettyString());
} }
/** Given a json schema file name .../json/schema/entity/data/table.json - return table */
private static String getSchemaName(String path) {
String fileName = Paths.get(path).getFileName().toString();
return fileName.replace(" ", "").replace(JSON_FILE_EXTENSION, "");
}
/** Given a json schema file name .../json/schema/entity/data/table.json - return data */
private static String getSchemaGroup(String path) {
return Paths.get(path).getParent().getFileName().toString();
}
} }

View File

@ -13,7 +13,6 @@
<properties> <properties>
<dropwizard.swagger.version>2.0.12-1</dropwizard.swagger.version> <dropwizard.swagger.version>2.0.12-1</dropwizard.swagger.version>
<testng.version>7.5</testng.version>
<!-- Don't upgrade from this version as tests don't work with later version--> <!-- Don't upgrade from this version as tests don't work with later version-->
<selenium.version>4.1.1</selenium.version> <selenium.version>4.1.1</selenium.version>
<skipTests>false</skipTests> <skipTests>false</skipTests>

10
pom.xml
View File

@ -37,7 +37,7 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<mockito.version>4.5.1</mockito.version> <mockito.version>4.5.1</mockito.version>
<slf4j.version>1.7.36</slf4j.version> <slf4j.version>1.7.36</slf4j.version>
<jackson.version>2.13.2</jackson.version> <jackson.version>2.13.3</jackson.version>
<dropwizard.version>2.0.28</dropwizard.version> <dropwizard.version>2.0.28</dropwizard.version>
<dropwizard-jdbi3.version>2.0.28</dropwizard-jdbi3.version> <dropwizard-jdbi3.version>2.0.28</dropwizard-jdbi3.version>
<jersey-bom.version>2.35</jersey-bom.version> <jersey-bom.version>2.35</jersey-bom.version>
@ -75,7 +75,7 @@
<nimbus-jose-jwt.version>7.9</nimbus-jose-jwt.version> <nimbus-jose-jwt.version>7.9</nimbus-jose-jwt.version>
<spring-security-kerberos-core.version>1.0.1.RELEASE</spring-security-kerberos-core.version> <spring-security-kerberos-core.version>1.0.1.RELEASE</spring-security-kerberos-core.version>
<httpclient.version>4.5.13</httpclient.version> <httpclient.version>4.5.13</httpclient.version>
<spring.version>5.3.19</spring.version> <spring.version>5.3.20</spring.version>
<log4j.version>2.17.0</log4j.version> <log4j.version>2.17.0</log4j.version>
<org.junit.jupiter.version>5.8.2</org.junit.jupiter.version> <org.junit.jupiter.version>5.8.2</org.junit.jupiter.version>
<dropwizard-health.version>1.7.2</dropwizard-health.version> <dropwizard-health.version>1.7.2</dropwizard-health.version>
@ -94,7 +94,7 @@
<sonar.language>java</sonar.language> <sonar.language>java</sonar.language>
<sonar.skip>false</sonar.skip> <sonar.skip>false</sonar.skip>
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis> <sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
<testng.version>7.6.0</testng.version>
</properties> </properties>
<dependencyManagement> <dependencyManagement>
<dependencies> <dependencies>
@ -128,7 +128,7 @@
<dependency> <dependency>
<groupId>com.fasterxml.jackson.core</groupId> <groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId> <artifactId>jackson-databind</artifactId>
<version>2.13.2.2</version> <version>2.13.3</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>io.dropwizard</groupId> <groupId>io.dropwizard</groupId>
@ -415,7 +415,7 @@
<dependency> <dependency>
<groupId>org.apache.johnzon</groupId> <groupId>org.apache.johnzon</groupId>
<artifactId>johnzon-core</artifactId> <artifactId>johnzon-core</artifactId>
<version>1.2.17</version> <version>1.2.18</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>com.fasterxml.jackson.datatype</groupId> <groupId>com.fasterxml.jackson.datatype</groupId>