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"));
}
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"));
}
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"));
}