use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project caravan-rhyme by wcm-io-caravan.
the class RenderResourceStateTest method should_throw_runtime_exception_if_ResourceState_method_throws_exception.
@Test
public void should_throw_runtime_exception_if_ResourceState_method_throws_exception() {
NotImplementedException cause = new NotImplementedException("not implemented");
TestResourceWithOptionalState resourceImpl = new TestResourceWithOptionalState() {
@Override
public Optional<TestState> getState() {
throw cause;
}
};
Throwable ex = Assertions.catchThrowable(() -> render(resourceImpl));
assertThat(ex).isInstanceOf(NotImplementedException.class);
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project caravan-rhyme by wcm-io-caravan.
the class JaxRsAsyncHalResponseHandlerImplTest method respondWithError_should_resume_with_fatal_error_thrown_in_handler.
@Test
public void respondWithError_should_resume_with_fatal_error_thrown_in_handler() throws Exception {
NotImplementedException expectedEx = new NotImplementedException("request URI not availbable");
Mockito.when(uriInfo.getRequestUri()).thenThrow(expectedEx);
handler.respondWithError(new RuntimeException("foo"), uriInfo, asyncResponse, metrics);
Throwable t = verifyResumeHasBeenCalledWithFatalError();
assertThat(t).isSameAs(expectedEx);
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project caravan-rhyme by wcm-io-caravan.
the class JaxRsAsyncHalResponseHandlerImplTest method respondWith_should_resume_with_fatal_error_thrown_in_handler.
@Test
public void respondWith_should_resume_with_fatal_error_thrown_in_handler() throws Exception {
NotImplementedException expectedEx = new NotImplementedException("request URI not availbable");
Mockito.when(uriInfo.getRequestUri()).thenThrow(expectedEx);
LinkableResource resourceImpl = new LinkableTestResource() {
@Override
public Link createLink() {
return new Link(REQUEST_URL);
}
};
handler.respondWith(resourceImpl, uriInfo, asyncResponse, metrics);
Throwable t = verifyResumeHasBeenCalledWithFatalError();
assertThat(t).isSameAs(expectedEx);
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project platform by dashjoin.
the class UnionDatabase method getQueryEditor.
/**
* editor supports noop query and get initial query only
*/
@Override
public QueryEditorInternal getQueryEditor() {
return new QueryEditorInternal() {
@Override
public QueryResponse rename(RenameRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse distinct(DistinctRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse sort(SortRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse addColumn(AddColumnRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse removeColumn(RemoveColumnRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse setWhere(SetWhereRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse setGroupBy(SetWhereRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse moveColumn(MoveColumnRequest ac) throws Exception {
throw new NotImplementedException("not implemented");
}
@Override
public QueryResponse noop(QueryDatabase query) throws Exception {
AbstractDatabase config = services.getConfig().getDatabase("dj/config");
QueryResponse res = new QueryResponse();
res.database = query.database;
res.query = query.query;
QueryMeta info = new QueryMeta();
info.query = query.query;
res.data = query(info, null);
Set<String> keys = new HashSet<>();
for (Map<String, Object> row : res.data) keys.addAll(row.keySet());
res.joinOptions = Arrays.asList();
res.fieldNames = new ArrayList<>(keys);
if (res.fieldNames.remove("ID"))
res.fieldNames.add(0, "ID");
res.metadata = new ArrayList<>();
for (String field : res.fieldNames) {
QueryColumn qc = new QueryColumn();
qc.database = UnionDatabase.this.ID;
qc.col = Col.col(query.query, field);
Table schema = config.tables.get(query.query);
if (schema != null) {
Property property = schema.properties.get(field);
if (property != null) {
qc.columnID = property.ID;
if (property.pkpos != null)
qc.keyTable = query.query;
if (property.ref != null)
qc.keyTable = property.ref.split("/")[2];
}
}
res.metadata.add(qc);
}
return res;
}
@Override
public QueryResponse getInitialQuery(InitialQueryRequest ac) throws Exception {
QueryDatabase q = new QueryDatabase();
Table s = services.getConfig().getSchema(ac.table);
q.query = s.name;
q.database = s.parent;
return noop(q);
}
};
}
use of alluxio.shaded.client.org.apache.commons.lang3.NotImplementedException in project backend by CatalogueOfLife.
the class SectorSync method processTree.
private void processTree() {
final Set<String> blockedIds = decisions.values().stream().filter(ed -> ed.getMode().equals(EditorialDecision.Mode.BLOCK) && ed.getSubject().getId() != null).map(ed -> ed.getSubject().getId()).collect(Collectors.toSet());
try (SqlSession session = factory.openSession(false);
TreeCopyHandler treeHandler = new TreeCopyHandler(decisions, factory, nameIndex, user, sector, state)) {
NameUsageMapper um = session.getMapper(NameUsageMapper.class);
LOG.info("{} taxon tree {} to {}. Blocking {} nodes", sector.getMode(), sector.getSubject(), sector.getTarget(), blockedIds.size());
if (sector.getMode() == Sector.Mode.ATTACH) {
um.processTree(subjectDatasetKey, null, sector.getSubject().getId(), blockedIds, null, true, false).forEach(treeHandler);
} else if (sector.getMode() == Sector.Mode.UNION) {
LOG.info("Traverse taxon tree at {}, ignoring immediate children above rank {}. Blocking {} nodes", sector.getSubject().getId(), sector.getPlaceholderRank(), blockedIds.size());
// see https://github.com/CatalogueOfLife/clearinghouse-ui/issues/518
for (NameUsageBase child : um.children(DSID.of(subjectDatasetKey, sector.getSubject().getId()), sector.getPlaceholderRank())) {
if (blockedIds.contains(child.getId())) {
LOG.info("Skip blocked child {}", child);
continue;
}
if (child.isSynonym()) {
LOG.info("Add synonym child {}", child);
treeHandler.accept(child);
} else {
LOG.info("Traverse child {}", child);
um.processTree(subjectDatasetKey, null, child.getId(), blockedIds, null, true, false).forEach(treeHandler);
}
treeHandler.reset();
}
} else {
throw new NotImplementedException("Only attach and union sectors are implemented");
}
LOG.info("Sync name & taxon relations from sector {}", sectorKey);
treeHandler.copyRelations();
// copy handler stats to metrics
state.setAppliedDecisionCount(treeHandler.decisionCounter);
state.setIgnoredByReasonCount(Map.copyOf(treeHandler.ignoredCounter));
}
}
Aggregations