本文整理汇总了Java中com.redhat.lightblue.OperationStatus.ERROR属性的典型用法代码示例。如果您正苦于以下问题:Java OperationStatus.ERROR属性的具体用法?Java OperationStatus.ERROR怎么用?Java OperationStatus.ERROR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.redhat.lightblue.OperationStatus
的用法示例。
在下文中一共展示了OperationStatus.ERROR属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testDependencies
@Test
public void testDependencies() {
String entityName = "fake";
String version1 = "1.0.0";
String version2 = "2.0.0";
FakeMetadata metadata = new FakeMetadata();
EntityInfo entityInfo = new EntityInfo(entityName);
metadata.setEntityInfo(entityInfo);
assertEquals(entityInfo, metadata.getEntityInfo(entityName));
Response dependencies = new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
metadata.setDependencies(entityName, version1, dependencies);
assertEquals(dependencies, metadata.getDependencies(entityName, version1));
assertNull(metadata.getDependencies(entityName, version2));
}
示例2: testAccess
@Test
public void testAccess() {
String entityName = "fake";
String version1 = "1.0.0";
String version2 = "2.0.0";
FakeMetadata metadata = new FakeMetadata();
EntityInfo entityInfo = new EntityInfo(entityName);
metadata.setEntityInfo(entityInfo);
assertEquals(entityInfo, metadata.getEntityInfo(entityName));
Response access = new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
metadata.setAccess(entityName, version1, access);
assertEquals(access, metadata.getAccess(entityName, version1));
assertNull(metadata.getAccess(entityName, version2));
}
示例3: _findAndStream
private StreamingResponse _findAndStream(FindRequest req, OperationContext ctx) {
StreamingResponse response = new StreamingResponse(factory.getNodeFactory(), OperationStatus.ERROR);
response.setEntity(ctx.getTopLevelEntityName(),ctx.getTopLevelEntityVersion());
CompositeMetadata md = ctx.getTopLevelEntityMetadata();
if (!md.getAccess().getFind().hasAccess(ctx.getCallerRoles())) {
ctx.setStatus(OperationStatus.ERROR);
LOGGER.debug("No access");
ctx.addError(Error.get(CrudConstants.ERR_NO_ACCESS, "find " + ctx.getTopLevelEntityName()));
} else if (checkQueryAccess(ctx, req.getQuery())) {
factory.getInterceptors().callInterceptors(InterceptPoint.PRE_MEDIATOR_FIND, ctx);
Finder finder;
if (ctx.isSimple()) {
LOGGER.debug("Simple entity");
finder = new SimpleFindImpl(md, factory);
} else {
LOGGER.debug("Composite entity");
finder = new CompositeFindImpl(md);
// This can be read from a configuration
((CompositeFindImpl) finder).setParallelism(9);
}
ctx.measure.begin("finder.find");
CRUDFindResponse result = finder.find(ctx, req.getCRUDFindRequest());
ctx.measure.end("finder.find");
if(!ctx.hasErrors()) {
ctx.setStatus(OperationStatus.COMPLETE);
response.documentStream=ctx.getDocumentStream();
if(ctx.isComputeCounts()) {
response.matchCount=result.getSize();
}
} else {
ctx.setStatus(OperationStatus.ERROR);
}
}
response.setStatus(ctx.getStatus());
response.getErrors().addAll(ctx.getErrors());
return response;
}
示例4: call
@Override
public Response call(FindRequest req) {
nested.incrementAndGet();
try {
LOGGER.debug("find: nested:"+nested+" waiting");
sem.acquire();
LOGGER.debug("find: nested:"+nested+" acquired");
return new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
} catch (Exception e) {
throw new RuntimeException(e);
} finally {
nested.decrementAndGet();
}
}
示例5: withError
public static StreamingResponse withError(JsonNodeFactory jsonNodeFactory, Error error) {
StreamingResponse r = new StreamingResponse(jsonNodeFactory, OperationStatus.ERROR);
r.getErrors().add(error);
return r;
}
示例6: testAssertNoErrors_fail
@Test(expected = MultipleFailureException.class)
public void testAssertNoErrors_fail() throws MultipleFailureException {
Response response = new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
response.getErrors().add(Error.get("fake error"));
assertNoErrors(response);
}
示例7: testAssertNoDataErrors_fail
@Test(expected = MultipleFailureException.class)
public void testAssertNoDataErrors_fail() throws MultipleFailureException {
Response response = new Response(JsonNodeFactory.instance, OperationStatus.ERROR);
response.getDataErrors().add(new DataError());
assertNoDataErrors(response);
}