• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LDP类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.trellisldp.vocabulary.LDP的典型用法代码示例。如果您正苦于以下问题:Java LDP类的具体用法?Java LDP怎么用?Java LDP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



LDP类属于org.trellisldp.vocabulary包,在下文中一共展示了LDP类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testPutLdpResourceContainer

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testPutLdpResourceContainer() {
    when(mockLdpRequest.getLink()).thenReturn(fromUri(LDP.Container.getIRIString()).rel("type").build());
    when(mockLdpRequest.getContentType()).thenReturn(TEXT_TURTLE);

    final File entity = new File(getClass().getResource("/simpleTriple.ttl").getFile());
    final PutHandler putHandler = new PutHandler(mockLdpRequest, entity, mockResourceService,
            mockIoService, mockBinaryService, null);

    final Response res = putHandler.setResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));

    verify(mockBinaryService, never()).setContent(any(IRI.class), any(InputStream.class));
    verify(mockIoService).read(any(InputStream.class), eq(baseUrl + "resource"), eq(TURTLE));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:20,代码来源:PutHandlerTest.java


示例2: checkCardinality

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
private static Predicate<Graph> checkCardinality(final IRI model) {
    return graph -> {
        final Map<IRI, Long> cardinality = graph.stream()
            .filter(triple -> propertiesWithUriRange.contains(triple.getPredicate()))
            .collect(groupingBy(Triple::getPredicate, counting()));

        if (LDP.IndirectContainer.equals(model)) {
            if (isNull(cardinality.get(LDP.insertedContentRelation)) || !hasMembershipProps(cardinality)) {
                return true;
            }
        } else if (LDP.DirectContainer.equals(model) && !hasMembershipProps(cardinality)) {
            return true;
        }

        return cardinality.entrySet().stream().map(Map.Entry::getValue).anyMatch(val -> val > 1);
    };
}
 
开发者ID:trellis-ldp-archive,项目名称:trellis-constraint-rules,代码行数:18,代码来源:LdpConstraints.java


示例3: testRdfToNonRDFSource

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testRdfToNonRDFSource() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.NonRDFSource);
    when(mockLdpRequest.getContentType()).thenReturn(TEXT_TURTLE);
    when(mockLdpRequest.getLink()).thenReturn(fromUri(LDP.NonRDFSource.getIRIString()).rel("type").build());

    final File entity = new File(getClass().getResource("/simpleTriple.ttl").getFile());
    final PutHandler putHandler = new PutHandler(mockLdpRequest, entity, mockResourceService,
            mockIoService, mockBinaryService, null);

    final Response res = putHandler.setResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:18,代码来源:PutHandlerTest.java


示例4: testOptionsLdpc

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testOptionsLdpc() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.IndirectContainer);
    final OptionsHandler optionsHandler = new OptionsHandler(mockRequest, mockResourceService, baseUrl);

    final Response res = optionsHandler.ldpOptions(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());

    final String acceptPost = res.getHeaderString(ACCEPT_POST);
    assertNotNull(acceptPost);
    assertTrue(acceptPost.contains(APPLICATION_LD_JSON));
    assertTrue(acceptPost.contains(APPLICATION_N_TRIPLES));
    assertTrue(acceptPost.contains(TEXT_TURTLE.split(";")[0]));

    assertEquals(APPLICATION_SPARQL_UPDATE, res.getHeaderString(ACCEPT_PATCH));

    final String allow = res.getHeaderString(ALLOW);
    assertNotNull(allow);
    assertTrue(allow.contains(GET));
    assertTrue(allow.contains(HEAD));
    assertTrue(allow.contains(OPTIONS));
    assertTrue(allow.contains(PUT));
    assertTrue(allow.contains(DELETE));
    assertTrue(allow.contains(PATCH));
    assertTrue(allow.contains(POST));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:27,代码来源:OptionsHandlerTest.java


示例5: testEntity

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testEntity() {
    final Triple triple = rdf.createTriple(identifier, RDFS.label, rdf.createLiteral("A label"));

    when(mockResource.stream(eq(Trellis.PreferUserManaged))).thenAnswer(x -> of(triple));
    when(mockLdpRequest.getPath()).thenReturn("resource");

    final PatchHandler patchHandler = new PatchHandler(mockLdpRequest, insert,
            mockResourceService, mockIoService, null);

    final Response res = patchHandler.updateResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());

    verify(mockIoService).update(any(Graph.class), eq(insert), eq(identifier.getIRIString()));

    verify(mockResourceService).put(eq(identifier), eq(LDP.RDFSource), any(Dataset.class));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:18,代码来源:PatchHandlerTest.java


示例6: testResourcePast

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = service.get(identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertEquals(LDP.Container, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getExtraLinkRelations().count());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged)
        .map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:26,代码来源:FileResourceServiceTest.java


示例7: testResourcePast

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = VersionedResource.find(file, identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertEquals(LDP.BasicContainer, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertFalse(res.getInbox().isPresent());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getTypes().size());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged).map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
 
开发者ID:trellis-ldp-archive,项目名称:trellis-rosid-file,代码行数:26,代码来源:LdpBasicContainerTest.java


示例8: testPutLdpResourceEmpty

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testPutLdpResourceEmpty() {
    final File entity = new File(getClass().getResource("/emptyData.txt").getFile());
    final PutHandler putHandler = new PutHandler(mockLdpRequest, entity, mockResourceService,
            mockIoService, mockBinaryService, null);

    final Response res = putHandler.setResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));

    verify(mockBinaryService, never()).setContent(any(IRI.class), any(InputStream.class));
    verify(mockIoService).read(any(InputStream.class), anyString(), any(RDFSyntax.class));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:17,代码来源:PutHandlerTest.java


示例9: setUp

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@BeforeEach
public void setUp() throws JMSException {
    initMocks(this);
    when(mockEvent.getTarget()).thenReturn(of(rdf.createIRI("trellis:repository/resource")));
    when(mockEvent.getAgents()).thenReturn(singleton(Trellis.AdministratorAgent));
    when(mockEvent.getCreated()).thenReturn(time);
    when(mockEvent.getIdentifier()).thenReturn(rdf.createIRI("urn:test"));
    when(mockEvent.getTypes()).thenReturn(singleton(AS.Update));
    when(mockEvent.getTargetTypes()).thenReturn(singleton(LDP.RDFSource));
    when(mockEvent.getInbox()).thenReturn(empty());

    when(mockConnection.createSession(anyBoolean(), eq(AUTO_ACKNOWLEDGE))).thenReturn(mockSession);
    when(mockSession.createQueue(eq(queueName))).thenReturn(mockQueue);
    when(mockSession.createTextMessage(anyString())).thenReturn(mockMessage);
    when(mockSession.createProducer(any(Queue.class))).thenReturn(mockProducer);

    doNothing().when(mockProducer).send(any(TextMessage.class));
}
 
开发者ID:trellis-ldp,项目名称:trellis-jms,代码行数:19,代码来源:JmsPublisherTest.java


示例10: testDefaultType2

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testDefaultType2() throws IOException {
    when(mockRequest.getContentType()).thenReturn("text/plain");

    final File entity = new File(getClass().getResource("/simpleData.txt").getFile());
    final PostHandler postHandler = new PostHandler(mockRequest, "newresource", entity,
            mockResourceService, mockIoService, mockBinaryService, null);

    final Response res = postHandler.createResource().build();
    assertEquals(CREATED, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));
    assertEquals(create(baseUrl + "newresource"), res.getLocation());
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:17,代码来源:PostHandlerTest.java


示例11: testResourcePast

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = VersionedResource.find(file, identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertEquals(LDP.BasicContainer, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getExtraLinkRelations().count());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged).map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:25,代码来源:LdpBasicContainerTest.java


示例12: quadHandler

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
private Consumer<Quad> quadHandler(final String prefix) {
    return quad -> {
        if (quad.getGraphName().equals(of(LDP.PreferContainment)) ||
                quad.getGraphName().equals(of(LDP.PreferMembership))) {
            hasContainerModificationQuads = true;
        } else {
            hasModificationQuads = true;
        }
        if (prefix.equals("D")) {
            patchDeleted.add(quad);
        } else if (prefix.equals("A") && !deleted.contains(quad)) {
            if (quad.getGraphName().filter(Trellis.PreferServerManaged::equals).isPresent() &&
                    quad.getPredicate().equals(type)) {
                interactionModel = (IRI) quad.getObject();
            }
            patchAdded.add(quad);
        }
    };
}
 
开发者ID:trellis-ldp-archive,项目名称:trellis-rosid-file,代码行数:20,代码来源:RDFPatch.java


示例13: testResourcePast

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = VersionedResource.find(file, identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertFalse(res.hasAcl());
    assertEquals(LDP.Container, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getExtraLinkRelations().count());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged).map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
 
开发者ID:trellis-ldp,项目名称:trellis-rosid,代码行数:26,代码来源:LdpContainerTest.java


示例14: testOptionsLDPNR

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testOptionsLDPNR() {
    final Response res = target(BINARY_PATH).request().options();

    assertEquals(NO_CONTENT, res.getStatusInfo());

    assertTrue(res.getAllowedMethods().contains("PATCH"));
    assertTrue(res.getAllowedMethods().contains("PUT"));
    assertTrue(res.getAllowedMethods().contains("DELETE"));
    assertTrue(res.getAllowedMethods().contains("GET"));
    assertTrue(res.getAllowedMethods().contains("HEAD"));
    assertTrue(res.getAllowedMethods().contains("OPTIONS"));
    assertFalse(res.getAllowedMethods().contains("POST"));

    assertEquals(APPLICATION_SPARQL_UPDATE, res.getHeaderString(ACCEPT_PATCH));
    assertNull(res.getHeaderString(ACCEPT_POST));

    assertNull(res.getHeaderString(MEMENTO_DATETIME));

    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:24,代码来源:AbstractLdpResourceTest.java


示例15: testOptionsLdpnr

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testOptionsLdpnr() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.NonRDFSource);

    final OptionsHandler optionsHandler = new OptionsHandler(mockRequest, mockResourceService, null);

    final Response res = optionsHandler.ldpOptions(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertEquals(APPLICATION_SPARQL_UPDATE, res.getHeaderString(ACCEPT_PATCH));

    final String allow = res.getHeaderString(ALLOW);
    assertTrue(allow.contains(GET));
    assertTrue(allow.contains(HEAD));
    assertTrue(allow.contains(OPTIONS));
    assertTrue(allow.contains(PUT));
    assertTrue(allow.contains(DELETE));
    assertTrue(allow.contains(PATCH));
    assertFalse(allow.contains(POST));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:20,代码来源:OptionsHandlerTest.java


示例16: testDefaultType4

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testDefaultType4() throws IOException {
    when(mockRequest.getContentType()).thenReturn("text/plain");
    when(mockRequest.getLink()).thenReturn(fromUri(LDP.Resource.getIRIString()).rel("type").build());

    final File entity = new File(getClass().getResource("/simpleData.txt").getFile());
    final PostHandler postHandler = new PostHandler(mockRequest, "newresource", entity,
            mockResourceService, mockIoService, mockBinaryService, null);

    final Response res = postHandler.createResource().build();
    assertEquals(CREATED, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));
    assertEquals(create(baseUrl + "newresource"), res.getLocation());
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:18,代码来源:PostHandlerTest.java


示例17: testResourcePast

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testResourcePast() {
    final Instant time = parse("2017-02-15T11:00:00Z");
    final Resource res = VersionedResource.find(file, identifier, time).get();
    assertEquals(identifier, res.getIdentifier());
    assertFalse(res.hasAcl());
    assertEquals(LDP.Container, res.getInteractionModel());
    assertFalse(res.getMembershipResource().isPresent());
    assertFalse(res.getMemberRelation().isPresent());
    assertFalse(res.getMemberOfRelation().isPresent());
    assertFalse(res.getInsertedContentRelation().isPresent());
    assertFalse(res.getBinary().isPresent());
    assertTrue(res.isMemento());
    assertFalse(res.getInbox().isPresent());
    assertEquals(parse("2017-02-15T10:05:00Z"), res.getModified());
    assertEquals(0L, res.getTypes().size());
    assertEquals(0L, res.stream().filter(TestUtils.isContainment.or(TestUtils.isMembership)).count());

    final List<Triple> triples = res.stream().filter(TestUtils.isUserManaged).map(Quad::asTriple).collect(toList());
    assertEquals(0L, triples.size());

    final List<VersionRange> mementos = res.getMementos();
    assertEquals(1L, mementos.size());
    assertEquals(parse("2017-02-15T10:05:00Z"), mementos.get(0).getFrom());
    assertEquals(parse("2017-02-15T11:15:00Z"), mementos.get(0).getUntil());
}
 
开发者ID:trellis-ldp-archive,项目名称:trellis-rosid-file,代码行数:27,代码来源:LdpContainerTest.java


示例18: testPreferRepresentation

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testPreferRepresentation() {
    when(mockLdpRequest.getPath()).thenReturn("resource");
    when(mockLdpRequest.getPrefer()).thenReturn(Prefer.valueOf("return=representation"));

    final PatchHandler patchHandler = new PatchHandler(mockLdpRequest, insert,
            mockResourceService, mockIoService, null);

    final Response res = patchHandler.updateResource(mockResource).build();

    assertEquals(OK, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertNull(res.getHeaderString(ACCEPT_POST));
    assertEquals("return=representation", res.getHeaderString(PREFERENCE_APPLIED));
    assertNull(res.getHeaderString(ACCEPT_RANGES));
    assertTrue(TEXT_TURTLE_TYPE.isCompatible(res.getMediaType()));
    assertTrue(res.getMediaType().isCompatible(TEXT_TURTLE_TYPE));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:21,代码来源:PatchHandlerTest.java


示例19: testOptionsLdprs

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testOptionsLdprs() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.RDFSource);
    final OptionsHandler optionsHandler = new OptionsHandler(mockRequest, mockResourceService, null);

    final Response res = optionsHandler.ldpOptions(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertNull(res.getHeaderString(ACCEPT_POST));
    assertEquals(APPLICATION_SPARQL_UPDATE, res.getHeaderString(ACCEPT_PATCH));

    final String allow = res.getHeaderString(ALLOW);
    assertTrue(allow.contains(GET));
    assertTrue(allow.contains(HEAD));
    assertTrue(allow.contains(OPTIONS));
    assertTrue(allow.contains(PUT));
    assertTrue(allow.contains(DELETE));
    assertTrue(allow.contains(PATCH));
    assertFalse(allow.contains(POST));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:20,代码来源:OptionsHandlerTest.java


示例20: testPutLdpBinaryResourceWithLdprLink

import org.trellisldp.vocabulary.LDP; //导入依赖的package包/类
@Test
public void testPutLdpBinaryResourceWithLdprLink() {
    when(mockResource.getInteractionModel()).thenReturn(LDP.NonRDFSource);
    when(mockLdpRequest.getLink()).thenReturn(fromUri(LDP.Resource.getIRIString()).rel("type").build());
    when(mockLdpRequest.getContentType()).thenReturn(TEXT_PLAIN);

    final File entity = new File(getClass().getResource("/simpleData.txt").getFile());
    final PutHandler putHandler = new PutHandler(mockLdpRequest, entity, mockResourceService,
            mockIoService, mockBinaryService, null);

    final Response res = putHandler.setResource(mockResource).build();
    assertEquals(NO_CONTENT, res.getStatusInfo());
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.Resource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.RDFSource)));
    assertFalse(res.getLinks().stream().anyMatch(hasType(LDP.Container)));
    assertTrue(res.getLinks().stream().anyMatch(hasType(LDP.NonRDFSource)));

    verify(mockBinaryService).setContent(any(IRI.class), any(InputStream.class), any());
    verify(mockIoService, never()).read(any(InputStream.class), anyString(), any(RDFSyntax.class));
}
 
开发者ID:trellis-ldp,项目名称:trellis,代码行数:21,代码来源:PutHandlerTest.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java ConfigurationException类代码示例发布时间:2022-05-23
下一篇:
Java Rythm类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap