Search in sources :

Example 16 with MockNode

use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.

the class SimplePublicUrlServiceTest method testExternalTarget.

@Test
public void testExternalTarget() throws Exception {
    MockNode mockNode = new MockNode("node");
    mockNode.setProperty(PN_VANITY_URL, "/aperto");
    mockNode.setProperty(PN_LINK, "http://www.aperto.de");
    assertThat(_service.createTargetUrl(mockNode), equalTo("http://www.aperto.de"));
    assertThat(_service.createVanityUrl(mockNode), equalTo("http://www.demo-project.com/context/aperto"));
}
Also used : MockNode(info.magnolia.test.mock.jcr.MockNode) Test(org.junit.Test)

Example 17 with MockNode

use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.

the class SimplePublicUrlServiceTest method testInternalTargetWithConfiguredPrefix.

@Test
public void testInternalTargetWithConfiguredPrefix() throws Exception {
    MockNode mockNode = new MockNode("node");
    mockNode.setProperty(PN_VANITY_URL, "/aperto");
    mockNode.setProperty(PN_LINK, "123-456-789");
    _service.setTargetServerPrefix("http://www.aperto.de");
    assertThat(_service.createTargetUrl(mockNode), equalTo("http://www.aperto.de/internal/page.html"));
    assertThat(_service.createVanityUrl(mockNode), equalTo("http://www.aperto.de/aperto"));
}
Also used : MockNode(info.magnolia.test.mock.jcr.MockNode) Test(org.junit.Test)

Example 18 with MockNode

use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.

the class SimplePublicUrlServiceTest method testInternalTargetWithSlashEndingConfiguredPrefix.

@Test
public void testInternalTargetWithSlashEndingConfiguredPrefix() throws Exception {
    MockNode mockNode = new MockNode("node");
    mockNode.setProperty(PN_VANITY_URL, "/aperto");
    mockNode.setProperty(PN_LINK, "123-456-789");
    _service.setTargetServerPrefix("http://www.aperto.de/");
    assertThat(_service.createTargetUrl(mockNode), equalTo("http://www.aperto.de/internal/page.html"));
    assertThat(_service.createVanityUrl(mockNode), equalTo("http://www.aperto.de/aperto"));
}
Also used : MockNode(info.magnolia.test.mock.jcr.MockNode) Test(org.junit.Test)

Aggregations

MockNode (info.magnolia.test.mock.jcr.MockNode)18 Test (org.junit.Test)16 ModuleRegistry (info.magnolia.module.ModuleRegistry)1 HashMap (java.util.HashMap)1 Provider (javax.inject.Provider)1 Before (org.junit.Before)1