Commit 65b613b8 by Venkatesh Seetharam

BUG-32815 BUG-32816 BUG-32827 Entity Trait Management Backend API. Contributed…

BUG-32815 BUG-32816 BUG-32827 Entity Trait Management Backend API. Contributed by Venkatesh Seetharam
parent ca9fd2f5
......@@ -905,11 +905,11 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.7.2</version>
<!--
<!--
<configuration>
<skipTests>true</skipTests>
</configuration>
-->
-->
<dependencies>
<dependency>
<groupId>org.apache.maven.surefire</groupId>
......
......@@ -130,11 +130,10 @@ public interface MetadataRepository {
* Adds a new trait to an existing entity represented by a guid.
*
* @param guid globally unique identifier for the entity
* @param traitName trait name for the instance that needs to be added to entity
* @param traitInstance trait instance that needs to be added to entity
* @throws RepositoryException
*/
void addTrait(String guid, String traitName,
void addTrait(String guid,
ITypedStruct traitInstance) throws RepositoryException;
/**
......
......@@ -207,9 +207,10 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
* @throws RepositoryException
*/
@Override
public void addTrait(String guid, String traitName,
public void addTrait(String guid,
ITypedStruct traitInstance) throws RepositoryException {
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
final String traitName = traitInstance.getTypeName();
LOG.info("Adding a new trait={} for entity={}", traitName, guid);
try {
......@@ -219,7 +220,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
// add the trait instance as a new vertex
final String typeName = getTypeName(instanceVertex);
instanceToGraphMapper.mapTraitInstanceToVertex(
traitName, traitInstance, getIdFromVertex(typeName, instanceVertex),
traitInstance, getIdFromVertex(typeName, instanceVertex),
typeName, instanceVertex, Collections.<Id, Vertex>emptyMap());
// update the traits in entity once adding trait instance is successful
......@@ -446,7 +447,7 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
ITypedStruct traitInstance = (ITypedStruct) typedInstance.getTrait(traitName);
// add the attributes for the trait instance
mapTraitInstanceToVertex(traitName, traitInstance, typedInstance,
mapTraitInstanceToVertex(traitInstance, typedInstance,
instanceVertex, entityProcessor.idToVertexMap);
}
......@@ -655,22 +656,23 @@ public class GraphBackedMetadataRepository implements MetadataRepository {
return structInstanceVertex;
}
private void mapTraitInstanceToVertex(String traitName, ITypedStruct traitInstance,
private void mapTraitInstanceToVertex(ITypedStruct traitInstance,
ITypedReferenceableInstance typedInstance,
Vertex parentInstanceVertex,
Map<Id, Vertex> idToVertexMap)
throws MetadataException {
// add a new vertex for the struct or trait instance
mapTraitInstanceToVertex(traitName, traitInstance, typedInstance.getId(),
mapTraitInstanceToVertex(traitInstance, typedInstance.getId(),
typedInstance.getTypeName(), parentInstanceVertex, idToVertexMap);
}
private void mapTraitInstanceToVertex(String traitName, ITypedStruct traitInstance,
private void mapTraitInstanceToVertex(ITypedStruct traitInstance,
Id typedInstanceId, String typedInstanceTypeName,
Vertex parentInstanceVertex,
Map<Id, Vertex> idToVertexMap)
throws MetadataException {
// add a new vertex for the struct or trait instance
final String traitName = traitInstance.getTypeName();
Vertex traitInstanceVertex = GraphHelper.createVertexWithoutIdentity(
graphService.getBlueprintsGraph(), traitInstance.getTypeName(), typedInstanceId);
LOG.debug("created vertex {} for trait {}", traitInstanceVertex, traitName);
......
......@@ -34,7 +34,6 @@ import org.apache.hadoop.metadata.typesystem.types.IDataType;
import org.apache.hadoop.metadata.typesystem.types.TypeSystem;
import org.codehaus.jettison.json.JSONException;
import org.codehaus.jettison.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -44,6 +43,10 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
/**
* Simple wrapper over TypeSystem and MetadataRepository services with hooks
* for listening to changes to the repository.
*/
public class DefaultMetadataService implements MetadataService {
private static final Logger LOG =
......@@ -212,25 +215,37 @@ public class DefaultMetadataService implements MetadataService {
* Adds a new trait to an existing entity represented by a guid.
*
* @param guid globally unique identifier for the entity
* @param traitName trait name for the instance that needs to be added to entity
* @param traitInstance trait instance that needs to be added to entity
* @param traitInstanceDefinition trait instance json that needs to be added to entity
* @throws MetadataException
*/
@Override
public void addTrait(String guid, String traitName,
ITypedStruct traitInstance) throws MetadataException {
public void addTrait(String guid,
String traitInstanceDefinition) throws MetadataException {
Preconditions.checkNotNull(guid, "entity GUID cannot be null");
Preconditions.checkNotNull(traitName, "Trait name cannot be null");
Preconditions.checkNotNull(traitInstance, "Trait instance cannot be null");
Preconditions.checkNotNull(traitInstanceDefinition, "Trait instance cannot be null");
ITypedStruct traitInstance = deserializeTraitInstance(traitInstanceDefinition);
final String traitName = traitInstance.getTypeName();
// ensure trait type is already registered with the TS
Preconditions.checkArgument(!typeSystem.isRegistered(traitName),
Preconditions.checkArgument(typeSystem.isRegistered(traitName),
"trait=%s should be defined in type system before it can be added", traitName);
repository.addTrait(guid, traitName, traitInstance);
repository.addTrait(guid, traitInstance);
onTraitAddedToEntity(guid, traitName);
}
private ITypedStruct deserializeTraitInstance(String traitInstanceDefinition)
throws MetadataException {
try {
return (ITypedStruct) Serialization$.MODULE$.traitFromJson(traitInstanceDefinition);
} catch (Exception e) {
throw new MetadataException("Error deserializing trait instance");
}
}
/**
* Deletes a given trait from an existing entity represented by a guid.
*
......@@ -245,11 +260,12 @@ public class DefaultMetadataService implements MetadataService {
Preconditions.checkNotNull(traitNameToBeDeleted, "Trait name cannot be null");
// ensure trait type is already registered with the TS
Preconditions.checkArgument(!typeSystem.isRegistered(traitNameToBeDeleted),
Preconditions.checkArgument(typeSystem.isRegistered(traitNameToBeDeleted),
"trait=%s should be defined in type system before it can be deleted",
traitNameToBeDeleted);
repository.deleteTrait(guid, traitNameToBeDeleted);
onTraitDeletedFromEntity(guid, traitNameToBeDeleted);
}
......
......@@ -19,7 +19,6 @@
package org.apache.hadoop.metadata.services;
import org.apache.hadoop.metadata.MetadataException;
import org.apache.hadoop.metadata.typesystem.ITypedStruct;
import org.codehaus.jettison.json.JSONObject;
import java.util.List;
......@@ -94,12 +93,11 @@ public interface MetadataService {
* Adds a new trait to an existing entity represented by a guid.
*
* @param guid globally unique identifier for the entity
* @param traitName trait name for the instance that needs to be added to entity
* @param traitInstance trait instance that needs to be added to entity
* @param traitInstanceDefinition trait instance that needs to be added to entity
* @throws MetadataException
*/
void addTrait(String guid, String traitName,
ITypedStruct traitInstance) throws MetadataException;
void addTrait(String guid,
String traitInstanceDefinition) throws MetadataException;
/**
* Deletes a given trait from an existing entity represented by a guid.
......
......@@ -231,7 +231,7 @@ public class GraphBackedMetadataRepositoryTest {
TraitType traitType = typeSystem.defineTraitType(piiTrait);
ITypedStruct traitInstance = traitType.createInstance();
repositoryService.addTrait(aGUID, PII, traitInstance);
repositoryService.addTrait(aGUID, traitInstance);
// refresh trait names
traitNames = repositoryService.getTraitNames(aGUID);
......@@ -242,7 +242,7 @@ public class GraphBackedMetadataRepositoryTest {
@Test (expectedExceptions = NullPointerException.class)
public void testAddTraitWithNullInstance() throws Exception {
repositoryService.addTrait(getGUID(), PII, null);
repositoryService.addTrait(getGUID(), null);
Assert.fail();
}
......@@ -251,7 +251,7 @@ public class GraphBackedMetadataRepositoryTest {
TraitType traitType = typeSystem.getDataType(TraitType.class, PII);
ITypedStruct traitInstance = traitType.createInstance();
repositoryService.addTrait(UUID.randomUUID().toString(), PII, traitInstance);
repositoryService.addTrait(UUID.randomUUID().toString(), traitInstance);
Assert.fail();
}
......
......@@ -48,10 +48,8 @@ public class LoggingExceptionMapper<E extends Throwable> implements ExceptionMap
@SuppressWarnings("UnusedParameters")
protected String formatErrorMessage(long id, E exception) {
return String
.format("There was an error processing your request. It has been logged (ID " +
"%016x).",
id);
return String.format(
"There was an error processing your request. It has been logged (ID %016x).", id);
}
protected void logException(long id, E exception) {
......
......@@ -35,6 +35,7 @@ import javax.ws.rs.Consumes;
import javax.ws.rs.DefaultValue;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
......@@ -43,6 +44,7 @@ import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.util.List;
/**
......@@ -57,6 +59,9 @@ public class EntityResource {
private static final Logger LOG = LoggerFactory.getLogger(EntityResource.class);
private static final String GUID = "GUID";
private static final String TRAIT_NAME = "traitName";
private final MetadataService metadataService;
/**
......@@ -87,14 +92,18 @@ public class EntityResource {
final String guid = metadataService.createEntity(typeName, entity);
JSONObject response = new JSONObject();
response.put("GUID", guid);
response.put("requestId", Thread.currentThread().getName());
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put(GUID, guid);
return Response.ok(response).build();
} catch (Exception e) {
} catch (MetadataException | IOException | IllegalArgumentException e) {
LOG.error("Unable to persist instance for type {}", typeName, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (JSONException e) {
LOG.error("Unable to persist instance for type {}", typeName, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
}
......@@ -107,13 +116,15 @@ public class EntityResource {
@Path("definition/{guid}")
@Produces(MediaType.APPLICATION_JSON)
public Response getEntityDefinition(@PathParam("guid") String guid) {
Preconditions.checkNotNull(guid, "guid cannot be null");
Preconditions.checkNotNull(guid, "Entity GUID cannot be null");
try {
LOG.debug("Fetching entity definition for guid={} ", guid);
final String entityDefinition = metadataService.getEntityDefinition(guid);
JSONObject response = new JSONObject();
response.put("requestId", Thread.currentThread().getName());
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put(GUID, guid);
Response.Status status = Response.Status.NOT_FOUND;
if (entityDefinition != null) {
......@@ -123,7 +134,7 @@ public class EntityResource {
return Response.status(status).entity(response).build();
} catch (MetadataException e) {
} catch (MetadataException | IllegalArgumentException e) {
LOG.error("An entity with GUID={} does not exist", guid, e);
throw new WebApplicationException(e, Response
.status(Response.Status.NOT_FOUND)
......@@ -153,15 +164,18 @@ public class EntityResource {
public Response getEntityList(@PathParam("entityType") String entityType,
@DefaultValue("0") @QueryParam("offset") Integer offset,
@QueryParam("numResults") Integer resultsPerPage) {
Preconditions.checkNotNull(entityType, "Entity type cannot be null");
try {
LOG.debug("Fetching entity list for type={} ", entityType);
final List<String> entityList = metadataService.getEntityList(entityType);
JSONObject response = new JSONObject();
response.put("requestId", Thread.currentThread().getName());
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put("type", entityType);
response.put("list", new JSONArray(entityList));
return Response.ok(response).build();
} catch (MetadataException e) {
} catch (MetadataException | IllegalArgumentException e) {
LOG.error("Unable to get entity list for type {}", entityType, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
......@@ -171,4 +185,110 @@ public class EntityResource {
Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
}
// Trait management functions
/**
* Gets the list of trait names for a given entity represented by a guid.
*
* @param guid globally unique identifier for the entity
* @return a list of trait names for the given entity guid
*/
@GET
@Path("traits/list/{guid}")
@Produces(MediaType.APPLICATION_JSON)
public Response getTraitNames(@PathParam("guid") String guid) {
Preconditions.checkNotNull(guid, "Entity GUID cannot be null");
try {
LOG.debug("Fetching trait names for entity={}", guid);
final List<String> traitNames = metadataService.getTraitNames(guid);
JSONObject response = new JSONObject();
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put(GUID, guid);
response.put("list", new JSONArray(traitNames));
return Response.ok(response).build();
} catch (MetadataException | IllegalArgumentException e) {
LOG.error("Unable to get trait names for entity {}", guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (JSONException e) {
LOG.error("Unable to get trait names for entity {}", guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
}
/**
* Adds a new trait to an existing entity represented by a guid.
*
* @param guid globally unique identifier for the entity
*/
@POST
@Path("traits/add/{guid}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response addTrait(@Context HttpServletRequest request,
@PathParam("guid") String guid) {
Preconditions.checkNotNull(guid, "Entity GUID cannot be null");
try {
final String traitDefinition = Servlets.getRequestPayload(request);
LOG.debug("Adding trait={} for entity={} ", traitDefinition, guid);
metadataService.addTrait(guid, traitDefinition);
JSONObject response = new JSONObject();
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put(GUID, guid);
response.put("traitInstance", traitDefinition);
return Response.ok(response).build();
} catch (MetadataException | IOException | IllegalArgumentException e) {
LOG.error("Unable to add trait for entity={}", guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (JSONException e) {
LOG.error("Unable to add trait for entity={}", guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
}
/**
* Deletes a given trait from an existing entity represented by a guid.
*
* @param guid globally unique identifier for the entity
* @param traitName name of the trait
*/
@PUT
@Path("traits/delete/{guid}/{traitName}")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public Response deleteTrait(@Context HttpServletRequest request,
@PathParam("guid") String guid,
@PathParam(TRAIT_NAME) String traitName) {
Preconditions.checkNotNull(guid, "Entity GUID cannot be null");
Preconditions.checkNotNull(traitName, "Trait name cannot be null");
LOG.debug("Deleting trait={} from entity={} ", traitName, guid);
try {
metadataService.deleteTrait(guid, traitName);
JSONObject response = new JSONObject();
response.put(Servlets.REQUEST_ID, Servlets.getRequestId());
response.put(GUID, guid);
response.put(TRAIT_NAME, traitName);
return Response.ok(response).build();
} catch (MetadataException | IllegalArgumentException e) {
LOG.error("Unable to add trait name={} for entity={}", traitName, guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.BAD_REQUEST));
} catch (JSONException e) {
LOG.error("Unable to add trait name={} for entity={}", traitName, guid, e);
throw new WebApplicationException(
Servlets.getErrorResponse(e, Response.Status.INTERNAL_SERVER_ERROR));
}
}
}
......@@ -111,4 +111,8 @@ public final class Servlets {
IOUtils.copy(request.getInputStream(), writer);
return writer.toString();
}
public static String getRequestId() {
return Thread.currentThread().getName();
}
}
......@@ -28,6 +28,7 @@ import org.apache.hadoop.metadata.typesystem.Referenceable;
import org.apache.hadoop.metadata.typesystem.Struct;
import org.apache.hadoop.metadata.typesystem.json.Serialization$;
import org.apache.hadoop.metadata.typesystem.json.TypesSerialization;
import org.apache.hadoop.metadata.typesystem.json.TypesSerialization$;
import org.apache.hadoop.metadata.typesystem.types.AttributeDefinition;
import org.apache.hadoop.metadata.typesystem.types.AttributeInfo;
import org.apache.hadoop.metadata.typesystem.types.ClassType;
......@@ -239,14 +240,127 @@ public class EntityJerseyResourceIT extends BaseResourceIT {
ImmutableList.<String>of(),
TypesUtil.createRequiredAttrDef("name", DataTypes.STRING_TYPE),
TypesUtil.createRequiredAttrDef("description", DataTypes.STRING_TYPE));
typeSystem.defineClassType(testTypeDefinition);
@SuppressWarnings("unchecked")
String typesAsJSON = TypesSerialization.toJson(typeSystem,
Arrays.asList(new String[]{"test"}));
String typesAsJSON = TypesSerialization.toJson(testTypeDefinition);
sumbitType(typesAsJSON, "test");
}
@Test (dependsOnMethods = "testSubmitEntity")
public void testGetTraitNames() throws Exception {
ClientResponse clientResponse = service
.path("api/metadata/entities/traits/list")
.path(guid)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.method(HttpMethod.GET, ClientResponse.class);
Assert.assertEquals(clientResponse.getStatus(), Response.Status.OK.getStatusCode());
String responseAsString = clientResponse.getEntity(String.class);
Assert.assertNotNull(responseAsString);
JSONObject response = new JSONObject(responseAsString);
Assert.assertNotNull(response.get("requestId"));
Assert.assertNotNull(response.get("GUID"));
final JSONArray list = response.getJSONArray("list");
Assert.assertEquals(list.length(), 7);
}
@Test (dependsOnMethods = "testGetTraitNames")
public void testAddTrait() throws Exception {
final String traitName = "PII_Trait";
HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, ImmutableList.<String>of());
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
sumbitType(traitDefinitionAsJSON, traitName);
typeSystem.defineTraitType(piiTrait);
Struct s = new Struct(traitName);
TraitType tType = typeSystem.getDataType(TraitType.class, traitName);
ITypedInstance traitInstance = tType.convert(s, Multiplicity.REQUIRED);
String traitInstanceAsJSON = Serialization$.MODULE$.toJson(traitInstance);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
ClientResponse clientResponse = service
.path("api/metadata/entities/traits/add")
.path(guid)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.method(HttpMethod.POST, ClientResponse.class, traitInstanceAsJSON);
Assert.assertEquals(clientResponse.getStatus(), Response.Status.OK.getStatusCode());
String responseAsString = clientResponse.getEntity(String.class);
Assert.assertNotNull(responseAsString);
JSONObject response = new JSONObject(responseAsString);
Assert.assertNotNull(response.get("requestId"));
Assert.assertNotNull(response.get("GUID"));
Assert.assertNotNull(response.get("traitInstance"));
}
@Test
public void testAddTraitWithNoRegistration() throws Exception {
final String traitName = "PII_Trait_Blah";
HierarchicalTypeDefinition<TraitType> piiTrait =
TypesUtil.createTraitTypeDef(traitName, ImmutableList.<String>of());
String traitDefinitionAsJSON = TypesSerialization$.MODULE$.toJson(piiTrait, true);
LOG.debug("traitDefinitionAsJSON = " + traitDefinitionAsJSON);
typeSystem.defineTraitType(piiTrait);
Struct s = new Struct(traitName);
TraitType tType = typeSystem.getDataType(TraitType.class, traitName);
ITypedInstance traitInstance = tType.convert(s, Multiplicity.REQUIRED);
String traitInstanceAsJSON = Serialization$.MODULE$.toJson(traitInstance);
LOG.debug("traitInstanceAsJSON = " + traitInstanceAsJSON);
ClientResponse clientResponse = service
.path("api/metadata/entities/traits/add")
.path(guid)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.method(HttpMethod.POST, ClientResponse.class, traitInstanceAsJSON);
Assert.assertEquals(clientResponse.getStatus(),
Response.Status.BAD_REQUEST.getStatusCode());
}
@Test (dependsOnMethods = "testAddTrait")
public void testDeleteTrait() throws Exception {
final String traitName = "PII_Trait";
ClientResponse clientResponse = service
.path("api/metadata/entities/traits/delete")
.path(guid)
.path(traitName)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.method(HttpMethod.PUT, ClientResponse.class);
Assert.assertEquals(clientResponse.getStatus(), Response.Status.OK.getStatusCode());
String responseAsString = clientResponse.getEntity(String.class);
Assert.assertNotNull(responseAsString);
JSONObject response = new JSONObject(responseAsString);
Assert.assertNotNull(response.get("requestId"));
Assert.assertNotNull(response.get("GUID"));
Assert.assertNotNull(response.get("traitName"));
}
@Test
public void testDeleteTraitNonExistent() throws Exception {
final String traitName = "blah_trait";
ClientResponse clientResponse = service
.path("api/metadata/entities/traits/delete")
.path(guid)
.path(traitName)
.accept(MediaType.APPLICATION_JSON)
.type(MediaType.APPLICATION_JSON)
.method(HttpMethod.PUT, ClientResponse.class);
Assert.assertEquals(clientResponse.getStatus(),
Response.Status.BAD_REQUEST.getStatusCode());
}
private void createHiveTypes() throws Exception {
HierarchicalTypeDefinition<ClassType> databaseTypeDefinition =
TypesUtil.createClassTypeDef(DATABASE_TYPE,
......
......@@ -27,7 +27,6 @@ import org.apache.hadoop.metadata.typesystem.types.ClassType;
import org.apache.hadoop.metadata.typesystem.types.DataTypes;
import org.apache.hadoop.metadata.typesystem.types.HierarchicalTypeDefinition;
import org.apache.hadoop.metadata.typesystem.types.Multiplicity;
import org.apache.hadoop.metadata.typesystem.types.StructTypeDefinition;
import org.apache.hadoop.metadata.typesystem.types.TraitType;
import org.apache.hadoop.metadata.typesystem.types.utils.TypesUtil;
import org.codehaus.jettison.json.JSONArray;
......@@ -65,8 +64,7 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
@Test
public void testSubmit() throws Exception {
for (HierarchicalTypeDefinition typeDefinition : typeDefinitions) {
String typesAsJSON = TypesSerialization.toJson(
typeSystem, typeDefinition.typeName);
String typesAsJSON = TypesSerialization.toJson(typeDefinition);
System.out.println("typesAsJSON = " + typesAsJSON);
WebResource resource = service
......@@ -174,11 +172,6 @@ public class TypesJerseyResourceIT extends BaseResourceIT {
TypesUtil.createRequiredAttrDef("level", DataTypes.INT_TYPE));
typeDefinitions.add(fetlTypeDefinition);
typeSystem.defineTypes(
ImmutableList.<StructTypeDefinition>of(),
ImmutableList.of(fetlTypeDefinition),
ImmutableList.of(databaseTypeDefinition, tableTypeDefinition));
return typeDefinitions;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment