/** * Forwards the method call to the underlying session. */ public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException { session.setNamespacePrefix(prefix, uri); }
public void defineNamespacePrefixes(Session session) throws RepositoryException { session.setNamespacePrefix("test2", "http://sling.apache.org/test/two"); }
@Override default void setNamespacePrefix(final String prefix, final String uri) throws NamespaceException, RepositoryException { unwrapSession().setNamespacePrefix(prefix, uri); }
/** * Set namespace prefix. */ public void setNamespacePrefix(String arg0, String arg1) throws NamespaceException, RepositoryException { getSession().setNamespacePrefix(arg0, arg1); }
/** * Set namespace prefix. */ public void setNamespacePrefix(String arg0, String arg1) throws NamespaceException, RepositoryException { getSession().setNamespacePrefix(arg0, arg1); }
/** {@inheritDoc} */ public void setNamespacePrefix(String prefix, String uri) throws RepositoryException, RemoteException { try { session.setNamespacePrefix(prefix, uri); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
@Override public void setNamespacePrefix( String string, String string1 ) throws NamespaceException, RepositoryException { session().setNamespacePrefix(string, string1); }
@Override public void setNamespacePrefix(String prefix, String uri) throws NamespaceException, RepositoryException { getWrappedSession().setNamespacePrefix(prefix, uri); }
public void setNamespacePrefix(String prefix, String uri) throws RepositoryException { getDelegate().setNamespacePrefix(prefix, uri); }
public void setNamespacePrefix(String s, String s2) throws RepositoryException { commit(); getSession().setNamespacePrefix(s, s2); }
/** * Tests that Session.getNamespaceURI() returns according the session scoped * mapping */ public void testGetNamespaceURI() throws RepositoryException { String testPrefix = getUnusedPrefix(); // remap the jcr uri session.setNamespacePrefix(testPrefix, NS_JCR_URI); String uri = session.getNamespaceURI(testPrefix); assertEquals("Session.getNamespaceURI does not return the correct value.", NS_JCR_URI, uri); }
/** * Tests that Session.getNamespacePrefix returns the session scoped * mapping. */ public void testGetNamespacePrefix() throws RepositoryException { String testPrefix = getUnusedPrefix(); // remap the jcr uri session.setNamespacePrefix(testPrefix, NS_JCR_URI); String prefix = session.getNamespacePrefix(NS_JCR_URI); assertEquals("Session.getNamespacePrefix does not return the correct value.", testPrefix, prefix); }
@Test public void expandedName() throws RepositoryException { Session session = getAdminSession(); session.setNamespacePrefix("foo", "http://example.com/"); session.getRootNode().addNode("{0} test"); session.save(); assertTrue(session.nodeExists("/{0} test")); }
@Override protected void setUp() throws Exception { super.setUp(); superuser.getWorkspace().getNamespaceRegistry().registerNamespace("qTest", "http://jackrabbit-oak-2.apache.org"); Node n = testRootNode.addNode("qTest:node").addNode("qTest:node2").addNode("qTest:node3"); n.setProperty("qTest:property", superuser.getValueFactory().createValue("stringValue")); n.setProperty("qTest:booleanProperty", superuser.getValueFactory().createValue(true)); n.setProperty("qTest:nameProperty", superuser.getValueFactory().createValue("qTest:nameValue", PropertyType.NAME)); superuser.save(); session = getHelper().getSuperuserSession(); session.setNamespacePrefix("my", "http://jackrabbit-oak-2.apache.org"); session.setNamespacePrefix("myRep", NamespaceConstants.NAMESPACE_REP); resultPath = testRootNode.getPath() + "/my:node/my:node2/my:node3"; }
public void testRemappedNamespace() throws RepositoryException, NotExecutableException { String namespaceURI = "http://jackrabbit.apache.org/spi/test"; String defaultPrefix = "spiTest"; NamespaceRegistry nsReg = superuser.getWorkspace().getNamespaceRegistry(); try { nsReg.getPrefix(namespaceURI); } catch (RepositoryException e) { nsReg.registerNamespace(defaultPrefix, namespaceURI); } Node n = testRootNode.addNode("spiTest:node"); superuser.save(); for (int i = 0; i < 10; i++) { String prefix = defaultPrefix + i; superuser.setNamespacePrefix(prefix, namespaceURI); executeXPathQuery(superuser, testPath + "/" + prefix + ":node", new Node[]{n}); } }
@Test( expected = InvalidNodeTypeDefinitionException.class ) public void shouldNotAllowUnregisteringUsedPrimaryType() throws Exception { Session adminSession = null; try { adminSession = repository.login(); assertThat(adminSession.getNamespaceURI("car"), is("http://www.modeshape.org/examples/cars/1.0")); // Re-register one of the used namespaces in a session ... adminSession.setNamespacePrefix("cars", "http://www.modeshape.org/examples/cars/1.0"); JcrNodeTypeManager nodeTypeManager = (JcrNodeTypeManager)adminSession.getWorkspace().getNodeTypeManager(); nodeTypeManager.unregisterNodeTypes(Collections.singletonList("cars:Car")); } finally { if (adminSession != null) adminSession.logout(); } }
@Test public void sessionRemappedNamespace() throws RepositoryException { NamespaceRegistry nsReg = getAdminSession().getWorkspace().getNamespaceRegistry(); nsReg.registerNamespace("foo", "file:///foo"); getAdminSession().getRootNode().addNode("foo:test"); getAdminSession().save(); Session s = createAdminSession(); s.setNamespacePrefix("bar", "file:///foo"); assertTrue(s.getRootNode().hasNode("bar:test")); Node n = s.getRootNode().getNode("bar:test"); assertEquals("bar:test", n.getName()); s.logout(); getAdminSession().getRootNode().getNode("foo:test").remove(); getAdminSession().save(); nsReg.unregisterNamespace("foo"); }
@Test @FixFor( "MODE-1802" ) public void shouldIgnoreNamespaces() throws Exception { // Clean up the folder that the test creates FileUtil.delete("target/classes/test"); javax.jcr.Session session = session(); session.setNamespacePrefix("ms_test", "http://www.modeshape.org/test/"); Node root = session.getNode("/fs"); assertNotNull(root); root.addNode("ms_test:test", "nt:folder"); session.save(); assertNotNull(root.getNode("test")); }
private void testPath(String path) throws RepositoryException { RepositoryException exception = null; try { session.itemExists(path); } catch (RepositoryException e) { exception = e; } session.setNamespacePrefix("foo", "http://foo.bar"); try { session.itemExists(path); assertNull("path = " + path, exception); } catch (RepositoryException e) { assertNotNull("path = " + path, exception); } }
@Override protected void setUp() throws Exception { super.setUp(); superuser.getWorkspace().getNamespaceRegistry().registerNamespace("uTest", "http://jackrabbit-oak.apache.org"); Value value = superuser.getValueFactory().createValue("value"); nameValue = superuser.getValueFactory().createValue("uTest:value", PropertyType.NAME); for (String relPath : unmappedPaths) { user.setProperty(relPath, value); } superuser.save(); session = getHelper().getSuperuserSession(); session.setNamespacePrefix("my", "http://jackrabbit-oak.apache.org"); session.setNamespacePrefix("myRep", NamespaceConstants.NAMESPACE_REP); authorizable = getUserManager(session).getAuthorizable(user.getID()); }