use of org.apache.atlas.catalog.Request in project incubator-atlas by apache.
the class QueryFactoryTest method testCollectionQuery_ProjectionQuery.
@Test
public void testCollectionQuery_ProjectionQuery() throws Exception {
String queryString = "relation/name:foo";
Request request = new CollectionRequest(Collections.<String, Object>emptyMap(), queryString);
QueryFactory factory = new QueryFactory();
AtlasTaxonomyQuery query = (AtlasTaxonomyQuery) factory.createTaxonomyQuery(request);
QueryExpression queryExpression = query.getQueryExpression();
assertEquals(queryExpression.getClass(), ProjectionQueryExpression.class);
ProjectionQueryExpression projectionExpression = (ProjectionQueryExpression) queryExpression;
QueryExpression underlyingExpression = projectionExpression.getUnderlyingExpression();
assertEquals(underlyingExpression.getClass(), TermQueryExpression.class);
assertEquals(underlyingExpression.getField(), QueryFactory.escape("relation/name"));
assertEquals(underlyingExpression.getExpectedValue(), "foo");
assertEquals(query.getRequest(), request);
assertEquals(query.getResourceDefinition().getTypeName(), "Taxonomy");
}
use of org.apache.atlas.catalog.Request in project incubator-atlas by apache.
the class TermResourceDefinitionTest method testValidate.
@Test
public void testValidate() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("name", "taxonomy1.termName");
properties.put("description", "foo");
properties.put("available_as_tag", true);
properties.put("acceptable_use", "something");
Request request = new InstanceRequest(properties);
ResourceDefinition termDefinition = new TermResourceDefinition();
termDefinition.validateCreatePayload(request);
}
use of org.apache.atlas.catalog.Request in project incubator-atlas by apache.
the class TermResourceDefinitionTest method testValidate_invalidTermName.
@Test(expectedExceptions = InvalidPayloadException.class)
public void testValidate_invalidTermName() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("name", "NotQualifiedTermName");
properties.put("description", "foo");
properties.put("available_as_tag", true);
Request request = new InstanceRequest(properties);
ResourceDefinition termDefinition = new TermResourceDefinition();
termDefinition.validateCreatePayload(request);
}
use of org.apache.atlas.catalog.Request in project incubator-atlas by apache.
the class TermResourceDefinitionTest method testValidate_invalidProperty.
@Test(expectedExceptions = InvalidPayloadException.class)
public void testValidate_invalidProperty() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("name", "foo");
properties.put("unknownProperty", "value");
Request request = new InstanceRequest(properties);
ResourceDefinition termDefinition = new TermResourceDefinition();
termDefinition.validateCreatePayload(request);
}
use of org.apache.atlas.catalog.Request in project incubator-atlas by apache.
the class EntityTagResourceDefinitionTest method testValidate.
@Test
public void testValidate() throws Exception {
Map<String, Object> properties = new HashMap<>();
properties.put("name", "taxonomy1.termName");
Request request = new InstanceRequest(properties);
ResourceDefinition entityTagDefinition = new EntityTagResourceDefinition();
entityTagDefinition.validateCreatePayload(request);
}
Aggregations