TaxonomyResourceProvider extends BaseResourceProvider implements ResourceProvider { @Override public Collection<String> createResources(Request request) throws InvalidQueryException, ResourceNotFoundException { throw new UnsupportedOperationException( "Creating multiple Taxonomies in a request is not currently supported"); } TaxonomyResourceProvider(AtlasTypeSystem typeSystem); @Override Result getResourceById(Request request); @Override Result getResources(Request request); @Override void createResource(Request request); @Override Collection<String> createResources(Request request); @Override void deleteResourceById(Request request); @Override void updateResourceById(Request request); static final String DEFAULT_TAXONOMY_NAME; static final String DEFAULT_TAXONOMY_DESCRIPTION; static final String NAMESPACE_ATTRIBUTE_NAME; static final String TAXONOMY_TERM_TYPE; static final String TAXONOMY_NS; }
@Test(expectedExceptions = UnsupportedOperationException.class) public void testCreateResources() throws Exception { AtlasTypeSystem typeSystem = createStrictMock(AtlasTypeSystem.class); QueryFactory queryFactory = createStrictMock(QueryFactory.class); replay(typeSystem, queryFactory); Map<String, Object> requestProperties = new HashMap<>(); requestProperties.put("name", "taxonomyName"); Request userRequest = new InstanceRequest(requestProperties); TaxonomyResourceProvider provider = new TestTaxonomyResourceProvider(typeSystem); provider.setQueryFactory(queryFactory); provider.createResources(userRequest); }