当前位置: 首页>>代码示例>>Java>>正文


Java OperationStatus.ERROR属性代码示例

本文整理汇总了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));
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:19,代码来源:FakeMetadataTest.java

示例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));
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:19,代码来源:FakeMetadataTest.java

示例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;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:39,代码来源:Mediator.java

示例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();
    }
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:14,代码来源:BulkTest.java

示例5: withError

public static StreamingResponse withError(JsonNodeFactory jsonNodeFactory, Error error) {
    StreamingResponse r = new StreamingResponse(jsonNodeFactory, OperationStatus.ERROR);
    r.getErrors().add(error);
    return r;
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:5,代码来源:StreamingResponse.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:6,代码来源:AssertTest.java

示例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);
}
 
开发者ID:lightblue-platform,项目名称:lightblue-core,代码行数:6,代码来源:AssertTest.java


注:本文中的com.redhat.lightblue.OperationStatus.ERROR属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。