mirror of
				https://github.com/open-metadata/OpenMetadata.git
				synced 2025-10-31 10:39:30 +00:00 
			
		
		
		
	Added tests for entityCreated event for entities created using POST
This commit is contained in:
		
							parent
							
								
									aa83f7b1ad
								
							
						
					
					
						commit
						5810c33930
					
				| @ -20,21 +20,22 @@ import org.jdbi.v3.sqlobject.transaction.Transaction; | ||||
| import org.openmetadata.catalog.Entity.EntityList; | ||||
| import org.openmetadata.catalog.resources.events.EventResource.ChangeEventList; | ||||
| import org.openmetadata.catalog.type.ChangeEvent; | ||||
| import org.openmetadata.catalog.type.EventType; | ||||
| import org.openmetadata.catalog.util.JsonUtils; | ||||
| import org.openmetadata.catalog.util.RestUtil; | ||||
| import org.openmetadata.catalog.util.ResultList; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| 
 | ||||
| import java.io.IOException; | ||||
| import java.security.GeneralSecurityException; | ||||
| import java.sql.Timestamp; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Comparator; | ||||
| import java.util.Date; | ||||
| import java.util.List; | ||||
| 
 | ||||
| import static org.openmetadata.catalog.type.EventType.ENTITY_CREATED; | ||||
| import static org.openmetadata.catalog.type.EventType.ENTITY_DELETED; | ||||
| import static org.openmetadata.catalog.type.EventType.ENTITY_UPDATED; | ||||
| 
 | ||||
| public class ChangeEventRepository { | ||||
|   public static final Logger LOG = LoggerFactory.getLogger(ChangeEventRepository.class); | ||||
|   private final CollectionDAO dao; | ||||
| @ -45,19 +46,10 @@ public class ChangeEventRepository { | ||||
|   public ResultList<ChangeEvent> list(Date date, EntityList entityCreatedList, | ||||
|                                       EntityList entityUpdatedList, EntityList entityDeletedList) throws IOException, | ||||
|           GeneralSecurityException { | ||||
|     String dateStr = RestUtil.DATE_TIME_FORMAT.format(date); | ||||
|     Timestamp timestamp = new Timestamp(date.getTime()); | ||||
|     System.out.println("Listing from timestamp " + timestamp); | ||||
|     System.out.println("Listing from timestamp " + timestamp.getTime()); | ||||
|     System.out.println("Listing from time " + date.getTime()); | ||||
|     List<String> jsons = new ArrayList<>(); | ||||
|     jsons.addAll(dao.changeEventDAO().list(EventType.ENTITY_CREATED.value(), entityCreatedList.getList(), | ||||
|             timestamp.getTime())); | ||||
|     jsons.addAll(dao.changeEventDAO().list(EventType.ENTITY_UPDATED.value(), entityUpdatedList.getList(), | ||||
|             timestamp.getTime())); | ||||
|     jsons.addAll(dao.changeEventDAO().list(EventType.ENTITY_DELETED.value(), entityDeletedList.getList(), | ||||
|             timestamp.getTime())); | ||||
|     System.out.println("Total change events " + jsons.size()); | ||||
|     jsons.addAll(dao.changeEventDAO().list(ENTITY_CREATED.value(), entityCreatedList.getList(), date.getTime())); | ||||
|     jsons.addAll(dao.changeEventDAO().list(ENTITY_UPDATED.value(), entityUpdatedList.getList(), date.getTime())); | ||||
|     jsons.addAll(dao.changeEventDAO().list(ENTITY_DELETED.value(), entityDeletedList.getList(), date.getTime())); | ||||
|     List<ChangeEvent> changeEvents = new ArrayList<>(); | ||||
|     for (String json : jsons) { | ||||
|       changeEvents.add(JsonUtils.readValue(json, ChangeEvent.class)); | ||||
| @ -71,5 +63,4 @@ public class ChangeEventRepository { | ||||
|     dao.changeEventDAO().insert(JsonUtils.pojoToJson(changeEvent)); | ||||
|     return changeEvent; | ||||
|   } | ||||
| 
 | ||||
| } | ||||
| @ -125,7 +125,7 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|   } | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws URISyntaxException, IOException { | ||||
|     USER1 = UserResourceTest.createUser(UserResourceTest.create(test), authHeaders("test@open-metadata.org")); | ||||
|     USER_OWNER1 = new EntityReference().withId(USER1.getId()).withType("user"); | ||||
| 
 | ||||
| @ -406,7 +406,7 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_entityNonEmptyDescriptionUpdate_200(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public void put_entityNonEmptyDescriptionUpdate_200(TestInfo test) throws IOException, URISyntaxException { | ||||
|     // Create entity with non-empty description | ||||
|     Object request = createRequest(test, "description", "displayName", null); | ||||
|     T entity = createAndCheckEntity(request, adminAuthHeaders()); | ||||
| @ -422,7 +422,7 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_addDeleteFollower_200(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public void put_addDeleteFollower_200(TestInfo test) throws IOException, URISyntaxException { | ||||
|     if (!supportsFollowers) { | ||||
|       return; // Entity does not support following | ||||
|     } | ||||
| @ -447,7 +447,7 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_addDeleteInvalidFollower_200(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public void put_addDeleteInvalidFollower_200(TestInfo test) throws IOException, URISyntaxException { | ||||
|     if (!supportsFollowers) { | ||||
|       return; // Entity does not support following | ||||
|     } | ||||
| @ -604,7 +604,7 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|     return TestUtils.patch(getResource(id), patch, entityClass, authHeaders); | ||||
|   } | ||||
| 
 | ||||
|   protected final T createAndCheckEntity(Object create, Map<String, String> authHeaders) throws HttpResponseException { | ||||
|   protected final T createAndCheckEntity(Object create, Map<String, String> authHeaders) throws IOException { | ||||
|     // Validate an entity that is created has all the information set in create request | ||||
|     String updatedBy = TestUtils.getPrincipal(authHeaders); | ||||
|     T entity = createEntity(create, authHeaders); | ||||
| @ -619,6 +619,8 @@ public abstract class EntityResourceTest<T> extends CatalogApplicationTest { | ||||
|     assertEquals(0.1, entityInterface.getVersion()); // First version of the entity | ||||
|     validateCreatedEntity(getEntity, create, authHeaders); | ||||
| 
 | ||||
|     // Validate that change event was created | ||||
|     validateChangeEvents(entityInterface, EventType.ENTITY_CREATED, authHeaders); | ||||
|     return entity; | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -70,7 +70,7 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     EntityResourceTest.setup(test); | ||||
| 
 | ||||
|     CreateDashboardService createService = new CreateDashboardService().withName("superset") | ||||
| @ -100,7 +100,7 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validCharts_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validCharts_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateChart create = create(test).withService(new EntityReference(). | ||||
|             withId(SUPERSET_REFERENCE.getId()).withType(SUPERSET_REFERENCE.getType())); | ||||
| @ -113,12 +113,12 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_chartWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_chartWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_chartWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_chartWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1).withDisplayName("chart1"), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -159,7 +159,7 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_chartWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_chartWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|     EntityReference[] differentServices = {SUPERSET_REFERENCE, LOOKER_REFERENCE}; | ||||
| 
 | ||||
|     // Create chart for each service and test APIs | ||||
| @ -183,7 +183,7 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_chartWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_chartWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateChart create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SUPERSET_REFERENCE); | ||||
|     Chart chart = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -191,7 +191,7 @@ public class ChartResourceTest extends EntityResourceTest<Chart> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_chartByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_chartByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateChart create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SUPERSET_REFERENCE); | ||||
|     Chart chart = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|  | ||||
| @ -84,7 +84,7 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
| 
 | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     EntityResourceTest.setup(test); | ||||
| 
 | ||||
|     CreateDashboardService createService = new CreateDashboardService().withName("superset") | ||||
| @ -131,7 +131,7 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validDashboards_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validDashboards_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateDashboard create = create(test); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -141,17 +141,17 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_DashboardWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_DashboardWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_DashboardWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_DashboardWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1).withDisplayName("Dashboard1"), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_DashboardWithCharts_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_DashboardWithCharts_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withCharts(CHART_REFERENCES), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -198,7 +198,7 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_DashboardWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_DashboardWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|     EntityReference[] differentServices = {SUPERSET_REFERENCE, LOOKER_REFERENCE}; | ||||
| 
 | ||||
|     // Create Dashboard for each service and test APIs | ||||
| @ -256,7 +256,7 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_DashboardWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_DashboardWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateDashboard create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SUPERSET_REFERENCE).withCharts(CHART_REFERENCES); | ||||
|     Dashboard dashboard = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -264,7 +264,7 @@ public class DashboardResourceTest extends EntityResourceTest<Dashboard> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_DashboardByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_DashboardByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateDashboard create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SUPERSET_REFERENCE).withCharts(CHART_REFERENCES); | ||||
|     Dashboard dashboard = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|  | ||||
| @ -59,7 +59,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     EntityResourceTest.setup(test); | ||||
|   } | ||||
| 
 | ||||
| @ -90,7 +90,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validDatabases_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validDatabases_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateDatabase create = create(test); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -100,7 +100,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_databaseFQN_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_databaseFQN_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateDatabase create = create(test); | ||||
|     create.setService(new EntityReference().withId(SNOWFLAKE_REFERENCE.getId()).withType("databaseService")); | ||||
| @ -111,12 +111,12 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_databaseWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_databaseWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_databaseWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_databaseWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -156,7 +156,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_databaseWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_databaseWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|     EntityReference[] differentServices = {MYSQL_REFERENCE, REDSHIFT_REFERENCE, BIGQUERY_REFERENCE, | ||||
|             SNOWFLAKE_REFERENCE}; | ||||
| 
 | ||||
| @ -182,7 +182,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_databaseWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_databaseWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateDatabase create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SNOWFLAKE_REFERENCE); | ||||
|     Database database = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -190,7 +190,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_databaseByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_databaseByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateDatabase create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(SNOWFLAKE_REFERENCE); | ||||
|     Database database = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -216,7 +216,7 @@ public class DatabaseResourceTest extends EntityResourceTest<Database> { | ||||
|   } | ||||
| 
 | ||||
|   public static Database createAndCheckDatabase(CreateDatabase create, | ||||
|                                                 Map<String, String> authHeaders) throws HttpResponseException { | ||||
|                                                 Map<String, String> authHeaders) throws IOException { | ||||
|     return new DatabaseResourceTest().createAndCheckEntity(create, authHeaders); | ||||
|   } | ||||
| 
 | ||||
|  | ||||
| @ -135,13 +135,13 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     EntityResourceTest.setup(test); | ||||
|     CreateDatabase create = DatabaseResourceTest.create(test).withService(SNOWFLAKE_REFERENCE); | ||||
|     DATABASE = createAndCheckDatabase(create, adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   public static Table createTable(TestInfo test, int i) throws HttpResponseException { | ||||
|   public static Table createTable(TestInfo test, int i) throws IOException { | ||||
|     return new TableResourceTest().createEntity(test, i); | ||||
|   } | ||||
| 
 | ||||
| @ -151,7 +151,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   public static Table createAndCheckTable(CreateTable createTable, Map<String, String> adminAuthHeaders) | ||||
|           throws HttpResponseException { | ||||
|           throws IOException { | ||||
|     return new TableResourceTest().createAndCheckEntity(createTable, adminAuthHeaders); | ||||
|   } | ||||
| 
 | ||||
| @ -230,7 +230,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validTables_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validTables_200_OK(TestInfo test) throws IOException { | ||||
|     // Create table with different optional fields | ||||
|     // Optional field description | ||||
|     CreateTable create = create(test).withDescription("description"); | ||||
| @ -357,12 +357,12 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_tableWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_tableWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_tableWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_tableWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -541,7 +541,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableJoins_200(TestInfo test) throws HttpResponseException, ParseException { | ||||
|   public void put_tableJoins_200(TestInfo test) throws IOException, ParseException { | ||||
|     Table table1 = createAndCheckEntity(create(test, 1), adminAuthHeaders()); | ||||
|     Table table2 = createAndCheckEntity(create(test, 2), adminAuthHeaders()); | ||||
|     Table table3 = createAndCheckEntity(create(test, 3), adminAuthHeaders()); | ||||
| @ -632,7 +632,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableJoinsInvalidColumnName_4xx(TestInfo test) throws HttpResponseException, ParseException { | ||||
|   public void put_tableJoinsInvalidColumnName_4xx(TestInfo test) throws IOException, ParseException { | ||||
|     Table table1 = createAndCheckEntity(create(test, 1), adminAuthHeaders()); | ||||
|     Table table2 = createAndCheckEntity(create(test, 2), adminAuthHeaders()); | ||||
| 
 | ||||
| @ -687,7 +687,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableSampleData_200(TestInfo test) throws HttpResponseException { | ||||
|   public void put_tableSampleData_200(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckEntity(create(test), adminAuthHeaders()); | ||||
|     List<String> columns = Arrays.asList("c1", "c2", "c3"); | ||||
| 
 | ||||
| @ -704,7 +704,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableInvalidSampleData_4xx(TestInfo test) throws HttpResponseException { | ||||
|   public void put_tableInvalidSampleData_4xx(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckEntity(create(test), adminAuthHeaders()); | ||||
|     TableData tableData = new TableData(); | ||||
| 
 | ||||
| @ -736,7 +736,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_viewDefinition_200(TestInfo test) throws HttpResponseException { | ||||
|   public void put_viewDefinition_200(TestInfo test) throws IOException { | ||||
|     CreateTable createTable = create(test); | ||||
|     createTable.setTableType(TableType.View); | ||||
|     String query = "sales_vw\n" + | ||||
| @ -770,7 +770,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableProfile_200(TestInfo test) throws HttpResponseException { | ||||
|   public void put_tableProfile_200(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckEntity(create(test), adminAuthHeaders()); | ||||
|     ColumnProfile c1Profile = new ColumnProfile().withName("c1").withMax("100.0") | ||||
|             .withMin("10.0").withUniqueCount(100.0); | ||||
| @ -803,7 +803,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableInvalidTableProfileData_4xx(TestInfo test) throws HttpResponseException { | ||||
|   public void put_tableInvalidTableProfileData_4xx(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckEntity(create(test), adminAuthHeaders()); | ||||
| 
 | ||||
|     ColumnProfile c1Profile = new ColumnProfile().withName("c1").withMax("100").withMin("10.0") | ||||
| @ -820,7 +820,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_tableQueries_200(TestInfo test) throws HttpResponseException { | ||||
|   public void put_tableQueries_200(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckEntity(create(test), adminAuthHeaders()); | ||||
|     SQLQuery query = new SQLQuery().withQuery("select * from test;").withQueryDate("2021-09-08") | ||||
|             .withDuration(600.0); | ||||
| @ -856,14 +856,14 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_tableWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_tableWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateTable create = create(test).withDescription("description").withOwner(USER_OWNER1); | ||||
|     Table table = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|     validateGetWithDifferentFields(table, false); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_tableByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_tableByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateTable create = create(test).withDescription("description").withOwner(USER_OWNER1); | ||||
|     Table table = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|     validateGetWithDifferentFields(table, true); | ||||
| @ -871,7 +871,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
| 
 | ||||
|   @Test | ||||
|   @Order(1) // Run this test first as other tables created in other tests will interfere with listing | ||||
|   public void get_tableListWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_tableListWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateTable create = create(test, 1).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withTags(singletonList(USER_ADDRESS_TAG_LABEL)); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -1050,7 +1050,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_addDeleteLocation_200(TestInfo test) throws HttpResponseException { | ||||
|   public void put_addDeleteLocation_200(TestInfo test) throws IOException { | ||||
|     Table table = createAndCheckTable(create(test), adminAuthHeaders()); | ||||
| 
 | ||||
|     // Add location to the table | ||||
| @ -1220,7 +1220,7 @@ public class TableResourceTest extends EntityResourceTest<Table> { | ||||
|    * A method variant to be called form other tests to create a table without depending on Database, DatabaseService | ||||
|    * set up in the {@code setup()} method | ||||
|    */ | ||||
|   public Table createEntity(TestInfo test, int index) throws HttpResponseException { | ||||
|   public Table createEntity(TestInfo test, int index) throws IOException { | ||||
|     DatabaseService service = createService(DatabaseServiceResourceTest.create(test), adminAuthHeaders()); | ||||
|     EntityReference serviceRef = | ||||
|             new EntityReference().withName(service.getName()).withId(service.getId()).withType(Entity.DATABASE_SERVICE); | ||||
|  | ||||
| @ -38,6 +38,7 @@ import org.openmetadata.catalog.type.Post; | ||||
| import org.openmetadata.catalog.util.TestUtils; | ||||
| 
 | ||||
| import javax.ws.rs.client.WebTarget; | ||||
| import java.io.IOException; | ||||
| import java.net.URISyntaxException; | ||||
| import java.util.Collections; | ||||
| import java.util.List; | ||||
| @ -65,7 +66,7 @@ public class FeedResourceTest extends CatalogApplicationTest { | ||||
|   public static Thread THREAD; | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     TableResourceTest.setup(test); // Initialize TableResourceTest for using helper methods | ||||
|     CreateTable createTable = TableResourceTest.create(test); | ||||
|     TABLE = TableResourceTest.createAndCheckTable(createTable, adminAuthHeaders()); | ||||
|  | ||||
| @ -34,11 +34,10 @@ import org.openmetadata.catalog.type.EntitiesEdge; | ||||
| import org.openmetadata.catalog.type.EntityLineage; | ||||
| import org.openmetadata.catalog.type.EntityReference; | ||||
| import org.openmetadata.catalog.util.TestUtils; | ||||
| import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| 
 | ||||
| import javax.ws.rs.client.WebTarget; | ||||
| import javax.ws.rs.core.Response.Status; | ||||
| import java.io.IOException; | ||||
| import java.net.URISyntaxException; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| @ -52,12 +51,11 @@ import static org.openmetadata.catalog.util.TestUtils.adminAuthHeaders; | ||||
| 
 | ||||
| @TestMethodOrder(MethodOrderer.OrderAnnotation.class) | ||||
| public class LineageResourceTest extends CatalogApplicationTest { | ||||
|   private static final Logger LOG = LoggerFactory.getLogger(LineageResourceTest.class); | ||||
|   public static final List<Table> TABLES = new ArrayList<>(); | ||||
|   public static final int TABLE_COUNT = 10; | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     TableResourceTest.setup(test); // Initialize TableResourceTest for using helper methods | ||||
|     // Create TABLE_COUNT number of tables | ||||
|     for (int i = 0; i < TABLE_COUNT; i++) { | ||||
|  | ||||
| @ -68,7 +68,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
| 
 | ||||
| 
 | ||||
|     @BeforeAll | ||||
|     public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|     public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|         EntityResourceTest.setup(test); | ||||
|         INGESTION_CONFIG = new ConnectorConfig().withEnableDataProfiler(true).withUsername("test") | ||||
|                 .withPassword("test").withHost("localhost:9092"); | ||||
| @ -142,7 +142,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void post_validIngestion_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|     public void post_validIngestion_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|         // Create team with different optional fields | ||||
|         CreateIngestion create = create(test); | ||||
|         createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -152,17 +152,17 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void post_IngestionWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|     public void post_IngestionWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|         createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void post_IngestionWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|     public void post_IngestionWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|         createAndCheckEntity(create(test).withOwner(TEAM_OWNER1).withDisplayName("Ingestion1"), adminAuthHeaders()); | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void post_IngestionWithConfig_200_ok(TestInfo test) throws HttpResponseException { | ||||
|     public void post_IngestionWithConfig_200_ok(TestInfo test) throws IOException { | ||||
|         createAndCheckEntity(create(test).withConnectorConfig(INGESTION_CONFIG), adminAuthHeaders()); | ||||
|     } | ||||
| 
 | ||||
| @ -209,7 +209,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void post_IngestionWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|     public void post_IngestionWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|         EntityReference[] differentServices = {REDSHIFT_REFERENCE, BIGQUERY_REFERENCE}; | ||||
| 
 | ||||
|         // Create Ingestion for each service and test APIs | ||||
| @ -220,7 +220,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void put_IngestionUrlUpdate_200(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|     public void put_IngestionUrlUpdate_200(TestInfo test) throws IOException { | ||||
|         CreateIngestion request = create(test).withService(new EntityReference().withId(BIGQUERY_REFERENCE.getId()) | ||||
|                 .withType("databaseService")).withDescription("description"); | ||||
|         createAndCheckEntity(request, adminAuthHeaders()); | ||||
| @ -259,7 +259,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void get_IngestionWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|     public void get_IngestionWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|         CreateIngestion create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|                 .withService(REDSHIFT_REFERENCE).withConcurrency(10); | ||||
|         Ingestion ingestion = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -267,7 +267,7 @@ public class IngestionResourceTest extends EntityResourceTest<Ingestion> { | ||||
|     } | ||||
| 
 | ||||
|     @Test | ||||
|     public void get_IngestionByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|     public void get_IngestionByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|         CreateIngestion create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|                 .withService(BIGQUERY_REFERENCE); | ||||
|         Ingestion ingestion = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|  | ||||
| @ -74,7 +74,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
| 
 | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     EntityResourceTest.setup(test); | ||||
|     TASKS = new ArrayList<>(); | ||||
|     for (int i=0; i < 3; i++) { | ||||
| @ -163,7 +163,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validPipelines_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validPipelines_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreatePipeline create = create(test); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -173,17 +173,17 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_PipelineWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_PipelineWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_PipelineWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_PipelineWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1).withDisplayName("Pipeline1"), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_PipelineWithTasks_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_PipelineWithTasks_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withTasks(TASKS), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -223,7 +223,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_PipelineWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_PipelineWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|     EntityReference[] differentServices = {AIRFLOW_REFERENCE, PREFECT_REFERENCE}; | ||||
| 
 | ||||
|     // Create Pipeline for each service and test APIs | ||||
| @ -240,7 +240,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void put_PipelineUrlUpdate_200(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public void put_PipelineUrlUpdate_200(TestInfo test) throws IOException, URISyntaxException { | ||||
|     CreatePipeline request = create(test).withService(new EntityReference().withId(AIRFLOW_REFERENCE.getId()) | ||||
|             .withType("pipelineService")).withDescription("description"); | ||||
|     createAndCheckEntity(request, adminAuthHeaders()); | ||||
| @ -300,7 +300,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_PipelineWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_PipelineWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreatePipeline create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(AIRFLOW_REFERENCE).withTasks(TASKS); | ||||
|     Pipeline pipeline = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -308,7 +308,7 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_PipelineByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_PipelineByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreatePipeline create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(AIRFLOW_REFERENCE).withTasks(TASKS); | ||||
|     Pipeline pipeline = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|  | ||||
| @ -101,7 +101,7 @@ public class TeamResourceTest extends EntityResourceTest<Team> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validTeams_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validTeams_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateTeam create = create(test, 1); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -130,7 +130,7 @@ public class TeamResourceTest extends EntityResourceTest<Team> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_teamWithUsers_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_teamWithUsers_200_OK(TestInfo test) throws IOException { | ||||
|     // Add team to user relationships while creating a team | ||||
|     User user1 = createUser(UserResourceTest.create(test, 1), | ||||
|             authHeaders("test@open-metadata.org")); | ||||
| @ -200,7 +200,7 @@ public class TeamResourceTest extends EntityResourceTest<Team> { | ||||
|    */ | ||||
| 
 | ||||
|   @Test | ||||
|   public void delete_validTeam_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void delete_validTeam_200_OK(TestInfo test) throws IOException { | ||||
|     User user1 = createUser(UserResourceTest.create(test, 1), adminAuthHeaders()); | ||||
|     List<UUID> users = Collections.singletonList(user1.getId()); | ||||
|     CreateTeam create = create(test).withUsers(users); | ||||
| @ -218,7 +218,7 @@ public class TeamResourceTest extends EntityResourceTest<Team> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void delete_validTeam_as_non_admin_401(TestInfo test) throws HttpResponseException { | ||||
|   public void delete_validTeam_as_non_admin_401(TestInfo test) throws IOException { | ||||
|     User user1 = createUser(UserResourceTest.create(test, 1), | ||||
|             authHeaders("test@open-metadata.org")); | ||||
|     List<UUID> users = Collections.singletonList(user1.getId()); | ||||
| @ -463,6 +463,7 @@ public class TeamResourceTest extends EntityResourceTest<Team> { | ||||
|     List<EntityReference> actualUsers = Optional.ofNullable(updated.getUsers()).orElse(Collections.emptyList()); | ||||
|     actualUsers.forEach(TestUtils::validateEntityReference); | ||||
|     actualUsers.forEach(user -> user.setHref(null)); | ||||
|     expectedUsers.forEach(user -> user.setHref(null)); | ||||
| 
 | ||||
|     actualUsers.sort(EntityUtil.compareEntityReference); | ||||
|     expectedUsers.sort(EntityUtil.compareEntityReference); | ||||
|  | ||||
| @ -51,7 +51,6 @@ import java.net.URI; | ||||
| import java.util.ArrayList; | ||||
| import java.util.Arrays; | ||||
| import java.util.Collections; | ||||
| import java.util.Comparator; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Optional; | ||||
| @ -151,7 +150,7 @@ public class UserResourceTest extends EntityResourceTest<User> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validUser_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validUser_200_ok(TestInfo test) throws IOException { | ||||
|     // Create user with different optional fields | ||||
|     CreateUser create = create(test, 1); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -202,7 +201,7 @@ public class UserResourceTest extends EntityResourceTest<User> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validAdminUser_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validAdminUser_200_ok(TestInfo test) throws IOException { | ||||
|     CreateUser create = create(test, 6) | ||||
|             .withName("test1") | ||||
|             .withDisplayName("displayName") | ||||
| @ -211,7 +210,7 @@ public class UserResourceTest extends EntityResourceTest<User> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validUserWithTeams_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validUserWithTeams_200_ok(TestInfo test) throws IOException { | ||||
|     // Create user with different optional fields | ||||
|     Team team1 = createTeam(TeamResourceTest.create(test, 1), adminAuthHeaders()); | ||||
|     Team team2 = createTeam(TeamResourceTest.create(test, 2), adminAuthHeaders()); | ||||
| @ -402,7 +401,7 @@ public class UserResourceTest extends EntityResourceTest<User> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void delete_validUser_as_admin_200(TestInfo test) throws HttpResponseException { | ||||
|   public void delete_validUser_as_admin_200(TestInfo test) throws IOException { | ||||
|     Team team = createTeam(TeamResourceTest.create(test), adminAuthHeaders()); | ||||
|     List<UUID> teamIds = Collections.singletonList(team.getId()); | ||||
| 
 | ||||
| @ -582,6 +581,7 @@ public class UserResourceTest extends EntityResourceTest<User> { | ||||
|     expectedTeams.sort(EntityUtil.compareEntityReference); | ||||
|     updatedTeams.sort(EntityUtil.compareEntityReference); | ||||
|     updatedTeams.forEach(t -> t.setHref(null)); | ||||
|     expectedTeams.forEach(t -> t.setHref(null)); | ||||
|     assertEquals(expectedTeams, updatedTeams); | ||||
|     if (expected.getProfile() != null) { | ||||
|       assertEquals(expected.getProfile(), updated.getProfile()); | ||||
|  | ||||
| @ -77,7 +77,7 @@ public class TopicResourceTest extends EntityResourceTest<Topic> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_validTopics_as_admin_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void post_validTopics_as_admin_200_OK(TestInfo test) throws IOException { | ||||
|     // Create team with different optional fields | ||||
|     CreateTopic create = create(test); | ||||
|     createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -89,12 +89,12 @@ public class TopicResourceTest extends EntityResourceTest<Topic> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_topicWithUserOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_topicWithUserOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(USER_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_topicWithTeamOwner_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_topicWithTeamOwner_200_ok(TestInfo test) throws IOException { | ||||
|     createAndCheckEntity(create(test).withOwner(TEAM_OWNER1), adminAuthHeaders()); | ||||
|   } | ||||
| 
 | ||||
| @ -152,7 +152,7 @@ public class TopicResourceTest extends EntityResourceTest<Topic> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void post_topicWithDifferentService_200_ok(TestInfo test) throws HttpResponseException { | ||||
|   public void post_topicWithDifferentService_200_ok(TestInfo test) throws IOException { | ||||
|     EntityReference[] differentServices = {PULSAR_REFERENCE, KAFKA_REFERENCE}; | ||||
| 
 | ||||
|     // Create topic for each service and test APIs | ||||
| @ -177,7 +177,7 @@ public class TopicResourceTest extends EntityResourceTest<Topic> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_topicWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_topicWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateTopic create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(KAFKA_REFERENCE); | ||||
|     Topic topic = createAndCheckEntity(create, adminAuthHeaders()); | ||||
| @ -185,7 +185,7 @@ public class TopicResourceTest extends EntityResourceTest<Topic> { | ||||
|   } | ||||
| 
 | ||||
|   @Test | ||||
|   public void get_topicByNameWithDifferentFields_200_OK(TestInfo test) throws HttpResponseException { | ||||
|   public void get_topicByNameWithDifferentFields_200_OK(TestInfo test) throws IOException { | ||||
|     CreateTopic create = create(test).withDescription("description").withOwner(USER_OWNER1) | ||||
|             .withService(KAFKA_REFERENCE); | ||||
|     Topic topic = createAndCheckEntity(create, adminAuthHeaders()); | ||||
|  | ||||
| @ -41,6 +41,7 @@ import org.slf4j.Logger; | ||||
| import org.slf4j.LoggerFactory; | ||||
| 
 | ||||
| import javax.ws.rs.client.WebTarget; | ||||
| import java.io.IOException; | ||||
| import java.net.URISyntaxException; | ||||
| import java.text.ParseException; | ||||
| import java.util.ArrayList; | ||||
| @ -68,7 +69,7 @@ public class UsageResourceTest extends CatalogApplicationTest { | ||||
|   public static final int DAYS_OF_USAGE = 32; | ||||
| 
 | ||||
|   @BeforeAll | ||||
|   public static void setup(TestInfo test) throws HttpResponseException, URISyntaxException { | ||||
|   public static void setup(TestInfo test) throws IOException, URISyntaxException { | ||||
|     TableResourceTest.setup(test); // Initialize TableResourceTest for using helper methods | ||||
|     // Create TABLE_COUNT number of tables | ||||
|     for (int i = 0; i < TABLE_COUNT; i++) { | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 sureshms
						sureshms