Search in sources :

Example 6 with CreateResourceReferenceException

use of org.xwiki.resource.CreateResourceReferenceException in project xwiki-platform by xwiki.

the class ExtendedURLTest method withInvalidPrefix.

@Test
public void withInvalidPrefix() throws Exception {
    URL url = new URL("http://localhost:8080/some/path");
    try {
        new ExtendedURL(url, "/xwiki");
        fail("Should have thrown an exception here");
    } catch (CreateResourceReferenceException e) {
        assertEquals("URL Path [/some/path] doesn't start with [/xwiki]", e.getMessage());
    }
}
Also used : URL(java.net.URL) CreateResourceReferenceException(org.xwiki.resource.CreateResourceReferenceException) Test(org.junit.Test)

Example 7 with CreateResourceReferenceException

use of org.xwiki.resource.CreateResourceReferenceException in project xwiki-platform by xwiki.

the class ExtendedURLTest method invalidURL.

@Test
public void invalidURL() throws Exception {
    try {
        // Invalid URL since the space in the page name isn't encoded.
        new ExtendedURL(new URL("http://host/xwiki/bin/view/space/page name"), null);
        fail("Should have thrown an exception here");
    } catch (CreateResourceReferenceException expected) {
        assertEquals("Invalid URL [http://host/xwiki/bin/view/space/page name]", expected.getMessage());
    }
}
Also used : URL(java.net.URL) CreateResourceReferenceException(org.xwiki.resource.CreateResourceReferenceException) Test(org.junit.Test)

Aggregations

CreateResourceReferenceException (org.xwiki.resource.CreateResourceReferenceException)7 URL (java.net.URL)3 Test (org.junit.Test)2 URI (java.net.URI)1 URISyntaxException (java.net.URISyntaxException)1 ArrayList (java.util.ArrayList)1 ServletException (javax.servlet.ServletException)1 ComponentLookupException (org.xwiki.component.manager.ComponentLookupException)1 DefaultParameterizedType (org.xwiki.component.util.DefaultParameterizedType)1 EntityType (org.xwiki.model.EntityType)1 EntityReference (org.xwiki.model.reference.EntityReference)1 ResourceReferenceResolver (org.xwiki.resource.ResourceReferenceResolver)1 EntityResourceReference (org.xwiki.resource.entity.EntityResourceReference)1 TemporaryResourceReference (org.xwiki.resource.temporary.TemporaryResourceReference)1 ExtendedURL (org.xwiki.url.ExtendedURL)1 VfsResourceReference (org.xwiki.vfs.VfsResourceReference)1