diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java index 7f4034602f1..a0d743e26db 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/jdbi3/TableRepository.java @@ -35,7 +35,6 @@ import org.openmetadata.catalog.resources.databases.TableResource; import org.openmetadata.catalog.type.Column; import org.openmetadata.catalog.type.DailyCount; import org.openmetadata.catalog.type.EntityReference; -import org.openmetadata.catalog.type.TableJoins; import org.openmetadata.catalog.type.TagLabel; import org.openmetadata.catalog.util.EntityUtil; import org.openmetadata.catalog.util.EntityUtil.Fields; diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/CatalogResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/CatalogResource.java index d135d25d88c..bc045a56f72 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/CatalogResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/CatalogResource.java @@ -17,7 +17,6 @@ package org.openmetadata.catalog.resources; import com.fasterxml.jackson.core.JsonProcessingException; -import org.openmetadata.catalog.resources.databases.TableResource.TableList; import org.openmetadata.catalog.type.CollectionDescriptor; import io.swagger.annotations.Api; import io.swagger.v3.oas.annotations.Operation; diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/config/ConfigResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/config/ConfigResource.java index 6416ce02b3c..5bdf3087375 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/config/ConfigResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/config/ConfigResource.java @@ -24,7 +24,6 @@ import io.swagger.v3.oas.annotations.responses.ApiResponse; import org.openmetadata.catalog.CatalogApplicationConfig; import org.openmetadata.catalog.resources.Collection; import org.openmetadata.catalog.security.AuthenticationConfiguration; -import org.openmetadata.catalog.type.CollectionDescriptor; import javax.ws.rs.GET; import javax.ws.rs.Path; diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/databases/TableResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/databases/TableResource.java index c4fa9e8a3a9..e47647f8f3d 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/databases/TableResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/databases/TableResource.java @@ -147,7 +147,8 @@ public class TableResource { @QueryParam("before") String before, @Parameter(description = "Returns list of tables after this curor", schema = @Schema(type = "string")) - @QueryParam("after") String after) throws IOException, ParseException, GeneralSecurityException { + @QueryParam("after") String after) + throws IOException, ParseException, GeneralSecurityException { RestUtil.validateCursors(before, after); Fields fields = new Fields(FIELD_LIST, fieldsParam); @@ -350,7 +351,7 @@ public class TableResource { @PUT @Path("/{id}/sampleData") @Operation(summary = "Add sample data", tags = "tables", - description = "Add sample data to the table." ) + description = "Add sample data to the table.") public Table addSampleData(@Context UriInfo uriInfo, @Context SecurityContext securityContext, @Parameter(description = "Id of the table", schema = @Schema(type = "string")) diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/TeamResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/TeamResource.java index a203c61aff1..76a7efb9e6b 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/TeamResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/TeamResource.java @@ -99,9 +99,9 @@ public class TeamResource { static class TeamList extends ResultList { @SuppressWarnings("unused") /* Required for tests */ - public TeamList() {} + TeamList() {} - public TeamList(List teams, int limitParam, String beforeCursor, String afterCursor) + TeamList(List teams, int limitParam, String beforeCursor, String afterCursor) throws GeneralSecurityException, UnsupportedEncodingException { super(teams, limitParam, beforeCursor, afterCursor); } diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/UserResource.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/UserResource.java index 934b2e5c2b3..e5e1417e2b9 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/UserResource.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/resources/teams/UserResource.java @@ -104,7 +104,7 @@ public class UserResource { @SuppressWarnings("unused") // Used for deserialization UserList() {} - public UserList(List users, int limitParam, String beforeCursor, String afterCursor) + UserList(List users, int limitParam, String beforeCursor, String afterCursor) throws GeneralSecurityException, UnsupportedEncodingException { super(users, limitParam, beforeCursor, afterCursor); } diff --git a/catalog-rest-service/src/main/java/org/openmetadata/catalog/security/AuthenticationConfiguration.java b/catalog-rest-service/src/main/java/org/openmetadata/catalog/security/AuthenticationConfiguration.java index e1717eb76db..c437beeb52b 100644 --- a/catalog-rest-service/src/main/java/org/openmetadata/catalog/security/AuthenticationConfiguration.java +++ b/catalog-rest-service/src/main/java/org/openmetadata/catalog/security/AuthenticationConfiguration.java @@ -35,7 +35,9 @@ public class AuthenticationConfiguration { this.provider = provider; } - public String getPublicKey() { return publicKey; } + public String getPublicKey() { + return publicKey; + } public void setPublicKey(String publicKey) { this.publicKey = publicKey; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/CatalogApplicationTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/CatalogApplicationTest.java index a32d3cb3c45..10794542cf8 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/CatalogApplicationTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/CatalogApplicationTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/EnumBackwardCompatibilityTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/EnumBackwardCompatibilityTest.java index 2b68e48cf16..650ddba6258 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/EnumBackwardCompatibilityTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/EnumBackwardCompatibilityTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog; import org.openmetadata.catalog.jdbi3.Relationship; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/CollectionRegistryTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/CollectionRegistryTest.java index d847023876e..b863d2bfe96 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/CollectionRegistryTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/CollectionRegistryTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources; import org.junit.jupiter.api.Test; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EmbeddedMySqlSupport.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EmbeddedMySqlSupport.java index a4042a45b58..906e7d138e5 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EmbeddedMySqlSupport.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/EmbeddedMySqlSupport.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources; import com.wix.mysql.EmbeddedMysql; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/DatabaseResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/DatabaseResourceTest.java index 3c0426883c0..abdc88e5373 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/DatabaseResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/DatabaseResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.databases; import com.fasterxml.jackson.core.JsonProcessingException; @@ -171,7 +187,7 @@ public class DatabaseResourceTest extends CatalogApplicationTest { @Test public void post_databaseWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { - EntityReference[] differentServices = { MYSQL_REFERENCE, REDSHIFT_REFERENCE, BIGQUERY_REFERENCE, + EntityReference[] differentServices = {MYSQL_REFERENCE, REDSHIFT_REFERENCE, BIGQUERY_REFERENCE, SNOWFLAKE_REFERENCE}; // Create database for each service and test APIs @@ -219,7 +235,8 @@ public class DatabaseResourceTest extends CatalogApplicationTest { } // List all databases - DatabaseList allDatabases = listDatabases(null, null, 1000000, null, null, adminAuthHeaders()); + DatabaseList allDatabases = listDatabases(null, null, 1000000, null, + null, adminAuthHeaders()); int totalRecords = allDatabases.getData().size(); printDatabases(allDatabases); @@ -253,7 +270,7 @@ public class DatabaseResourceTest extends CatalogApplicationTest { // We have now reached the last page - test backward scroll till the beginning pageCount = 0; - indexInAllDatabases = totalRecords - limit - forwardPage.getData().size() ; + indexInAllDatabases = totalRecords - limit - forwardPage.getData().size(); do { LOG.info("Limit {} backward scrollCount {} beforeCursor {}", limit, pageCount, before); forwardPage = listDatabases(null, null, limit, before, null, adminAuthHeaders()); diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java index 6a17d9b05fd..0ddeaf1e513 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/databases/TableResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.databases; import com.fasterxml.jackson.core.JsonProcessingException; @@ -431,7 +447,8 @@ public class TableResourceTest extends CatalogApplicationTest { validateColumnJoins(expectedJoins3, table3.getJoins()); // Report again for the previous day and make sure aggregate counts are correct - table1Joins = new TableJoins().withDayCount(1).withStartDate(RestUtil.today(-1)).withColumnJoins(reportedJoins); + table1Joins = new TableJoins().withDayCount(1).withStartDate(RestUtil.today(-1)) + .withColumnJoins(reportedJoins); putJoins(table1.getId(), table1Joins, adminAuthHeaders()); table1 = getTable(table1.getId(), "joins", adminAuthHeaders()); } @@ -542,7 +559,8 @@ public class TableResourceTest extends CatalogApplicationTest { tableData.withColumns(columns).withRows(rows); exception = assertThrows(HttpResponseException.class, () -> putSampleData(table.getId(), tableData, adminAuthHeaders())); - TestUtils.assertResponseContains(exception, BAD_REQUEST, "Number of columns is 3 but row has 4 sample values"); + TestUtils.assertResponseContains(exception, BAD_REQUEST, "Number of columns is 3 but row " + + "has 4 sample values"); // Send sample data that has less samples than the number of columns columns = Arrays.asList("c1", "c2", "c3"); // Invalid column name @@ -550,7 +568,8 @@ public class TableResourceTest extends CatalogApplicationTest { tableData.withColumns(columns).withRows(rows); exception = assertThrows(HttpResponseException.class, () -> putSampleData(table.getId(), tableData, adminAuthHeaders())); - TestUtils.assertResponseContains(exception, BAD_REQUEST, "Number of columns is 3 but row has 2 sample values"); + TestUtils.assertResponseContains(exception, BAD_REQUEST, "Number of columns is 3 but row h" + + "as 2 sample values"); } @Test @@ -613,7 +632,7 @@ public class TableResourceTest extends CatalogApplicationTest { // GET .../tables?fields=usageSummary,owner,service fields = "usageSummary,owner,database"; - tableList = listTables( fields, null, adminAuthHeaders()); + tableList = listTables(fields, null, adminAuthHeaders()); assertEquals(2, tableList.getData().size()); assertFields(tableList.getData(), fields); for (Table table : tableList.getData()) { @@ -668,7 +687,8 @@ public class TableResourceTest extends CatalogApplicationTest { } // List all tables and use it for checking pagination - TableList allTables = listTables(null, null, 1000000, null, null, adminAuthHeaders()); + TableList allTables = listTables(null, null, 1000000, null, null, + adminAuthHeaders()); int totalRecords = allTables.getData().size(); printTables(allTables); @@ -703,7 +723,7 @@ public class TableResourceTest extends CatalogApplicationTest { // We have now reached the last page - test backward scroll till the beginning pageCount = 0; - indexInAllTables = totalRecords - limit - forwardPage.getData().size() ; + indexInAllTables = totalRecords - limit - forwardPage.getData().size(); do { LOG.info("Limit {} backward scrollCount {} beforeCursor {}", limit, pageCount, before); forwardPage = listTables(null, null, limit, before, null, adminAuthHeaders()); @@ -763,12 +783,13 @@ public class TableResourceTest extends CatalogApplicationTest { tableConstraints = List.of(new TableConstraint().withConstraintType(ConstraintType.UNIQUE) .withColumns(List.of(COLUMNS.get(1).getName()))); tableTags = singletonList(USER_BANK_ACCOUNT_TAG_LABEL); - table = patchTableAttributesAndCheck(table, "description1", USER_OWNER1, TableType.External, tableConstraints, - tableTags, adminAuthHeaders()); + table = patchTableAttributesAndCheck(table, "description1", USER_OWNER1, TableType.External, + tableConstraints, tableTags, adminAuthHeaders()); table.setOwner(USER_OWNER1); // Get rid of href and name returned in the response for owner // Remove description, tier, owner, tableType, tableConstraints - patchTableAttributesAndCheck(table, null, null, null, null, null, adminAuthHeaders()); + patchTableAttributesAndCheck(table, null, null, null, null, null, + adminAuthHeaders()); } @Test @@ -866,7 +887,8 @@ public class TableResourceTest extends CatalogApplicationTest { // Validate information returned in patch response has the updates Table updatedTable = patchTable(tableJson, table, authHeaders); - validateTable(updatedTable, table.getDescription(), owner, null, tableType, tableConstraints, tags); + validateTable(updatedTable, table.getDescription(), owner, null, tableType, + tableConstraints, tags); // GET the table and Validate information returned Table getTable = getTable(table.getId(), "owner,tableConstraints,tags", authHeaders); @@ -904,10 +926,14 @@ public class TableResourceTest extends CatalogApplicationTest { void assertFields(Table table, String fieldsParam) { Fields fields = new Fields(TableResource.FIELD_LIST, fieldsParam); - if (fields.contains("usageSummary")) {assertNotNull(table.getUsageSummary());} else { + if (fields.contains("usageSummary")) { + assertNotNull(table.getUsageSummary()); + } else { assertNull(table.getUsageSummary()); } - if (fields.contains("owner")) {assertNotNull(table.getOwner());} else { + if (fields.contains("owner")) { + assertNotNull(table.getOwner()); + } else { assertNull(table.getOwner()); } if (fields.contains("columns")) { @@ -920,10 +946,14 @@ public class TableResourceTest extends CatalogApplicationTest { } else { assertNull(table.getColumns()); } - if (fields.contains("tableConstraints")) {assertNotNull(table.getTableConstraints());} else { + if (fields.contains("tableConstraints")) { + assertNotNull(table.getTableConstraints()); + } else { assertNull(table.getTableConstraints()); } - if (fields.contains("database")) {assertNotNull(table.getDatabase());} else { + if (fields.contains("database")) { + assertNotNull(table.getDatabase()); + } else { assertNull(table.getDatabase()); } if (fields.contains("tags")) { @@ -956,7 +986,8 @@ public class TableResourceTest extends CatalogApplicationTest { assertEquals(table.getDatabase().getName(), DATABASE.getName()); } - private static void validateTags(List expectedList, List actualList) throws HttpResponseException { + private static void validateTags(List expectedList, List actualList) + throws HttpResponseException { if (expectedList == null) { return; } @@ -1083,7 +1114,8 @@ public class TableResourceTest extends CatalogApplicationTest { public static Table updateTable(CreateTable create, Status status, Map authHeaders) throws HttpResponseException { - return TestUtils.put(CatalogApplicationTest.getResource("tables"), create, Table.class, status, authHeaders); + return TestUtils.put(CatalogApplicationTest.getResource("tables"), create, Table.class, + status, authHeaders); } public static void putJoins(UUID tableId, TableJoins joins, Map authHeaders) @@ -1110,7 +1142,8 @@ public class TableResourceTest extends CatalogApplicationTest { Map authHeaders) throws JsonProcessingException, HttpResponseException { String updateTableJson = JsonUtils.pojoToJson(updatedTable); JsonPatch patch = JsonSchemaUtil.getJsonPatch(originalJson, updateTableJson); - return TestUtils.patch(CatalogApplicationTest.getResource("tables/" + tableId), patch, Table.class, authHeaders); + return TestUtils.patch(CatalogApplicationTest.getResource("tables/" + tableId), + patch, Table.class, authHeaders); } private Table patchTable(String originalJson, Table updatedTable, diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/FeedResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/FeedResourceTest.java index 93b12781735..313b5e0ec6a 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/FeedResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/FeedResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.feeds; import org.apache.http.client.HttpResponseException; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/MessageParserTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/MessageParserTest.java index b5bb47195ce..906512994dc 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/MessageParserTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/feeds/MessageParserTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.feeds; import org.junit.jupiter.api.Test; diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java index 055016f2fce..501c9312c85 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/services/DatabaseServiceResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.services; import org.apache.http.client.HttpResponseException; @@ -76,7 +92,8 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> createAndCheckService(create(test, 1).withDescription(null), authHeaders)); - TestUtils.assertResponse(exception, FORBIDDEN, "Principal: CatalogPrincipal{name='test'} is not admin"); + TestUtils.assertResponse(exception, FORBIDDEN, + "Principal: CatalogPrincipal{name='test'} is not admin"); } @Test @@ -104,17 +121,20 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { create.withIngestionSchedule(schedule.withRepeatFrequency("P1Y")); exception = assertThrows(HttpResponseException.class, () -> createService(create, adminAuthHeaders())); TestUtils.assertResponse(exception, BAD_REQUEST, - "Ingestion repeatFrequency can only contain Days, Hours, and Minutes - example P{d}DT{h}H{m}M"); + "Ingestion repeatFrequency can only contain Days, Hours, " + + "and Minutes - example P{d}DT{h}H{m}M"); create.withIngestionSchedule(schedule.withRepeatFrequency("P1M")); exception = assertThrows(HttpResponseException.class, () -> createService(create, adminAuthHeaders())); TestUtils.assertResponse(exception, BAD_REQUEST, - "Ingestion repeatFrequency can only contain Days, Hours, and Minutes - example P{d}DT{h}H{m}M"); + "Ingestion repeatFrequency can only contain Days, Hours, " + + "and Minutes - example P{d}DT{h}H{m}M"); create.withIngestionSchedule(schedule.withRepeatFrequency("PT1S")); exception = assertThrows(HttpResponseException.class, () -> createService(create, adminAuthHeaders())); TestUtils.assertResponse(exception, BAD_REQUEST, - "Ingestion repeatFrequency can only contain Days, Hours, and Minutes - example P{d}DT{h}H{m}M"); + "Ingestion repeatFrequency can only contain Days, Hours, " + + "and Minutes - example P{d}DT{h}H{m}M"); } @Test @@ -143,7 +163,8 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { create.withIngestionSchedule(schedule.withRepeatFrequency("PT59M")); // Repeat every 50 minutes 59 seconds exception = assertThrows(HttpResponseException.class, () -> createService(create, adminAuthHeaders())); - TestUtils.assertResponse(exception, BAD_REQUEST, "Ingestion repeatFrequency is too short and must be more than 60 minutes"); + TestUtils.assertResponse(exception, BAD_REQUEST, "Ingestion repeatFrequency is too short and must " + + "be more than 60 minutes"); } @Test @@ -152,12 +173,14 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { UpdateDatabaseService update = new UpdateDatabaseService().withDescription("description1"); HttpResponseException exception = assertThrows(HttpResponseException.class, () -> updateDatabaseService(TestUtils.NON_EXISTENT_ENTITY.toString(), update, OK, adminAuthHeaders())); - TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound("DatabaseService", TestUtils.NON_EXISTENT_ENTITY)); + TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound("DatabaseService", + TestUtils.NON_EXISTENT_ENTITY)); } @Test public void put_updateDatabaseService_as_admin_2xx(TestInfo test) throws HttpResponseException { - DatabaseService dbService = createAndCheckService(create(test).withDescription(null).withIngestionSchedule(null), adminAuthHeaders()); + DatabaseService dbService = createAndCheckService(create(test).withDescription(null).withIngestionSchedule(null), + adminAuthHeaders()); String id = dbService.getId().toString(); String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); @@ -187,20 +210,22 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> updateAndCheckService(id, update, OK, authHeaders("test@open-metadata.org"))); - TestUtils.assertResponse(exception, FORBIDDEN, "Principal: CatalogPrincipal{name='test'} is not admin"); + TestUtils.assertResponse(exception, FORBIDDEN, "Principal: CatalogPrincipal{name='test'} " + + "is not admin"); } @Test public void get_nonExistentTeam_404_notFound() { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> getService(TestUtils.NON_EXISTENT_ENTITY, adminAuthHeaders())); - TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, TestUtils.NON_EXISTENT_ENTITY)); + TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, + TestUtils.NON_EXISTENT_ENTITY)); } @Test public void get_nonExistentTeamByName_404_notFound() { HttpResponseException exception = assertThrows(HttpResponseException.class, () - -> getServiceByName("invalidName",null, adminAuthHeaders())); + -> getServiceByName("invalidName", null, adminAuthHeaders())); TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, "invalidName")); } @@ -208,15 +233,18 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { public static DatabaseService createAndCheckService(CreateDatabaseService create, Map authHeaders) throws HttpResponseException { DatabaseService service = createService(create, authHeaders); - validateService(service, create.getName(), create.getDescription(), create.getJdbc(), create.getIngestionSchedule()); + validateService(service, create.getName(), create.getDescription(), create.getJdbc(), + create.getIngestionSchedule()); // GET the newly created service and validate DatabaseService getService = getService(service.getId(), authHeaders); - validateService(getService, create.getName(), create.getDescription(), create.getJdbc(), create.getIngestionSchedule()); + validateService(getService, create.getName(), create.getDescription(), create.getJdbc(), + create.getIngestionSchedule()); // GET the newly created service by name and validate getService = getServiceByName(service.getName(), null, authHeaders); - validateService(getService, create.getName(), create.getDescription(), create.getJdbc(), create.getIngestionSchedule()); + validateService(getService, create.getName(), create.getDescription(), create.getJdbc(), + create.getIngestionSchedule()); return service; } @@ -246,13 +274,15 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { return getService(id, null, authHeaders); } - public static DatabaseService getService(UUID id, String fields, Map authHeaders) throws HttpResponseException { + public static DatabaseService getService(UUID id, String fields, Map authHeaders) + throws HttpResponseException { WebTarget target = CatalogApplicationTest.getResource("services/databaseServices/" + id); target = fields != null ? target.queryParam("fields", fields) : target; return TestUtils.get(target, DatabaseService.class, authHeaders); } - public static DatabaseService getServiceByName(String name, String fields, Map authHeaders) throws HttpResponseException { + public static DatabaseService getServiceByName(String name, String fields, Map authHeaders) + throws HttpResponseException { WebTarget target = CatalogApplicationTest.getResource("services/databaseServices/name/" + name); target = fields != null ? target.queryParam("fields", fields) : target; return TestUtils.get(target, DatabaseService.class, authHeaders); @@ -278,15 +308,18 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { Map authHeaders = adminAuthHeaders(); DatabaseService databaseService = createService(create(test), authHeaders); HttpResponseException exception = assertThrows(HttpResponseException.class, () -> - deleteService(databaseService.getId(), databaseService.getName(), authHeaders("test@open-metadata.org"))); - TestUtils.assertResponse(exception, FORBIDDEN, "Principal: CatalogPrincipal{name='test'} is not admin"); + deleteService(databaseService.getId(), databaseService.getName(), + authHeaders("test@open-metadata.org"))); + TestUtils.assertResponse(exception, FORBIDDEN, + "Principal: CatalogPrincipal{name='test'} is not admin"); } @Test public void delete_notExistentDatabaseService() { HttpResponseException exception = assertThrows(HttpResponseException.class, () -> getService(TestUtils.NON_EXISTENT_ENTITY, adminAuthHeaders())); - TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, TestUtils.NON_EXISTENT_ENTITY)); + TestUtils.assertResponse(exception, NOT_FOUND, + CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, TestUtils.NON_EXISTENT_ENTITY)); } private void deleteService(UUID id, String name, Map authHeaders) throws HttpResponseException { @@ -298,13 +331,15 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { // Ensure deleted service does not exist when getting by name exception = assertThrows(HttpResponseException.class, () -> getServiceByName(name, null, authHeaders)); - TestUtils.assertResponse(exception, NOT_FOUND, CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, name)); + TestUtils.assertResponse(exception, NOT_FOUND, + CatalogExceptionMessage.entityNotFound(Entity.DATABASE_SERVICE, name)); } public static CreateDatabaseService create(TestInfo test) { String startDate = RestUtil.DATE_TIME_FORMAT.format(new Date()); return new CreateDatabaseService().withName(getName(test)).withServiceType(DatabaseServiceType.Snowflake) - .withJdbc(TestUtils.JDBC_INFO).withIngestionSchedule(new Schedule().withStartDate(startDate).withRepeatFrequency("P1D")); + .withJdbc(TestUtils.JDBC_INFO) + .withIngestionSchedule(new Schedule().withStartDate(startDate).withRepeatFrequency("P1D")); } private static CreateDatabaseService create(TestInfo test, int index) { @@ -330,7 +365,8 @@ public class DatabaseServiceResourceTest extends CatalogApplicationTest { } public static DatabaseService updateDatabaseService(String id, UpdateDatabaseService updated, - Status status, Map authHeaders) throws HttpResponseException { + Status status, Map authHeaders) + throws HttpResponseException { return TestUtils.put(CatalogApplicationTest.getResource("services/databaseServices/" + id), updated, DatabaseService.class, status, authHeaders); } diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/tags/TagResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/tags/TagResourceTest.java index 3d8741987fc..07a6d060a9d 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/tags/TagResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/tags/TagResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.tags; import com.fasterxml.jackson.core.JsonProcessingException; @@ -266,7 +282,8 @@ public class TagResourceTest extends CatalogApplicationTest { // Secondar tag with missing description exception = assertThrows(HttpResponseException.class, () - -> updateSecondaryTag("User", "Address", "Secondary", create, adminAuthHeaders())); + -> updateSecondaryTag("User", "Address", "Secondary", + create, adminAuthHeaders())); TestUtils.assertResponseContains(exception, BAD_REQUEST, "description must not be null"); // Long primary tag name @@ -277,7 +294,8 @@ public class TagResourceTest extends CatalogApplicationTest { // Long secondary tag name exception = assertThrows(HttpResponseException.class, () - -> updateSecondaryTag("User", "Address", "Secondary", create, adminAuthHeaders())); + -> updateSecondaryTag("User", "Address", "Secondary", + create, adminAuthHeaders())); TestUtils.assertResponseContains(exception, BAD_REQUEST, "name size must be between 2 and 25"); } diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/TeamResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/TeamResourceTest.java index 8d3bd6f3914..f41e6bff6a8 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/TeamResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/TeamResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.teams; import com.fasterxml.jackson.core.JsonProcessingException; @@ -245,7 +261,7 @@ public class TeamResourceTest extends CatalogApplicationTest { // We have now reached the last page - test backward scroll till the beginning pageCount = 0; - indexInAllTables = totalRecords - limit - forwardPage.getData().size() ; + indexInAllTables = totalRecords - limit - forwardPage.getData().size(); do { LOG.info("Limit {} backward scrollCount {} beforeCursor {}", limit, pageCount, before); forwardPage = listTeams(null, limit, before, null, adminAuthHeaders()); @@ -402,7 +418,8 @@ public class TeamResourceTest extends CatalogApplicationTest { // // User patch to add team to user relationship to an invalid user // List users = Collections.singletonList(UUID.randomUUID() /* invalid userId */); // UpdateTeam update = new UpdateTeam().withUsers(users); -// HttpResponseException exception = assertThrows(HttpResponseException.class, () -> updateTeam(team.getId(), update)); +// HttpResponseException exception = assertThrows(HttpResponseException.class, () -> +// updateTeam(team.getId(), update)); // assertEquals(Response.Status.NOT_FOUND.getStatusCode(), exception.getStatusCode()); // } @@ -499,7 +516,8 @@ public class TeamResourceTest extends CatalogApplicationTest { throws JsonProcessingException, HttpResponseException { String updatedJson = JsonUtils.pojoToJson(updated); JsonPatch patch = JsonSchemaUtil.getJsonPatch(originalJson, updatedJson); - return TestUtils.patch(CatalogApplicationTest.getResource("teams/" + teamId), patch, Team.class, authHeaders); + return TestUtils.patch(CatalogApplicationTest.getResource("teams/" + teamId), patch, + Team.class, authHeaders); } private Team patchTeam(String originalJson, Team updated, Map authHeaders) throws JsonProcessingException, HttpResponseException { diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/UserResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/UserResourceTest.java index 20ace3dfe64..6e1bd8d4652 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/UserResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/teams/UserResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.teams; import com.fasterxml.jackson.core.JsonProcessingException; @@ -295,7 +311,7 @@ public class UserResourceTest extends CatalogApplicationTest { // We have now reached the last page - test backward scroll till the beginning pageCount = 0; - indexInAllTables = totalRecords - limit - forwardPage.getData().size() ; + indexInAllTables = totalRecords - limit - forwardPage.getData().size(); do { LOG.info("Limit {} backward scrollCount {} beforeCursor {}", limit, pageCount, before); forwardPage = listUsers(null, limit, before, null, adminAuthHeaders()); @@ -347,7 +363,8 @@ public class UserResourceTest extends CatalogApplicationTest { } @Test - public void patch_userNameChange_as_same_user_200_ok(TestInfo test) throws HttpResponseException, JsonProcessingException { + public void patch_userNameChange_as_same_user_200_ok(TestInfo test) throws HttpResponseException, + JsonProcessingException { // Ensure user name can't be changed using patch User user = createUser(create(test, 6).withName("test").withDisplayName("displayName") .withEmail("test@email.com"), authHeaders("test@email.com")); @@ -475,7 +492,7 @@ public class UserResourceTest extends CatalogApplicationTest { return TestUtils.patch(CatalogApplicationTest.getResource("users/" + userId), patch, User.class, headers); } - private User patchUser(String originalJson, User updated,Map headers) + private User patchUser(String originalJson, User updated, Map headers) throws JsonProcessingException, HttpResponseException { return patchUser(updated.getId(), originalJson, updated, headers); } diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/usage/UsageResourceTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/usage/UsageResourceTest.java index 5bebd1e2caa..07202e9f584 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/usage/UsageResourceTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/resources/usage/UsageResourceTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.resources.usage; import org.apache.http.client.HttpResponseException; @@ -131,7 +147,7 @@ public class UsageResourceTest extends CatalogApplicationTest { // Report usage int weeklyCount = Math.min(day + 1, 7) * usageCount; // Expected cumulative weekly count - int monthlyCount = Math.min(day + 1, 30 ) * usageCount; // Expected cumulative monthly count + int monthlyCount = Math.min(day + 1, 30) * usageCount; // Expected cumulative monthly count reportUsageAndCheck(TABLE, id, usageReport, weeklyCount, monthlyCount, adminAuthHeaders()); // Database has cumulative count of all the table usage diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/RestUtilTest.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/RestUtilTest.java index 599141e76df..4141710a716 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/RestUtilTest.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/RestUtilTest.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.util; import com.fasterxml.jackson.annotation.JsonProperty; @@ -39,6 +55,7 @@ public class RestUtilTest { List relationships = RestUtil.getRelationships(entity.getClass()); List expectedRelationships = Arrays.asList("relationship1", "relationship2"); assertEquals(expectedRelationships.size(), relationships.size()); - assertTrue(relationships.containsAll(expectedRelationships) && expectedRelationships.containsAll(relationships)); + assertTrue(relationships.containsAll(expectedRelationships) && + expectedRelationships.containsAll(relationships)); } } diff --git a/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/TestUtils.java b/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/TestUtils.java index a9de73513a1..d8b2fa065bf 100644 --- a/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/TestUtils.java +++ b/catalog-rest-service/src/test/java/org/openmetadata/catalog/util/TestUtils.java @@ -1,3 +1,19 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package org.openmetadata.catalog.util; import org.openmetadata.catalog.security.CatalogOpenIdAuthorizationRequestFilter; @@ -28,7 +44,7 @@ import static org.junit.jupiter.api.Assertions.assertFalse; import static org.junit.jupiter.api.Assertions.assertNotNull; import static org.junit.jupiter.api.Assertions.assertTrue; -public class TestUtils { +public final class TestUtils { // Entity name length allowed is 64 characters. This is a 65 char length invalid entity name public static final String LONG_ENTITY_NAME = "012345678901234567890123456789012345678901234567890123456789012345"; public static final UUID NON_EXISTENT_ENTITY = UUID.randomUUID(); @@ -42,6 +58,9 @@ public class TestUtils { } } + private TestUtils() { + } + public static Builder addHeaders(WebTarget target, Map headers) { if (headers != null) { return target.request().header(CatalogOpenIdAuthorizationRequestFilter.X_AUTH_PARAMS_EMAIL_HEADER, @@ -118,13 +137,16 @@ public class TestUtils { public static void put(WebTarget target, K request, Status expectedStatus, Map headers) throws HttpResponseException { - Response response = addHeaders(target, headers).method("PUT", Entity.entity(request, MediaType.APPLICATION_JSON)); + Response response = addHeaders(target, headers).method("PUT", Entity.entity(request, + MediaType.APPLICATION_JSON)); readResponse(response, expectedStatus.getStatusCode()); } - public static T put(WebTarget target, K request, Class clz, Status expectedStatus, Map headers) + public static T put(WebTarget target, K request, Class clz, Status expectedStatus, + Map headers) throws HttpResponseException { - Response response = addHeaders(target, headers).method("PUT", Entity.entity(request, MediaType.APPLICATION_JSON)); + Response response = addHeaders(target, headers).method("PUT", Entity.entity(request, + MediaType.APPLICATION_JSON)); return readResponse(response, clz, expectedStatus.getStatusCode()); } diff --git a/checkstyle/checkstyle.xml b/checkstyle/checkstyle.xml index 6422b7e3d09..ba7ab25199f 100644 --- a/checkstyle/checkstyle.xml +++ b/checkstyle/checkstyle.xml @@ -15,10 +15,9 @@ ~ See the License for the specific language governing permissions and ~ limitations under the License. --> - + "-//Checkstyle//DTD Checkstyle Configuration 1.3//EN" + "https://checkstyle.org/dtds/configuration_1_3.dtd"> + + + + - @@ -191,7 +193,7 @@ - + diff --git a/common/src/main/java/org/openmetadata/common/utils/CipherText.java b/common/src/main/java/org/openmetadata/common/utils/CipherText.java index 9c7034a25e1..fee2694fe4c 100644 --- a/common/src/main/java/org/openmetadata/common/utils/CipherText.java +++ b/common/src/main/java/org/openmetadata/common/utils/CipherText.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; diff --git a/common/src/main/java/org/openmetadata/common/utils/CommonUtil.java b/common/src/main/java/org/openmetadata/common/utils/CommonUtil.java index 5220835cb3d..e21ebb77507 100644 --- a/common/src/main/java/org/openmetadata/common/utils/CommonUtil.java +++ b/common/src/main/java/org/openmetadata/common/utils/CommonUtil.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; diff --git a/common/src/main/java/org/openmetadata/common/utils/JsonSchemaUtil.java b/common/src/main/java/org/openmetadata/common/utils/JsonSchemaUtil.java index 70270ad32ab..32abf5be51f 100644 --- a/common/src/main/java/org/openmetadata/common/utils/JsonSchemaUtil.java +++ b/common/src/main/java/org/openmetadata/common/utils/JsonSchemaUtil.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; diff --git a/common/src/test/java/org/openmetadata/common/module/StartableModule.java b/common/src/test/java/org/openmetadata/common/module/StartableModule.java index a9c2e45b756..8783c12cc57 100644 --- a/common/src/test/java/org/openmetadata/common/module/StartableModule.java +++ b/common/src/test/java/org/openmetadata/common/module/StartableModule.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.module; diff --git a/common/src/test/java/org/openmetadata/common/utils/CipherTextTest.java b/common/src/test/java/org/openmetadata/common/utils/CipherTextTest.java index b0ef87f7a67..7850e1329b6 100644 --- a/common/src/test/java/org/openmetadata/common/utils/CipherTextTest.java +++ b/common/src/test/java/org/openmetadata/common/utils/CipherTextTest.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; diff --git a/common/src/test/java/org/openmetadata/common/utils/JsonDiffTest.java b/common/src/test/java/org/openmetadata/common/utils/JsonDiffTest.java index 11568d377c1..359a24ab52a 100644 --- a/common/src/test/java/org/openmetadata/common/utils/JsonDiffTest.java +++ b/common/src/test/java/org/openmetadata/common/utils/JsonDiffTest.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; diff --git a/common/src/test/java/org/openmetadata/common/utils/JsonSchemaTest.java b/common/src/test/java/org/openmetadata/common/utils/JsonSchemaTest.java index 51ef84bfa5e..34f1c72413e 100644 --- a/common/src/test/java/org/openmetadata/common/utils/JsonSchemaTest.java +++ b/common/src/test/java/org/openmetadata/common/utils/JsonSchemaTest.java @@ -1,18 +1,17 @@ /* - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed with - * this work for additional information regarding copyright ownership. - * The ASF licenses this file to You under the Apache License, Version 2.0 - * (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.openmetadata.common.utils; @@ -53,7 +52,8 @@ public class JsonSchemaTest { urnFactory = JsonSchemaUtil.getUrnFactory(); } - private java.util.Set validate(InputStream in, String jsonPayload) throws IOException { + private java.util.Set validate(InputStream in, String jsonPayload) + throws IOException { System.out.println("Validating " + jsonPayload); Set errors = JsonSchemaUtil.validate(in, jsonPayload, urnFactory); System.out.println("Errors " + errors); diff --git a/pom.xml b/pom.xml index 8c926f3e37a..7bd118b1814 100644 --- a/pom.xml +++ b/pom.xml @@ -435,6 +435,7 @@ 3.1.2 ./checkstyle/checkstyle.xml + true