/** * @see info.magnolia.repository.Provider#unregisterNamespace(java.lang.String, javax.jcr.Workspace) */ @Override public void unregisterNamespace(String prefix, Workspace workspace) throws RepositoryException { workspace.getNamespaceRegistry().unregisterNamespace(prefix); }
/** {@inheritDoc} */ public void unregisterNamespace(String prefix) throws RepositoryException, RemoteException { try { registry.unregisterNamespace(prefix); } catch (RepositoryException ex) { throw getRepositoryException(ex); } }
public void execute() throws Exception { getDelegate().unregisterNamespace(prefix); } });
public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { session.getAccessManager().checkRepositoryPermission(Permission.NAMESPACE_MNGMT); nsRegistry.unregisterNamespace(prefix); }
public void unregisterNamespace(String prefix) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { session.getAccessManager().checkRepositoryPermission(Permission.NAMESPACE_MNGMT); nsRegistry.unregisterNamespace(prefix); }
protected void tearDown() throws Exception { try { if (Arrays.asList(nsp.getPrefixes()).contains(namespacePrefix)) { nsp.unregisterNamespace(namespacePrefix); } } catch (NamespaceException e) { log.println("Unable to unregister name space with prefix " + namespacePrefix + ": " + e.toString()); } finally { nsp = null; super.tearDown(); } }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringSvPrefix() throws Exception { registry.unregisterNamespace("sv"); }
/** * {@inheritDoc} */ public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { Session session = getSessionInfoImpl(sessionInfo).getSession(); NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry(); nsReg.unregisterNamespace(nsReg.getPrefix(uri)); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringBlankPrefix() throws Exception { registry.unregisterNamespace(""); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringModePrefix() throws Exception { registry.unregisterNamespace("mode"); }
/** * {@inheritDoc} */ public void unregisterNamespace(SessionInfo sessionInfo, String uri) throws NamespaceException, UnsupportedRepositoryOperationException, AccessDeniedException, RepositoryException { Session session = getSessionInfoImpl(sessionInfo).getSession(); NamespaceRegistry nsReg = session.getWorkspace().getNamespaceRegistry(); nsReg.unregisterNamespace(nsReg.getPrefix(uri)); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringNtPrefix() throws Exception { registry.unregisterNamespace("nt"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringMixPrefix() throws Exception { registry.unregisterNamespace("mix"); }
@Test( expected = IllegalArgumentException.class ) public void shouldNotAllowUnregisteringNullPrefix() throws Exception { registry.unregisterNamespace(null); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringXmlPrefix() throws Exception { registry.unregisterNamespace("xml"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringJcrPrefix() throws Exception { registry.unregisterNamespace("jcr"); }
@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringPrefixThatIsNotUsed() throws Exception { String prefix = "bar"; assertThatNamespacePrefixIsNotRegistered(prefix); registry.unregisterNamespace(prefix); }
@Override @After public void afterEach() throws Exception { // Unregister all of the namespaces ... for (String existingPrefix : registry.getPrefixes()) { try { registry.unregisterNamespace(existingPrefix); // Make sure the prefix is not in the list of built-ins ... assertThat(JcrNamespaceRegistry.STANDARD_BUILT_IN_PREFIXES.contains(existingPrefix), is(false)); } catch (NamespaceException e) { // built in namespace ... } } }
private void testRegisterNamespace( Session session ) throws Exception { String unusedPrefix = session.getUserID(); session.getWorkspace().getNamespaceRegistry().registerNamespace(unusedPrefix, unusedPrefix); session.getWorkspace().getNamespaceRegistry().unregisterNamespace(unusedPrefix); }
@Test public void testNamespaceRegistry() throws RepositoryException { NamespaceRegistry nsReg = getAdminSession().getWorkspace().getNamespaceRegistry(); assertFalse(asList(nsReg.getPrefixes()).contains("foo")); assertFalse(asList(nsReg.getURIs()).contains("file:///foo")); nsReg.registerNamespace("foo", "file:///foo"); assertTrue(asList(nsReg.getPrefixes()).contains("foo")); assertTrue(asList(nsReg.getURIs()).contains("file:///foo")); nsReg.unregisterNamespace("foo"); assertFalse(asList(nsReg.getPrefixes()).contains("foo")); assertFalse(asList(nsReg.getURIs()).contains("file:///foo")); }