Add table entity name pattern (#9970)

* Added ()0 to table entityName for oracle metadata

* move # character to columnName pattern

* Test newly allowed characters in table name and columns

---------

Co-authored-by: Teddy Crepineau <teddy.crepineau@gmail.com>
Co-authored-by: sureshms <srini30005@gmail.com>
This commit is contained in:
Sriharsha Chintalapani 2023-01-27 18:50:35 -08:00 committed by GitHub
parent 813d2c4fe6
commit 8b45b639fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 92 additions and 101 deletions

View File

@ -181,14 +181,14 @@ public abstract class EntityResourceTest<T extends EntityInterface, K extends Cr
protected boolean supportsSoftDelete;
protected boolean supportsFieldsQueryParam = true;
protected boolean supportsEmptyDescription = true;
protected String supportedNameCharacters = ".' _"; // Special characters supported in the entity name
protected String supportedNameCharacters = "_'-.&"; // Special characters supported in the entity name
protected final boolean supportsCustomExtension;
public static final String DATA_STEWARD_ROLE_NAME = "DataSteward";
public static final String DATA_CONSUMER_ROLE_NAME = "DataConsumer";
public static final String ENTITY_LINK_MATCH_ERROR =
"[entityLink must match \"^<#E::\\w+::[\\w'\\- .&/:+\"\\\\]+>$\"]";
"[entityLink must match \"^<#E::\\w+::[\\w'\\- .&/:+\"\\\\()$#]+>$\"]";
// Users
public static User USER1;
@ -281,7 +281,7 @@ public abstract class EntityResourceTest<T extends EntityInterface, K extends Cr
public static KpiTarget KPI_TARGET;
public static final String C1 = "c'_+ 1";
public static final String C1 = "c'_+# 1";
public static final String C2 = "c2";
public static final String C3 = "\"c.3\"";
public static List<Column> COLUMNS;
@ -1624,11 +1624,11 @@ public abstract class EntityResourceTest<T extends EntityInterface, K extends Cr
}
protected final WebTarget getFollowersCollection(UUID id) {
return getResource(collectionName + "/" + id + "/followers");
return getResource(id).path("followers");
}
protected final WebTarget getFollowerResource(UUID id, UUID userId) {
return getResource(collectionName + "/" + id + "/followers/" + userId);
return getFollowersCollection(id).path("/" + userId);
}
protected final T getEntity(UUID id, Map<String, String> authHeaders) throws HttpResponseException {

View File

@ -26,7 +26,6 @@ import org.openmetadata.schema.analytics.type.WebAnalyticEventType;
import org.openmetadata.schema.api.tests.CreateWebAnalyticEvent;
import org.openmetadata.schema.type.MetadataOperation;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.util.ResultList;
import org.openmetadata.service.util.TestUtils;
@ -174,22 +173,21 @@ public class WebAnalyticEventResourceTest extends EntityResourceTest<WebAnalytic
@Override
public void assertFieldChange(String fieldName, Object expected, Object actual) {}
public static void putWebAnalyticEventData(WebAnalyticEventData data, Map<String, String> authHeaders)
public void putWebAnalyticEventData(WebAnalyticEventData data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("analytics/webAnalyticEvent/collect");
WebTarget target = getCollection().path("/collect");
TestUtils.put(target, data, OK, authHeaders);
}
public static void deleteWebAnalyticEventData(Long timestamp, Map<String, String> authHeaders) throws IOException {
String url =
String.format("analytics/webAnalyticEvent/%s/%s/collect", WebAnalyticEventType.PAGE_VIEW.value(), timestamp);
WebTarget target = OpenMetadataApplicationTest.getResource(url);
public void deleteWebAnalyticEventData(Long timestamp, Map<String, String> authHeaders) throws IOException {
String url = String.format("/%s/%s/collect", WebAnalyticEventType.PAGE_VIEW.value(), timestamp);
WebTarget target = getCollection().path(url);
TestUtils.delete(target, WebAnalyticEvent.class, authHeaders);
}
public static ResultList<WebAnalyticEventData> getWebAnalyticEventData(
public ResultList<WebAnalyticEventData> getWebAnalyticEventData(
String eventType, Long start, Long end, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("analytics/webAnalyticEvent/collect");
WebTarget target = getCollection().path("/collect");
target = target.queryParam("startTs", start);
target = target.queryParam("endTs", end);
target = target.queryParam("eventType", eventType);

View File

@ -122,7 +122,6 @@ import org.openmetadata.schema.type.TableType;
import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.schema.type.TagLabel.LabelType;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.exception.CatalogExceptionMessage;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.databases.TableResource.TableList;
@ -147,6 +146,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
public TableResourceTest() {
super(TABLE, Table.class, TableList.class, "tables", TableResource.FIELDS);
supportedNameCharacters = "_'- .()$";
}
public void setupDatabaseSchemas(TestInfo test) throws IOException {
@ -1744,7 +1744,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
}
private void deleteAndCheckLocation(Table table) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
WebTarget target = getResource(table.getId()).path("/location");
TestUtils.delete(target, TestUtils.TEST_AUTH_HEADERS);
checkLocationDeleted(table.getId(), TestUtils.TEST_AUTH_HEADERS);
}
@ -1756,7 +1756,7 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
public void addAndCheckLocation(Table table, UUID locationId, Status status, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource(String.format("tables/%s/location", table.getId()));
WebTarget target = getResource(table.getId()).path("/location");
TestUtils.put(target, locationId, status, authHeaders);
// GET .../tables/{tableId} returns newly added location
@ -1901,95 +1901,90 @@ public class TableResourceTest extends EntityResourceTest<Table, CreateTable> {
return createEntity(create, ADMIN_AUTH_HEADERS).withDatabase(database.getEntityReference());
}
public static Table putJoins(UUID tableId, TableJoins joins, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/joins");
public Table putJoins(UUID tableId, TableJoins joins, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource(tableId).path("/joins");
return TestUtils.put(target, joins, Table.class, OK, authHeaders);
}
public static Table putSampleData(UUID tableId, TableData data, Map<String, String> authHeaders)
public Table putSampleData(UUID tableId, TableData data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/sampleData");
WebTarget target = getResource(tableId).path("/sampleData");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table getSampleData(UUID tableId, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/sampleData");
public Table getSampleData(UUID tableId, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource(tableId).path("/sampleData");
return TestUtils.get(target, Table.class, authHeaders);
}
public static Table putTableProfilerConfig(UUID tableId, TableProfilerConfig data, Map<String, String> authHeaders)
public Table putTableProfilerConfig(UUID tableId, TableProfilerConfig data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
WebTarget target = getResource(tableId).path("/tableProfilerConfig");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table deleteTableProfilerConfig(UUID tableId, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfilerConfig");
public Table deleteTableProfilerConfig(UUID tableId, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource(tableId).path("/tableProfilerConfig");
return TestUtils.delete(target, Table.class, authHeaders);
}
public static Table getLatestTableProfile(String fqn, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + fqn + "/tableProfile/latest");
public Table getLatestTableProfile(String fqn, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getCollection().path("/" + fqn + "/tableProfile/latest");
return TestUtils.get(target, Table.class, authHeaders);
}
public static Table putTableProfileData(UUID tableId, CreateTableProfile data, Map<String, String> authHeaders)
public Table putTableProfileData(UUID tableId, CreateTableProfile data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableProfile");
WebTarget target = getResource(tableId).path("/tableProfile");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static void deleteTableProfile(String fqn, String entityType, Long timestamp, Map<String, String> authHeaders)
public void deleteTableProfile(String fqn, String entityType, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target =
OpenMetadataApplicationTest.getResource("tables/" + fqn + "/" + entityType + "/" + timestamp + "/profile");
WebTarget target = getCollection().path("/" + fqn + "/" + entityType + "/" + timestamp + "/profile");
TestUtils.delete(target, authHeaders);
}
public static ResultList<TableProfile> getTableProfiles(
public ResultList<TableProfile> getTableProfiles(
String fqn, Long startTs, Long endTs, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + fqn + "/tableProfile");
WebTarget target = getCollection().path("/" + fqn + "/tableProfile");
target = target.queryParam("startTs", startTs).queryParam("endTs", endTs);
return TestUtils.get(target, TableResource.TableProfileList.class, authHeaders);
}
public static ResultList<ColumnProfile> getColumnProfiles(
public ResultList<ColumnProfile> getColumnProfiles(
String fqn, Long startTs, Long endTs, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + fqn + "/columnProfile");
WebTarget target = getCollection().path("/" + fqn + "/columnProfile");
target = target.queryParam("startTs", startTs).queryParam("endTs", endTs);
return TestUtils.get(target, TableResource.ColumnProfileList.class, authHeaders);
}
public static Table putTableQueriesData(UUID tableId, SQLQuery data, Map<String, String> authHeaders)
public Table putTableQueriesData(UUID tableId, SQLQuery data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableQuery");
WebTarget target = getResource(tableId).path("/tableQuery");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table getTableQueriesData(UUID tableId, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/tableQuery");
public Table getTableQueriesData(UUID tableId, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource(tableId).path("/tableQuery");
return TestUtils.get(target, Table.class, authHeaders);
}
public static Table putTableDataModel(UUID tableId, DataModel dataModel, Map<String, String> authHeaders)
public Table putTableDataModel(UUID tableId, DataModel dataModel, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/dataModel");
WebTarget target = getResource(tableId).path("/dataModel");
return TestUtils.put(target, dataModel, Table.class, OK, authHeaders);
}
public static Table putCustomMetric(UUID tableId, CreateCustomMetric data, Map<String, String> authHeaders)
public Table putCustomMetric(UUID tableId, CreateCustomMetric data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("tables/" + tableId + "/customMetric");
WebTarget target = getResource(tableId).path("/customMetric");
return TestUtils.put(target, data, Table.class, OK, authHeaders);
}
public static Table deleteCustomMetric(
UUID tableId, String columnName, String metricName, Map<String, String> authHeaders)
public Table deleteCustomMetric(UUID tableId, String columnName, String metricName, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target =
OpenMetadataApplicationTest.getResource("tables/" + tableId + "/customMetric/" + columnName + "/" + metricName);
WebTarget target = getResource(tableId).path("/customMetric/" + columnName + "/" + metricName);
return TestUtils.delete(target, Table.class, authHeaders);
}

View File

@ -49,7 +49,6 @@ import org.openmetadata.schema.type.ChangeDescription;
import org.openmetadata.schema.type.Column;
import org.openmetadata.schema.type.ColumnDataType;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.databases.TableResourceTest;
import org.openmetadata.service.util.JsonUtils;
@ -410,9 +409,9 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
verifyTestCases(testCaseList, expectedTestCaseList, 12);
}
public static void putTestCaseResult(String fqn, TestCaseResult data, Map<String, String> authHeaders)
public void putTestCaseResult(String fqn, TestCaseResult data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
WebTarget target = getCollection().path("/" + fqn + "/testCaseResult");
TestUtils.put(target, data, CREATED, authHeaders);
}
@ -468,24 +467,24 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
permissionNotAllowed(TEST_USER_NAME, List.of(EDIT_TESTS)));
}
public static void deleteTestCaseResult(String fqn, Long timestamp, Map<String, String> authHeaders)
public void deleteTestCaseResult(String fqn, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult/" + timestamp);
WebTarget target = getCollection().path("/" + fqn + "/testCaseResult/" + timestamp);
TestUtils.delete(target, authHeaders);
}
public static ResultList<TestCaseResult> getTestCaseResults(
public ResultList<TestCaseResult> getTestCaseResults(
String fqn, Long start, Long end, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testCase/" + fqn + "/testCaseResult");
WebTarget target = getCollection().path("/" + fqn + "/testCaseResult");
target = target.queryParam("startTs", start);
target = target.queryParam("endTs", end);
return TestUtils.get(target, TestCaseResource.TestCaseResultList.class, authHeaders);
}
public static ResultList<TestCase> getTestCases(
public ResultList<TestCase> getTestCases(
Integer limit, String fields, String link, Boolean includeAll, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testCase");
WebTarget target = getCollection();
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
if (link != null) {
@ -497,10 +496,10 @@ public class TestCaseResourceTest extends EntityResourceTest<TestCase, CreateTes
return TestUtils.get(target, TestCaseResource.TestCaseList.class, authHeaders);
}
public static ResultList<TestCase> getTestCases(
public ResultList<TestCase> getTestCases(
Integer limit, String fields, TestSuite testSuite, Boolean includeAll, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testCase");
WebTarget target = getCollection();
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
target = target.queryParam("testSuiteId", testSuite.getId());

View File

@ -24,7 +24,6 @@ import org.openmetadata.schema.tests.TestCase;
import org.openmetadata.schema.tests.TestSuite;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.util.ResultList;
import org.openmetadata.service.util.TestUtils;
@ -103,7 +102,7 @@ public class TestSuiteResourceTest extends EntityResourceTest<TestSuite, CreateT
public static ResultList<TestSuite> getTestSuites(Integer limit, String fields, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("testSuite");
WebTarget target = getResource("testSuite");
target = limit != null ? target.queryParam("limit", limit) : target;
target = target.queryParam("fields", fields);
return TestUtils.get(target, TestSuiteResource.TestSuiteList.class, authHeaders);

View File

@ -191,7 +191,7 @@ public class FeedResourceTest extends OpenMetadataApplicationTest {
// Create thread without addressed to entity in the request
CreateThread create = create().withFrom(USER.getName()).withAbout("<>"); // Invalid EntityLink
String failureReason = "[about must match \"^<#E::\\w+::[\\w'\\- .&/:+\"\\\\]+>$\"]";
String failureReason = "[about must match \"^<#E::\\w+::[\\w'\\- .&/:+\"\\\\()$#]+>$\"]";
assertResponseContains(() -> createThread(create, AUTH_HEADERS), BAD_REQUEST, failureReason);
create.withAbout("<#E::>"); // Invalid EntityLink - missing entityType and entityId

View File

@ -190,7 +190,10 @@ public class GlossaryResourceTest extends EntityResourceTest<Glossary, CreateGlo
List<TagLabel> tagLabels = toTagLabels(t1, t11, t12, t2, t21, t22);
Column column = new Column().withName(C1).withDataType(ColumnDataType.INT).withTags(tagLabels);
CreateTable createTable =
tableResourceTest.createRequest(getEntityName(test)).withTags(tagLabels).withColumns(listOf(column));
tableResourceTest
.createRequest(tableResourceTest.getEntityName(test))
.withTags(tagLabels)
.withColumns(listOf(column));
Table table = tableResourceTest.createEntity(createTable, ADMIN_AUTH_HEADERS);
//
@ -247,7 +250,10 @@ public class GlossaryResourceTest extends EntityResourceTest<Glossary, CreateGlo
List<TagLabel> tagLabels = toTagLabels(t1, t11, t111, t12, t121, t13, t131, t2, t21, t211, h1, h11, h111);
Column column = new Column().withName(C1).withDataType(ColumnDataType.INT).withTags(tagLabels);
CreateTable createTable =
tableResourceTest.createRequest(getEntityName(test)).withTags(tagLabels).withColumns(listOf(column));
tableResourceTest
.createRequest(tableResourceTest.getEntityName(test))
.withTags(tagLabels)
.withColumns(listOf(column));
Table table = tableResourceTest.createEntity(createTable, ADMIN_AUTH_HEADERS);
Object[][] scenarios = {
@ -376,13 +382,13 @@ public class GlossaryResourceTest extends EntityResourceTest<Glossary, CreateGlo
}
private CsvImportResult importCsv(String glossaryName, String csv, boolean dryRun) throws HttpResponseException {
WebTarget target = getResourceByName(glossaryName + "/import");
WebTarget target = getResourceByName(glossaryName).path("/import");
target = !dryRun ? target.queryParam("dryRun", false) : target;
return TestUtils.putCsv(target, csv, CsvImportResult.class, Status.OK, ADMIN_AUTH_HEADERS);
}
private String exportCsv(String glossaryName) throws HttpResponseException {
WebTarget target = getResourceByName(glossaryName + "/export");
WebTarget target = getResourceByName(glossaryName).path("/export");
return TestUtils.get(target, String.class, ADMIN_AUTH_HEADERS);
}

View File

@ -195,7 +195,8 @@ public class GlossaryTermResourceTest extends EntityResourceTest<GlossaryTerm, C
// Apply each of the tag to a table
TableResourceTest tableResourceTest = new TableResourceTest();
CreateTable createTable = tableResourceTest.createRequest(getEntityName(test)).withTags(toTagLabels(a, aa, aaa));
CreateTable createTable =
tableResourceTest.createRequest(tableResourceTest.getEntityName(test)).withTags(toTagLabels(a, aa, aaa));
tableResourceTest.createEntity(createTable, ADMIN_AUTH_HEADERS);
// Ensure prefix based tagLabel doesn't double count due too common prefix

View File

@ -38,7 +38,6 @@ import org.openmetadata.schema.type.ChangeDescription;
import org.openmetadata.schema.type.DataInsightChartDataType;
import org.openmetadata.schema.type.DataReportIndex;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.dataInsight.DataInsightResourceTest;
import org.openmetadata.service.util.ResultList;
@ -188,15 +187,14 @@ public class KpiResourceTest extends EntityResourceTest<Kpi, CreateKpiRequest> {
verifyKpiResults(kpiResults, kpiResultList, 12);
}
public static void putKpiResult(String fqn, KpiResult data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("kpi/" + fqn + "/kpiResult");
public void putKpiResult(String fqn, KpiResult data, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getCollection().path("/" + fqn + "/kpiResult");
TestUtils.put(target, data, CREATED, authHeaders);
}
public static ResultList<KpiResult> getKpiResults(String fqn, Long start, Long end, Map<String, String> authHeaders)
public ResultList<KpiResult> getKpiResults(String fqn, Long start, Long end, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("kpi/" + fqn + "/kpiResult");
WebTarget target = getCollection().path("/" + fqn + "/kpiResult");
target = target.queryParam("startTs", start);
target = target.queryParam("endTs", end);
return TestUtils.get(target, KpiResource.KpiResultList.class, authHeaders);

View File

@ -38,7 +38,6 @@ import org.openmetadata.schema.api.data.CreateLocation;
import org.openmetadata.schema.entity.data.Location;
import org.openmetadata.schema.type.EntityReference;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.locations.LocationResource.LocationList;
import org.openmetadata.service.util.FullyQualifiedName;
@ -50,7 +49,8 @@ public class LocationResourceTest extends EntityResourceTest<Location, CreateLoc
public LocationResourceTest() {
super(Entity.LOCATION, Location.class, LocationList.class, "locations", LocationResource.FIELDS);
// TODO quoted location is not allowed by the Location listPrefix APIs
supportedNameCharacters = supportedNameCharacters.replaceAll("[ .]", ""); // Space not supported
// supportedNameCharacters = "_'-.";
supportedNameCharacters = supportedNameCharacters.replaceAll("[ &.]", ""); // Space not supported
}
@Override
@ -100,8 +100,7 @@ public class LocationResourceTest extends EntityResourceTest<Location, CreateLoc
}
private List<EntityReference> getAssociatedEntity(Location location) throws HttpResponseException {
WebTarget target =
OpenMetadataApplicationTest.getResource(String.format("locations/association/%s", location.getId()));
WebTarget target = getResource(String.format("locations/association/%s", location.getId()));
return (List<EntityReference>) TestUtils.get(target, List.class, ADMIN_AUTH_HEADERS);
}

View File

@ -60,8 +60,7 @@ public class TypeResourceTest extends EntityResourceTest<Type, CreateType> {
super(Entity.TYPE, Type.class, TypeList.class, "metadata/types", TypeResource.PROPERTIES);
supportsEmptyDescription = false;
supportsFieldsQueryParam = false;
// Special characters are not supported in the name
supportedNameCharacters = supportedNameCharacters.replaceAll("[ ':&/.]", "");
supportedNameCharacters = "_"; // No other special characters allowed
}
public void setupTypes() throws HttpResponseException {

View File

@ -58,7 +58,6 @@ import org.openmetadata.schema.type.Status;
import org.openmetadata.schema.type.StatusType;
import org.openmetadata.schema.type.Task;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.pipelines.PipelineResource.PipelineList;
import org.openmetadata.service.util.FullyQualifiedName;
@ -565,19 +564,19 @@ public class PipelineResourceTest extends EntityResourceTest<Pipeline, CreatePip
// Prepare Pipeline status endpoint for PUT
public static Pipeline putPipelineStatusData(String fqn, PipelineStatus data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status");
WebTarget target = getResource("pipelines/" + fqn + "/status");
return TestUtils.put(target, data, Pipeline.class, OK, authHeaders);
}
public static Pipeline deletePipelineStatus(String fqn, Long timestamp, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status/" + timestamp);
WebTarget target = getResource("pipelines/" + fqn + "/status/" + timestamp);
return TestUtils.delete(target, Pipeline.class, authHeaders);
}
public static ResultList<PipelineStatus> getPipelineStatues(
String fqn, Long startTs, Long endTs, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("pipelines/" + fqn + "/status");
WebTarget target = getResource("pipelines/" + fqn + "/status");
target = target.queryParam("startTs", startTs).queryParam("endTs", endTs);
return TestUtils.get(target, PipelineResource.PipelineStatusList.class, authHeaders);
}

View File

@ -122,7 +122,7 @@ public class UserResourceTest extends EntityResourceTest<User, CreateUser> {
public UserResourceTest() {
super(Entity.USER, User.class, UserList.class, "users", UserResource.FIELDS);
supportedNameCharacters = supportedNameCharacters.replace(" ", ""); // Space not supported
supportedNameCharacters = "_-.";
}
public void setupUsers(TestInfo test) throws HttpResponseException {

View File

@ -54,7 +54,6 @@ import org.openmetadata.schema.type.TagLabel;
import org.openmetadata.schema.type.topic.CleanupPolicy;
import org.openmetadata.schema.type.topic.TopicSampleData;
import org.openmetadata.service.Entity;
import org.openmetadata.service.OpenMetadataApplicationTest;
import org.openmetadata.service.resources.EntityResourceTest;
import org.openmetadata.service.resources.topics.TopicResource.TopicList;
import org.openmetadata.service.util.JsonUtils;
@ -287,15 +286,14 @@ public class TopicResourceTest extends EntityResourceTest<Topic, CreateTopic> {
return topic;
}
public static Topic getTopic(UUID id, String fields, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource("topics/" + id);
public Topic getTopic(UUID id, String fields, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResource(id);
target = fields != null ? target.queryParam("fields", fields) : target;
return TestUtils.get(target, Topic.class, authHeaders);
}
public static Topic getTopicByName(String fqn, String fields, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = getResource("topics/name/" + fqn);
public Topic getTopicByName(String fqn, String fields, Map<String, String> authHeaders) throws HttpResponseException {
WebTarget target = getResourceByName(fqn);
target = fields != null ? target.queryParam("fields", fields) : target;
return TestUtils.get(target, Topic.class, authHeaders);
}
@ -350,9 +348,9 @@ public class TopicResourceTest extends EntityResourceTest<Topic, CreateTopic> {
}
}
public static Topic putSampleData(UUID topicId, TopicSampleData data, Map<String, String> authHeaders)
public Topic putSampleData(UUID topicId, TopicSampleData data, Map<String, String> authHeaders)
throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("topics/" + topicId + "/sampleData");
WebTarget target = getResource(topicId).path("/sampleData");
return TestUtils.put(target, data, Topic.class, OK, authHeaders);
}

View File

@ -58,12 +58,12 @@ public class UtilResourceTest extends OpenMetadataApplicationTest {
}
public static EntitiesCount getEntitiesCount() throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("util/entities/count");
WebTarget target = getResource("util/entities/count");
return TestUtils.get(target, EntitiesCount.class, ADMIN_AUTH_HEADERS);
}
public static ServicesCount getServicesCount() throws HttpResponseException {
WebTarget target = OpenMetadataApplicationTest.getResource("util/services/count");
WebTarget target = getResource("util/services/count");
return TestUtils.get(target, ServicesCount.class, ADMIN_AUTH_HEADERS);
}

View File

@ -15,7 +15,7 @@
"type": "string",
"minLength": 1,
"maxLength": 128,
"pattern": "^[\\w'\\- ./]+$"
"pattern": "^[\\w'\\- ./()$]+$"
},
"profileSampleType": {
"description": "Type of Profile Sample (percentage or rows)",
@ -162,7 +162,7 @@
"columnName": {
"description": "Local name (not fully qualified name) of the column. ColumnName is `-` when the column is not named in struct dataType. For example, BigQuery supports struct with unnamed fields.",
"type": "string",
"pattern": "^[\\w'\\-\" .+]+$",
"pattern": "^[\\w'\\-\" .+#]+$",
"minLength": 1,
"maxLength": 128
},

View File

@ -88,7 +88,7 @@
"entityLink": {
"description": "Link to an entity or field within an entity using this format `<#E::{entities}::{entityType}::{field}::{arrayFieldName}::{arrayFieldValue}`.",
"type": "string",
"pattern": "^<#E::\\w+::[\\w'\\- .&/:+\"\\\\]+>$"
"pattern": "^<#E::\\w+::[\\w'\\- .&/:+\"\\\\()$#]+>$"
},
"entityName": {
"description": "Name that identifies a entity.",