use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.
the class DefaultPublicUrlServiceTest method testInternalTarget.
@Test
public void testInternalTarget() throws Exception {
MockNode mockNode = new MockNode("node");
mockNode.setProperty(PN_VANITY_URL, "/aperto");
mockNode.setProperty(PN_LINK, "123-456-789");
assertThat(_service.createTargetUrl(mockNode), equalTo("http://www.aperto.de/context/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 DefaultPublicUrlServiceTest method testInternalTargetWithConfiguredTargetContextPath.
@Test
public void testInternalTargetWithConfiguredTargetContextPath() throws Exception {
MockNode mockNode = new MockNode("node");
mockNode.setProperty(PN_VANITY_URL, "/aperto");
mockNode.setProperty(PN_LINK, "123-456-789");
_service.setTargetContextPath("/public");
assertThat(_service.createTargetUrl(mockNode), equalTo("http://www.aperto.de/context/page.html"));
assertThat(_service.createVanityUrl(mockNode), equalTo("http://www.aperto.de/public/aperto"));
}
use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.
the class VanityUrlServiceTest method testTargetUrlInternalWithAnchor.
@Test
public void testTargetUrlInternalWithAnchor() throws Exception {
MockNode mockNode = new MockNode("node");
mockNode.setProperty("link", TEST_UUID);
mockNode.setProperty("linkSuffix", "#anchor1");
assertThat(_service.createRedirectUrl(mockNode), equalTo("redirect:/internal/page.html#anchor1"));
assertThat(_service.createPreviewUrl(mockNode), equalTo("/internal/page.html#anchor1"));
}
use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.
the class VanityUrlServiceTest method testForwardWithAnchor.
@Test
public void testForwardWithAnchor() throws Exception {
MockNode mockNode = new MockNode("node");
mockNode.setProperty("link", TEST_UUID_FORWARD);
mockNode.setProperty("type", "forward");
mockNode.setProperty("linkSuffix", "#anchor1");
assertThat(_service.createRedirectUrl(mockNode), equalTo("forward:/internal/forward/page.html#anchor1"));
}
use of info.magnolia.test.mock.jcr.MockNode in project magnolia-vanity-url by aperto.
the class VanityUrlServiceTest method testForwardWithInvalidUrl.
@Test
public void testForwardWithInvalidUrl() throws Exception {
MockNode mockNode = new MockNode("node");
mockNode.setProperty("link", "http://www.aperto.de");
mockNode.setProperty("type", "forward");
assertThat(_service.createRedirectUrl(mockNode), equalTo(""));
}