You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jackrabbit.apache.org by ju...@apache.org on 2012/01/25 14:30:25 UTC
svn commit: r1235737 [5/7] - in /jackrabbit/branches/2.4: ./
examples/jackrabbit-firsthops/src/main/java/org/apache/jackrabbit/firsthops/
jackrabbit-api/src/main/java/org/apache/jackrabbit/api/
jackrabbit-api/src/main/java/org/apache/jackrabbit/api/jmx...
Modified: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/FilterRepositoryFactory.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/FilterRepositoryFactory.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/FilterRepositoryFactory.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/FilterRepositoryFactory.java Wed Jan 25 13:30:17 2012
@@ -1,95 +1,95 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.servlet;
-
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletContext;
-
-import org.apache.jackrabbit.commons.repository.RepositoryFactory;
-
-/**
- * Factory that looks up a repository from the context of a given filter.
- * <p>
- * The default name of the repository attribute is
- * "<code>javax.jcr.Repository</code>", but it can be changed by specifying
- * an init parameter with the same name:
- * <pre>
- * <filter>
- * <init-param>
- * <param-name>javax.jcr.Repository</param-name>
- * <param-value>my.repository.attribute</param-value>
- * <description>
- * This init parameter causes the repository to be looked up from
- * the "my.repository.attribute" attribute instead of the default
- * "javax.jcr.Repository".
- * </description>
- * </init-param>
- * </filter>
- * </pre>
- *
- * @since Apache Jackrabbit 1.6
- */
-public class FilterRepositoryFactory implements RepositoryFactory {
-
- /**
- * Configuration of the filter whose context contains the repository.
- */
- private final FilterConfig config;
-
- /**
- * Creates a factory for looking up a repository from the context
- * associated with the given filter configuration.
- *
- * @param config filter configuration
- */
- public FilterRepositoryFactory(FilterConfig config) {
- this.config = config;
- }
-
- /**
- * Looks up and returns a repository bound in the servlet context of
- * the given filter.
- *
- * @return repository from servlet context
- * @throws RepositoryException if the repository is not available
- */
- public Repository getRepository() throws RepositoryException {
- String name = config.getInitParameter(Repository.class.getName());
- if (name == null) {
- name = Repository.class.getName();
- }
-
- ServletContext context = config.getServletContext();
- Object repository = context.getAttribute(name);
- if (repository instanceof Repository) {
- return (Repository) repository;
- } else if (repository != null) {
- throw new RepositoryException(
- "Invalid repository: Attribute " + name
- + " in servlet context " + context.getServletContextName()
- + " is an instance of " + repository.getClass().getName());
- } else {
- throw new RepositoryException(
- "Repository not found: Attribute " + name
- + " does not exist in servlet context "
- + context.getServletContextName());
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.servlet;
+
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+
+import org.apache.jackrabbit.commons.repository.RepositoryFactory;
+
+/**
+ * Factory that looks up a repository from the context of a given filter.
+ * <p>
+ * The default name of the repository attribute is
+ * "<code>javax.jcr.Repository</code>", but it can be changed by specifying
+ * an init parameter with the same name:
+ * <pre>
+ * <filter>
+ * <init-param>
+ * <param-name>javax.jcr.Repository</param-name>
+ * <param-value>my.repository.attribute</param-value>
+ * <description>
+ * This init parameter causes the repository to be looked up from
+ * the "my.repository.attribute" attribute instead of the default
+ * "javax.jcr.Repository".
+ * </description>
+ * </init-param>
+ * </filter>
+ * </pre>
+ *
+ * @since Apache Jackrabbit 1.6
+ */
+public class FilterRepositoryFactory implements RepositoryFactory {
+
+ /**
+ * Configuration of the filter whose context contains the repository.
+ */
+ private final FilterConfig config;
+
+ /**
+ * Creates a factory for looking up a repository from the context
+ * associated with the given filter configuration.
+ *
+ * @param config filter configuration
+ */
+ public FilterRepositoryFactory(FilterConfig config) {
+ this.config = config;
+ }
+
+ /**
+ * Looks up and returns a repository bound in the servlet context of
+ * the given filter.
+ *
+ * @return repository from servlet context
+ * @throws RepositoryException if the repository is not available
+ */
+ public Repository getRepository() throws RepositoryException {
+ String name = config.getInitParameter(Repository.class.getName());
+ if (name == null) {
+ name = Repository.class.getName();
+ }
+
+ ServletContext context = config.getServletContext();
+ Object repository = context.getAttribute(name);
+ if (repository instanceof Repository) {
+ return (Repository) repository;
+ } else if (repository != null) {
+ throw new RepositoryException(
+ "Invalid repository: Attribute " + name
+ + " in servlet context " + context.getServletContextName()
+ + " is an instance of " + repository.getClass().getName());
+ } else {
+ throw new RepositoryException(
+ "Repository not found: Attribute " + name
+ + " does not exist in servlet context "
+ + context.getServletContextName());
+ }
+ }
+
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/FilterRepositoryFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/jackrabbit/StatisticsServlet.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/AbstractLoginFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/AbstractLoginFilter.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/AbstractLoginFilter.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/AbstractLoginFilter.java Wed Jan 25 13:30:17 2012
@@ -1,113 +1,113 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.servlet.login;
-
-import java.io.IOException;
-
-import javax.jcr.AccessDeniedException;
-import javax.jcr.Credentials;
-import javax.jcr.LoginException;
-import javax.jcr.NoSuchWorkspaceException;
-import javax.jcr.Node;
-import javax.jcr.Repository;
-import javax.jcr.RepositoryException;
-import javax.jcr.Session;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-import org.apache.jackrabbit.servlet.ServletRepository;
-
-/**
- *
- * @since Apache Jackrabbit 1.6
- */
-public abstract class AbstractLoginFilter implements Filter {
-
- private Repository repository;
-
- private String workspace;
-
- private String sessionAttribute;
-
- private String nodeAttribute;
-
- public void init(FilterConfig config) {
- repository = new ServletRepository(config);
- workspace = config.getInitParameter("workspace");
-
- sessionAttribute = config.getInitParameter(Session.class.getName());
- if (sessionAttribute == null) {
- sessionAttribute = Session.class.getName();
- }
-
- nodeAttribute = config.getInitParameter(Node.class.getName());
- if (nodeAttribute == null) {
- nodeAttribute = Node.class.getName();
- }
- }
-
- public void destroy() {
- }
-
- public void doFilter(
- ServletRequest request, ServletResponse response,
- FilterChain chain) throws IOException, ServletException {
- HttpServletRequest httpRequest = (HttpServletRequest) request;
- HttpServletResponse httpResponse = (HttpServletResponse) response;
- try {
- Credentials credentials = getCredentials(httpRequest);
- Session session = repository.login(credentials, workspace);
- try {
- request.setAttribute(sessionAttribute, session);
- request.setAttribute(nodeAttribute, session.getRootNode());
- chain.doFilter(request, response);
- if (session.hasPendingChanges()) {
- session.save();
- }
- } finally {
- session.logout();
- }
- } catch (ServletException e) {
- Throwable cause = e.getRootCause();
- if (cause instanceof AccessDeniedException) {
- httpResponse.sendError(
- HttpServletResponse.SC_FORBIDDEN, cause.getMessage());
- } else {
- throw e;
- }
- } catch (LoginException e) {
- httpResponse.sendError(
- HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
- } catch (NoSuchWorkspaceException e) {
- throw new ServletException(
- "Workspace " + workspace
- + " not found in the content repository", e);
- } catch (RepositoryException e) {
- throw new ServletException(
- "Unable to access the content repository", e);
- }
- }
-
- protected abstract Credentials getCredentials(HttpServletRequest request);
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.servlet.login;
+
+import java.io.IOException;
+
+import javax.jcr.AccessDeniedException;
+import javax.jcr.Credentials;
+import javax.jcr.LoginException;
+import javax.jcr.NoSuchWorkspaceException;
+import javax.jcr.Node;
+import javax.jcr.Repository;
+import javax.jcr.RepositoryException;
+import javax.jcr.Session;
+import javax.servlet.Filter;
+import javax.servlet.FilterChain;
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import javax.servlet.ServletRequest;
+import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.jackrabbit.servlet.ServletRepository;
+
+/**
+ *
+ * @since Apache Jackrabbit 1.6
+ */
+public abstract class AbstractLoginFilter implements Filter {
+
+ private Repository repository;
+
+ private String workspace;
+
+ private String sessionAttribute;
+
+ private String nodeAttribute;
+
+ public void init(FilterConfig config) {
+ repository = new ServletRepository(config);
+ workspace = config.getInitParameter("workspace");
+
+ sessionAttribute = config.getInitParameter(Session.class.getName());
+ if (sessionAttribute == null) {
+ sessionAttribute = Session.class.getName();
+ }
+
+ nodeAttribute = config.getInitParameter(Node.class.getName());
+ if (nodeAttribute == null) {
+ nodeAttribute = Node.class.getName();
+ }
+ }
+
+ public void destroy() {
+ }
+
+ public void doFilter(
+ ServletRequest request, ServletResponse response,
+ FilterChain chain) throws IOException, ServletException {
+ HttpServletRequest httpRequest = (HttpServletRequest) request;
+ HttpServletResponse httpResponse = (HttpServletResponse) response;
+ try {
+ Credentials credentials = getCredentials(httpRequest);
+ Session session = repository.login(credentials, workspace);
+ try {
+ request.setAttribute(sessionAttribute, session);
+ request.setAttribute(nodeAttribute, session.getRootNode());
+ chain.doFilter(request, response);
+ if (session.hasPendingChanges()) {
+ session.save();
+ }
+ } finally {
+ session.logout();
+ }
+ } catch (ServletException e) {
+ Throwable cause = e.getRootCause();
+ if (cause instanceof AccessDeniedException) {
+ httpResponse.sendError(
+ HttpServletResponse.SC_FORBIDDEN, cause.getMessage());
+ } else {
+ throw e;
+ }
+ } catch (LoginException e) {
+ httpResponse.sendError(
+ HttpServletResponse.SC_UNAUTHORIZED, e.getMessage());
+ } catch (NoSuchWorkspaceException e) {
+ throw new ServletException(
+ "Workspace " + workspace
+ + " not found in the content repository", e);
+ } catch (RepositoryException e) {
+ throw new ServletException(
+ "Unable to access the content repository", e);
+ }
+ }
+
+ protected abstract Credentials getCredentials(HttpServletRequest request);
+
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/AbstractLoginFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/BasicLoginFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/BasicLoginFilter.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/BasicLoginFilter.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/BasicLoginFilter.java Wed Jan 25 13:30:17 2012
@@ -1,38 +1,38 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.servlet.login;
-
-import javax.jcr.Credentials;
-import javax.jcr.SimpleCredentials;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- *
- * @since Apache Jackrabbit 1.6
- */
-public class BasicLoginFilter extends AbstractLoginFilter {
-
- protected Credentials getCredentials(HttpServletRequest request) {
- String authorization = request.getHeader("Authorization");
- if (authorization != null) {
- return new SimpleCredentials("TODO", "TODO".toCharArray());
- } else {
- return null;
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.servlet.login;
+
+import javax.jcr.Credentials;
+import javax.jcr.SimpleCredentials;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ *
+ * @since Apache Jackrabbit 1.6
+ */
+public class BasicLoginFilter extends AbstractLoginFilter {
+
+ protected Credentials getCredentials(HttpServletRequest request) {
+ String authorization = request.getHeader("Authorization");
+ if (authorization != null) {
+ return new SimpleCredentials("TODO", "TODO".toCharArray());
+ } else {
+ return null;
+ }
+ }
+
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/BasicLoginFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/ContainerLoginFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/ContainerLoginFilter.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/ContainerLoginFilter.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/ContainerLoginFilter.java Wed Jan 25 13:30:17 2012
@@ -1,64 +1,64 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.servlet.login;
-
-import javax.jcr.Credentials;
-import javax.jcr.SimpleCredentials;
-import javax.servlet.FilterConfig;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Login filter that relies on container authentication to provide the
- * authenticated username of a request. This username is associated with
- * a dummy password (empty by default, configurable through the init
- * parameter "password") in a {@link SimpleCredentials} object that is
- * used to log in to the underlying content repository. If no authenticated
- * user is found, then <code>null</code> credentials are used.
- * <p>
- * It is expected that the underlying repository is configured to simply
- * trust the given username. If the same repository is also made available
- * for direct logins, then a special secret password that allows logins with
- * any username could be configured just for this filter.
- *
- * @since Apache Jackrabbit 1.6
- */
-public class ContainerLoginFilter extends AbstractLoginFilter {
-
- /**
- * The dummy password used for the repository login. Empty by default.
- */
- private char[] password = new char[0];
-
- public void init(FilterConfig config) {
- super.init(config);
-
- String password = config.getInitParameter("password");
- if (password != null) {
- this.password = password.toCharArray();
- }
- }
-
- protected Credentials getCredentials(HttpServletRequest request) {
- String user = request.getRemoteUser();
- if (user != null) {
- return new SimpleCredentials(user, password);
- } else {
- return null;
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.servlet.login;
+
+import javax.jcr.Credentials;
+import javax.jcr.SimpleCredentials;
+import javax.servlet.FilterConfig;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Login filter that relies on container authentication to provide the
+ * authenticated username of a request. This username is associated with
+ * a dummy password (empty by default, configurable through the init
+ * parameter "password") in a {@link SimpleCredentials} object that is
+ * used to log in to the underlying content repository. If no authenticated
+ * user is found, then <code>null</code> credentials are used.
+ * <p>
+ * It is expected that the underlying repository is configured to simply
+ * trust the given username. If the same repository is also made available
+ * for direct logins, then a special secret password that allows logins with
+ * any username could be configured just for this filter.
+ *
+ * @since Apache Jackrabbit 1.6
+ */
+public class ContainerLoginFilter extends AbstractLoginFilter {
+
+ /**
+ * The dummy password used for the repository login. Empty by default.
+ */
+ private char[] password = new char[0];
+
+ public void init(FilterConfig config) {
+ super.init(config);
+
+ String password = config.getInitParameter("password");
+ if (password != null) {
+ this.password = password.toCharArray();
+ }
+ }
+
+ protected Credentials getCredentials(HttpServletRequest request) {
+ String user = request.getRemoteUser();
+ if (user != null) {
+ return new SimpleCredentials(user, password);
+ } else {
+ return null;
+ }
+ }
+
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/ContainerLoginFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/NullLoginFilter.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/NullLoginFilter.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/NullLoginFilter.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/NullLoginFilter.java Wed Jan 25 13:30:17 2012
@@ -1,43 +1,43 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.servlet.login;
-
-import javax.jcr.Credentials;
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * Login filter that always uses <code>null</code> credentials for logging in
- * to the content repository. This is useful for example for public web sites
- * where all repository access is performed using anonymous sessions. Another
- * use case for this login filter is when login information is made available
- * to the content repository through JAAS or some other out-of-band mechanism.
- *
- * @since Apache Jackrabbit 1.6
- */
-public class NullLoginFilter extends AbstractLoginFilter {
-
- /**
- * Always returns <code>null</code>.
- *
- * @param request ignored
- * @return <code>null</code> credentials
- */
- protected Credentials getCredentials(HttpServletRequest request) {
- return null;
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.servlet.login;
+
+import javax.jcr.Credentials;
+import javax.servlet.http.HttpServletRequest;
+
+/**
+ * Login filter that always uses <code>null</code> credentials for logging in
+ * to the content repository. This is useful for example for public web sites
+ * where all repository access is performed using anonymous sessions. Another
+ * use case for this login filter is when login information is made available
+ * to the content repository through JAAS or some other out-of-band mechanism.
+ *
+ * @since Apache Jackrabbit 1.6
+ */
+public class NullLoginFilter extends AbstractLoginFilter {
+
+ /**
+ * Always returns <code>null</code>.
+ *
+ * @param request ignored
+ * @return <code>null</code> credentials
+ */
+ protected Credentials getCredentials(HttpServletRequest request) {
+ return null;
+ }
+
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-servlet/src/main/java/org/apache/jackrabbit/servlet/login/NullLoginFilter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/NameTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/PathTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/SetValueInputStreamTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr-tests/src/main/java/org/apache/jackrabbit/test/api/util/InputStreamWrapper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/JcrLockManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/StaleProperty.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/lock/LockStateManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/nodetype/NodeTypeDefinitionProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/Checkpoint.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateActivity.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/CreateConfiguration.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/SetPrimaryType.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/TransientOperationVisitor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java Wed Jan 25 13:30:17 2012
@@ -1,110 +1,110 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.jcr2spi.operation;
-
-import org.apache.jackrabbit.jcr2spi.state.NodeState;
-import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
-import org.apache.jackrabbit.spi.NodeId;
-
-import javax.jcr.RepositoryException;
-import javax.jcr.AccessDeniedException;
-import javax.jcr.ItemExistsException;
-import javax.jcr.UnsupportedRepositoryOperationException;
-import javax.jcr.ImportUUIDBehavior;
-import javax.jcr.version.VersionException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import java.io.InputStream;
-
-/**
- * <code>WorkspaceImport</code>...
- */
-public class WorkspaceImport extends AbstractOperation {
-
- private final NodeState nodeState;
- private final InputStream xmlStream;
- private final int uuidBehaviour;
-
- private WorkspaceImport(NodeState nodeState, InputStream xmlStream, int uuidBehaviour) {
- if (nodeState == null || xmlStream == null) {
- throw new IllegalArgumentException();
- }
- this.nodeState = nodeState;
- this.xmlStream = xmlStream;
- this.uuidBehaviour = uuidBehaviour;
-
- // NOTE: affected-states only needed for transient modifications
- }
-
- //----------------------------------------------------------< Operation >---
- /**
- * @see Operation#accept(OperationVisitor)
- */
- public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
- assert status == STATUS_PENDING;
- visitor.visit(this);
- }
-
- /**
- * Invalidates the <code>NodeState</code> that has been updated and all
- * its descendants.
- *
- * @see Operation#persisted()
- */
- public void persisted() {
- assert status == STATUS_PENDING;
- status = STATUS_PERSISTED;
- NodeEntry entry;
- if (uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING ||
- uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) {
- // invalidate the complete tree
- entry = nodeState.getNodeEntry();
- while (entry.getParent() != null) {
- entry = entry.getParent();
- }
- entry.invalidate(true);
- } else {
- // import only added new items below the import target. therefore
- // recursive invalidation is not required. // TODO correct?
- nodeState.getNodeEntry().invalidate(false);
- }
- }
-
- //----------------------------------------< Access Operation Parameters >---
- public NodeId getNodeId() throws RepositoryException {
- return nodeState.getNodeId();
- }
-
- public InputStream getXmlStream() {
- return xmlStream;
- }
-
- public int getUuidBehaviour() {
- return uuidBehaviour;
- }
-
- //------------------------------------------------------------< Factory >---
- /**
- *
- * @param nodeState
- * @param xmlStream
- * @return
- */
- public static Operation create(NodeState nodeState, InputStream xmlStream, int uuidBehaviour) {
- return new WorkspaceImport(nodeState, xmlStream, uuidBehaviour);
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi.operation;
+
+import org.apache.jackrabbit.jcr2spi.state.NodeState;
+import org.apache.jackrabbit.jcr2spi.hierarchy.NodeEntry;
+import org.apache.jackrabbit.spi.NodeId;
+
+import javax.jcr.RepositoryException;
+import javax.jcr.AccessDeniedException;
+import javax.jcr.ItemExistsException;
+import javax.jcr.UnsupportedRepositoryOperationException;
+import javax.jcr.ImportUUIDBehavior;
+import javax.jcr.version.VersionException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import java.io.InputStream;
+
+/**
+ * <code>WorkspaceImport</code>...
+ */
+public class WorkspaceImport extends AbstractOperation {
+
+ private final NodeState nodeState;
+ private final InputStream xmlStream;
+ private final int uuidBehaviour;
+
+ private WorkspaceImport(NodeState nodeState, InputStream xmlStream, int uuidBehaviour) {
+ if (nodeState == null || xmlStream == null) {
+ throw new IllegalArgumentException();
+ }
+ this.nodeState = nodeState;
+ this.xmlStream = xmlStream;
+ this.uuidBehaviour = uuidBehaviour;
+
+ // NOTE: affected-states only needed for transient modifications
+ }
+
+ //----------------------------------------------------------< Operation >---
+ /**
+ * @see Operation#accept(OperationVisitor)
+ */
+ public void accept(OperationVisitor visitor) throws RepositoryException, ConstraintViolationException, AccessDeniedException, ItemExistsException, NoSuchNodeTypeException, UnsupportedRepositoryOperationException, VersionException {
+ assert status == STATUS_PENDING;
+ visitor.visit(this);
+ }
+
+ /**
+ * Invalidates the <code>NodeState</code> that has been updated and all
+ * its descendants.
+ *
+ * @see Operation#persisted()
+ */
+ public void persisted() {
+ assert status == STATUS_PENDING;
+ status = STATUS_PERSISTED;
+ NodeEntry entry;
+ if (uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REMOVE_EXISTING ||
+ uuidBehaviour == ImportUUIDBehavior.IMPORT_UUID_COLLISION_REPLACE_EXISTING) {
+ // invalidate the complete tree
+ entry = nodeState.getNodeEntry();
+ while (entry.getParent() != null) {
+ entry = entry.getParent();
+ }
+ entry.invalidate(true);
+ } else {
+ // import only added new items below the import target. therefore
+ // recursive invalidation is not required. // TODO correct?
+ nodeState.getNodeEntry().invalidate(false);
+ }
+ }
+
+ //----------------------------------------< Access Operation Parameters >---
+ public NodeId getNodeId() throws RepositoryException {
+ return nodeState.getNodeId();
+ }
+
+ public InputStream getXmlStream() {
+ return xmlStream;
+ }
+
+ public int getUuidBehaviour() {
+ return uuidBehaviour;
+ }
+
+ //------------------------------------------------------------< Factory >---
+ /**
+ *
+ * @param nodeState
+ * @param xmlStream
+ * @return
+ */
+ public static Operation create(NodeState nodeState, InputStream xmlStream, int uuidBehaviour) {
+ return new WorkspaceImport(nodeState, xmlStream, uuidBehaviour);
+ }
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/main/java/org/apache/jackrabbit/jcr2spi/operation/WorkspaceImport.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMixedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMixedTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMixedTest.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMixedTest.java Wed Jan 25 13:30:17 2012
@@ -1,45 +1,45 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.jcr2spi;
-
-import javax.jcr.ItemExistsException;
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <code>ReorderMixedTest</code>...
- */
-public class ReorderMixedTest extends ReorderTest {
-
- private static Logger log = LoggerFactory.getLogger(ReorderMixedTest.class);
-
- @Override
- protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
- child1 = testRootNode.addNode(nodeName2, testNodeType);
- child2 = testRootNode.addNode(nodeName4, testNodeType);
- child3 = testRootNode.addNode(nodeName2, testNodeType);
- child4 = testRootNode.addNode(nodeName2, testNodeType);
-
- testRootNode.save();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>ReorderMixedTest</code>...
+ */
+public class ReorderMixedTest extends ReorderTest {
+
+ private static Logger log = LoggerFactory.getLogger(ReorderMixedTest.class);
+
+ @Override
+ protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
+ child1 = testRootNode.addNode(nodeName2, testNodeType);
+ child2 = testRootNode.addNode(nodeName4, testNodeType);
+ child3 = testRootNode.addNode(nodeName2, testNodeType);
+ child4 = testRootNode.addNode(nodeName2, testNodeType);
+
+ testRootNode.save();
+ }
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMixedTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java Wed Jan 25 13:30:17 2012
@@ -1,257 +1,257 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.jcr2spi;
-
-import javax.jcr.ItemNotFoundException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-
-import org.apache.jackrabbit.spi.Path;
-import org.apache.jackrabbit.test.AbstractJCRTest;
-import org.apache.jackrabbit.test.NotExecutableException;
-import org.apache.jackrabbit.util.Text;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <code>ReorderMoveTest</code> testing various combinations of move/rename
- * and reorder with and without intermediate save, revert and other transient
- * modifications.
- */
-public class ReorderMoveTest extends AbstractJCRTest {
-
- private static Logger log = LoggerFactory.getLogger(ReorderMoveTest.class);
-
- private Node destParent;
- private Node srcParent;
- private String destPath;
-
- @Override
- protected void setUp() throws Exception {
- super.setUp();
- if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) {
- throw new NotExecutableException("Test node does not have orderable children.");
- }
-
- // create move-destination
- destParent = testRootNode.addNode(nodeName4, testNodeType);
- srcParent = testRootNode.addNode(nodeName2, testNodeType);
-
- destPath = destParent.getPath() + "/" + nodeName3;
- testRootNode.save();
- }
-
- @Override
- protected void tearDown() throws Exception {
- destParent = null;
- srcParent = null;
- super.tearDown();
- }
-
- private Node[] createOrderableChildren(boolean sns) throws RepositoryException {
- String[] childNames;
- if (sns) {
- childNames = new String[] {nodeName2, nodeName2, nodeName2, nodeName2};
- } else {
- childNames = new String[] {nodeName1, nodeName2, nodeName3, nodeName4};
- }
- Node[] children = new Node[4];
- children[0] = srcParent.addNode(childNames[0], testNodeType);
- children[1] = srcParent.addNode(childNames[1], testNodeType);
- children[2] = srcParent.addNode(childNames[2], testNodeType);
- children[3] = srcParent.addNode(childNames[3], testNodeType);
-
- testRootNode.save();
- return children;
- }
-
- private static String getRelPath(Node child) throws RepositoryException {
- if (child == null) {
- return null;
- }
- String path = child.getPath();
- return path.substring(path.lastIndexOf('/')+1);
- }
-
- private static void testOrder(Node parent, Node[] children) throws RepositoryException {
- NodeIterator it = parent.getNodes();
- int i = 0;
- while (it.hasNext()) {
- Node child = it.nextNode();
- assertTrue(child.isSame(children[i]));
- i++;
- }
- }
-
- /**
- * Move a orderable child node and reorder the remaining nodes.
- */
- public void testMoveAndReorder() throws RepositoryException {
- Node[] children = createOrderableChildren(false);
- String oldName = children[2].getName();
- // move
- testRootNode.getSession().move(children[2].getPath(), destPath);
- // reorder
- srcParent.orderBefore(getRelPath(children[1]), null);
- testOrder(srcParent, new Node[] {children[0], children[3], children[1]});
-
- testRootNode.save();
- testOrder(srcParent, new Node[] {children[0], children[3], children[1]});
- assertFalse(srcParent.hasNode(oldName));
- }
-
- /**
- * Move a orderable SNS-node and reorder the remaining nodes at source-parent.
- */
- public void testMoveAndReorderSNS() throws RepositoryException {
- Node[] children = createOrderableChildren(true);
- String snsName = children[0].getName();
-
- // move
- testRootNode.getSession().move(children[2].getPath(), destPath);
- testRootNode.getSession().move(children[1].getPath(), destPath);
-
- // reorder
- srcParent.orderBefore(getRelPath(children[0]), null);
- testOrder(srcParent, new Node[] {children[3], children[0]});
- assertTrue(srcParent.hasNode(snsName+"[1]"));
- assertTrue(srcParent.hasNode(snsName+"[2]"));
- assertFalse(srcParent.hasNode(snsName+"[3]"));
- assertFalse(srcParent.hasNode(snsName+"[4]"));
- assertFalse(srcParent.hasNode(snsName+"[5]"));
-
- testRootNode.save();
- testOrder(srcParent, new Node[] {children[3], children[0]});
- assertTrue(srcParent.hasNode(snsName+"[1]"));
- assertTrue(srcParent.hasNode(snsName+"[2]"));
- assertFalse(srcParent.hasNode(snsName+"[3]"));
- assertFalse(srcParent.hasNode(snsName+"[4]"));
- assertFalse(srcParent.hasNode(snsName+"[5]"));
-
- // check if move have been successful
- assertEquals(children[2].getPath(), destPath);
- assertTrue(children[2].getIndex() == Path.INDEX_DEFAULT);
- assertEquals(children[1].getPath(), destPath+"[2]");
- }
-
- /**
- * Reorder nodes and move one of the reordered siblings
- * away. Test the ordering of the remaining siblings.
- */
- public void testReorderAndMove() throws RepositoryException {
- Node[] children = createOrderableChildren(false);
-
- // reorder first
- srcParent.orderBefore(getRelPath(children[0]), null);
- srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[1]));
- // move
- testRootNode.getSession().move(children[3].getPath(), destPath);
-
- testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
-
- testRootNode.save();
- testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
- }
-
- /**
- * Reorder same-name-sibling nodes and move one of the reordered siblings
- * away. Test the ordering of the remaining siblings.
- */
- public void testReorderAndMoveSNS() throws RepositoryException {
- Node[] children = createOrderableChildren(true);
-
- // reorder first
- srcParent.orderBefore(getRelPath(children[0]), null);
- srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[1]));
- // move
- testRootNode.getSession().move(children[3].getPath(), destPath);
-
- testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
-
- testRootNode.save();
- testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
- }
-
- /**
- * Any attempt reorder a moved node at its original position must fail.
- */
- public void testReorderMovedNode() throws RepositoryException {
- Node[] children = createOrderableChildren(false);
-
- String relPath = getRelPath(children[2]);
- testRootNode.getSession().move(children[2].getPath(), destPath);
-
- try {
- srcParent.orderBefore(relPath, null);
- fail("Reordering a child node that has been moved away must fail.");
- } catch (ItemNotFoundException e) {
- // ok
- }
- }
-
- /**
- * Move a SNS-node and reorder its original siblings afterwards.
- * Test if reverting the changes results in the original ordering and
- * hierarchy.
- */
- public void testRevertMoveAndReorderSNS() throws RepositoryException {
- Node[] children = createOrderableChildren(true);
- // move then reorder
- testRootNode.getSession().move(children[2].getPath(), destPath);
- srcParent.orderBefore(getRelPath(children[1]), null);
- srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[0]));
-
- testRootNode.refresh(false);
- testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
- assertFalse(destParent.hasNode(Text.getName(destPath)));
- }
-
- /**
- * Move a SNS-node, that got its siblings reordered before.
- * Test if reverting the changes results in the original ordering and
- * hierarchy.
- */
- public void testRevertReorderAndMoveSNS() throws RepositoryException {
- Node[] children = createOrderableChildren(true);
- // reorder then move
- srcParent.orderBefore(getRelPath(children[1]), null);
- srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[2]));
- srcParent.getSession().move(children[2].getPath(), destPath);
-
- testRootNode.refresh(false);
- testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
- assertFalse(destParent.hasNode(Text.getName(destPath)));
- }
-
- /**
- * Move a SNS-node, that has been reordered before.
- * Test if reverting the changes results in the original ordering and
- * hierarchy.
- */
- public void testRevertMoveReorderedSNS() throws RepositoryException {
- Node[] children = createOrderableChildren(true);
- // reorder then move
- srcParent.orderBefore(getRelPath(children[1]), null);
- srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[2]));
- srcParent.getSession().move(children[1].getPath(), destPath);
-
- testRootNode.refresh(false);
- testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
- assertFalse(destParent.hasNode(Text.getName(destPath)));
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import javax.jcr.ItemNotFoundException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+
+import org.apache.jackrabbit.spi.Path;
+import org.apache.jackrabbit.test.AbstractJCRTest;
+import org.apache.jackrabbit.test.NotExecutableException;
+import org.apache.jackrabbit.util.Text;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>ReorderMoveTest</code> testing various combinations of move/rename
+ * and reorder with and without intermediate save, revert and other transient
+ * modifications.
+ */
+public class ReorderMoveTest extends AbstractJCRTest {
+
+ private static Logger log = LoggerFactory.getLogger(ReorderMoveTest.class);
+
+ private Node destParent;
+ private Node srcParent;
+ private String destPath;
+
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ if (!testRootNode.getPrimaryNodeType().hasOrderableChildNodes()) {
+ throw new NotExecutableException("Test node does not have orderable children.");
+ }
+
+ // create move-destination
+ destParent = testRootNode.addNode(nodeName4, testNodeType);
+ srcParent = testRootNode.addNode(nodeName2, testNodeType);
+
+ destPath = destParent.getPath() + "/" + nodeName3;
+ testRootNode.save();
+ }
+
+ @Override
+ protected void tearDown() throws Exception {
+ destParent = null;
+ srcParent = null;
+ super.tearDown();
+ }
+
+ private Node[] createOrderableChildren(boolean sns) throws RepositoryException {
+ String[] childNames;
+ if (sns) {
+ childNames = new String[] {nodeName2, nodeName2, nodeName2, nodeName2};
+ } else {
+ childNames = new String[] {nodeName1, nodeName2, nodeName3, nodeName4};
+ }
+ Node[] children = new Node[4];
+ children[0] = srcParent.addNode(childNames[0], testNodeType);
+ children[1] = srcParent.addNode(childNames[1], testNodeType);
+ children[2] = srcParent.addNode(childNames[2], testNodeType);
+ children[3] = srcParent.addNode(childNames[3], testNodeType);
+
+ testRootNode.save();
+ return children;
+ }
+
+ private static String getRelPath(Node child) throws RepositoryException {
+ if (child == null) {
+ return null;
+ }
+ String path = child.getPath();
+ return path.substring(path.lastIndexOf('/')+1);
+ }
+
+ private static void testOrder(Node parent, Node[] children) throws RepositoryException {
+ NodeIterator it = parent.getNodes();
+ int i = 0;
+ while (it.hasNext()) {
+ Node child = it.nextNode();
+ assertTrue(child.isSame(children[i]));
+ i++;
+ }
+ }
+
+ /**
+ * Move a orderable child node and reorder the remaining nodes.
+ */
+ public void testMoveAndReorder() throws RepositoryException {
+ Node[] children = createOrderableChildren(false);
+ String oldName = children[2].getName();
+ // move
+ testRootNode.getSession().move(children[2].getPath(), destPath);
+ // reorder
+ srcParent.orderBefore(getRelPath(children[1]), null);
+ testOrder(srcParent, new Node[] {children[0], children[3], children[1]});
+
+ testRootNode.save();
+ testOrder(srcParent, new Node[] {children[0], children[3], children[1]});
+ assertFalse(srcParent.hasNode(oldName));
+ }
+
+ /**
+ * Move a orderable SNS-node and reorder the remaining nodes at source-parent.
+ */
+ public void testMoveAndReorderSNS() throws RepositoryException {
+ Node[] children = createOrderableChildren(true);
+ String snsName = children[0].getName();
+
+ // move
+ testRootNode.getSession().move(children[2].getPath(), destPath);
+ testRootNode.getSession().move(children[1].getPath(), destPath);
+
+ // reorder
+ srcParent.orderBefore(getRelPath(children[0]), null);
+ testOrder(srcParent, new Node[] {children[3], children[0]});
+ assertTrue(srcParent.hasNode(snsName+"[1]"));
+ assertTrue(srcParent.hasNode(snsName+"[2]"));
+ assertFalse(srcParent.hasNode(snsName+"[3]"));
+ assertFalse(srcParent.hasNode(snsName+"[4]"));
+ assertFalse(srcParent.hasNode(snsName+"[5]"));
+
+ testRootNode.save();
+ testOrder(srcParent, new Node[] {children[3], children[0]});
+ assertTrue(srcParent.hasNode(snsName+"[1]"));
+ assertTrue(srcParent.hasNode(snsName+"[2]"));
+ assertFalse(srcParent.hasNode(snsName+"[3]"));
+ assertFalse(srcParent.hasNode(snsName+"[4]"));
+ assertFalse(srcParent.hasNode(snsName+"[5]"));
+
+ // check if move have been successful
+ assertEquals(children[2].getPath(), destPath);
+ assertTrue(children[2].getIndex() == Path.INDEX_DEFAULT);
+ assertEquals(children[1].getPath(), destPath+"[2]");
+ }
+
+ /**
+ * Reorder nodes and move one of the reordered siblings
+ * away. Test the ordering of the remaining siblings.
+ */
+ public void testReorderAndMove() throws RepositoryException {
+ Node[] children = createOrderableChildren(false);
+
+ // reorder first
+ srcParent.orderBefore(getRelPath(children[0]), null);
+ srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[1]));
+ // move
+ testRootNode.getSession().move(children[3].getPath(), destPath);
+
+ testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
+
+ testRootNode.save();
+ testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
+ }
+
+ /**
+ * Reorder same-name-sibling nodes and move one of the reordered siblings
+ * away. Test the ordering of the remaining siblings.
+ */
+ public void testReorderAndMoveSNS() throws RepositoryException {
+ Node[] children = createOrderableChildren(true);
+
+ // reorder first
+ srcParent.orderBefore(getRelPath(children[0]), null);
+ srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[1]));
+ // move
+ testRootNode.getSession().move(children[3].getPath(), destPath);
+
+ testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
+
+ testRootNode.save();
+ testOrder(srcParent, new Node[] {children[1], children[2], children[0]});
+ }
+
+ /**
+ * Any attempt reorder a moved node at its original position must fail.
+ */
+ public void testReorderMovedNode() throws RepositoryException {
+ Node[] children = createOrderableChildren(false);
+
+ String relPath = getRelPath(children[2]);
+ testRootNode.getSession().move(children[2].getPath(), destPath);
+
+ try {
+ srcParent.orderBefore(relPath, null);
+ fail("Reordering a child node that has been moved away must fail.");
+ } catch (ItemNotFoundException e) {
+ // ok
+ }
+ }
+
+ /**
+ * Move a SNS-node and reorder its original siblings afterwards.
+ * Test if reverting the changes results in the original ordering and
+ * hierarchy.
+ */
+ public void testRevertMoveAndReorderSNS() throws RepositoryException {
+ Node[] children = createOrderableChildren(true);
+ // move then reorder
+ testRootNode.getSession().move(children[2].getPath(), destPath);
+ srcParent.orderBefore(getRelPath(children[1]), null);
+ srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[0]));
+
+ testRootNode.refresh(false);
+ testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
+ assertFalse(destParent.hasNode(Text.getName(destPath)));
+ }
+
+ /**
+ * Move a SNS-node, that got its siblings reordered before.
+ * Test if reverting the changes results in the original ordering and
+ * hierarchy.
+ */
+ public void testRevertReorderAndMoveSNS() throws RepositoryException {
+ Node[] children = createOrderableChildren(true);
+ // reorder then move
+ srcParent.orderBefore(getRelPath(children[1]), null);
+ srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[2]));
+ srcParent.getSession().move(children[2].getPath(), destPath);
+
+ testRootNode.refresh(false);
+ testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
+ assertFalse(destParent.hasNode(Text.getName(destPath)));
+ }
+
+ /**
+ * Move a SNS-node, that has been reordered before.
+ * Test if reverting the changes results in the original ordering and
+ * hierarchy.
+ */
+ public void testRevertMoveReorderedSNS() throws RepositoryException {
+ Node[] children = createOrderableChildren(true);
+ // reorder then move
+ srcParent.orderBefore(getRelPath(children[1]), null);
+ srcParent.orderBefore(getRelPath(children[3]), getRelPath(children[2]));
+ srcParent.getSession().move(children[1].getPath(), destPath);
+
+ testRootNode.refresh(false);
+ testOrder(srcParent, new Node[] {children[0], children[1], children[2], children[3]});
+ assertFalse(destParent.hasNode(Text.getName(destPath)));
+ }
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderMoveTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java Wed Jan 25 13:30:17 2012
@@ -1,64 +1,64 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.jcr2spi;
-
-import javax.jcr.ItemExistsException;
-import javax.jcr.Node;
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <code>ReorderNewAndSavedTest</code>...
- */
-public class ReorderNewAndSavedTest extends ReorderTest {
-
- private static Logger log = LoggerFactory.getLogger(ReorderNewAndSavedTest.class);
-
- @Override
- protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
- child1 = testRootNode.addNode(nodeName1, testNodeType);
- child2 = testRootNode.addNode(nodeName2, testNodeType);
- testRootNode.save();
-
- child3 = testRootNode.addNode(nodeName3, testNodeType);
- child4 = testRootNode.addNode(nodeName4, testNodeType);
- }
-
- @Override
- public void testRevertReorder() throws RepositoryException {
- testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
- testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
-
- testRootNode.refresh(false);
- testOrder(testRootNode, new Node[] { child1, child2 });
- }
-
- @Override
- public void testRevertReorderToEnd() throws RepositoryException {
- testRootNode.orderBefore(getRelPath(child1), null);
- testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
-
- testRootNode.refresh(false);
- testOrder(testRootNode, new Node[] { child1, child2 });
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>ReorderNewAndSavedTest</code>...
+ */
+public class ReorderNewAndSavedTest extends ReorderTest {
+
+ private static Logger log = LoggerFactory.getLogger(ReorderNewAndSavedTest.class);
+
+ @Override
+ protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
+ child1 = testRootNode.addNode(nodeName1, testNodeType);
+ child2 = testRootNode.addNode(nodeName2, testNodeType);
+ testRootNode.save();
+
+ child3 = testRootNode.addNode(nodeName3, testNodeType);
+ child4 = testRootNode.addNode(nodeName4, testNodeType);
+ }
+
+ @Override
+ public void testRevertReorder() throws RepositoryException {
+ testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
+ testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
+
+ testRootNode.refresh(false);
+ testOrder(testRootNode, new Node[] { child1, child2 });
+ }
+
+ @Override
+ public void testRevertReorderToEnd() throws RepositoryException {
+ testRootNode.orderBefore(getRelPath(child1), null);
+ testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
+
+ testRootNode.refresh(false);
+ testOrder(testRootNode, new Node[] { child1, child2 });
+ }
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewAndSavedTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java?rev=1235737&r1=1235736&r2=1235737&view=diff
==============================================================================
--- jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java (original)
+++ jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java Wed Jan 25 13:30:17 2012
@@ -1,71 +1,71 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.jackrabbit.jcr2spi;
-
-import javax.jcr.ItemExistsException;
-import javax.jcr.Node;
-import javax.jcr.NodeIterator;
-import javax.jcr.RepositoryException;
-import javax.jcr.lock.LockException;
-import javax.jcr.nodetype.ConstraintViolationException;
-import javax.jcr.nodetype.NoSuchNodeTypeException;
-import javax.jcr.version.VersionException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * <code>ReorderNewSNSTest</code>...
- */
-public class ReorderNewSNSTest extends ReorderTest {
-
- private static Logger log = LoggerFactory.getLogger(ReorderNewSNSTest.class);
-
- @Override
- protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
- child1 = testRootNode.addNode(nodeName2, testNodeType);
- child2 = testRootNode.addNode(nodeName2, testNodeType);
- child3 = testRootNode.addNode(nodeName2, testNodeType);
- child4 = testRootNode.addNode(nodeName2, testNodeType);
- }
-
- @Override
- public void testRevertReorder() throws RepositoryException {
- testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
- testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
-
- // NEW child nodes -> must be removed upon refresh
- testRootNode.refresh(false);
- NodeIterator it = testRootNode.getNodes(nodeName2);
- if (it.hasNext()) {
- fail("Reverting creation and reordering of new SNSs must remove the children again.");
- }
- }
-
- @Override
- public void testRevertReorderToEnd() throws RepositoryException {
- testRootNode.orderBefore(getRelPath(child1), null);
- testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
-
- // NEW child nodes -> must be removed upon refresh
- testRootNode.refresh(false);
- NodeIterator it = testRootNode.getNodes(nodeName2);
- if (it.hasNext()) {
- fail("Reverting creation and reordering of new SNSs must remove the children again.");
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.jackrabbit.jcr2spi;
+
+import javax.jcr.ItemExistsException;
+import javax.jcr.Node;
+import javax.jcr.NodeIterator;
+import javax.jcr.RepositoryException;
+import javax.jcr.lock.LockException;
+import javax.jcr.nodetype.ConstraintViolationException;
+import javax.jcr.nodetype.NoSuchNodeTypeException;
+import javax.jcr.version.VersionException;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * <code>ReorderNewSNSTest</code>...
+ */
+public class ReorderNewSNSTest extends ReorderTest {
+
+ private static Logger log = LoggerFactory.getLogger(ReorderNewSNSTest.class);
+
+ @Override
+ protected void createOrderableChildren() throws RepositoryException, LockException, ConstraintViolationException, NoSuchNodeTypeException, ItemExistsException, VersionException {
+ child1 = testRootNode.addNode(nodeName2, testNodeType);
+ child2 = testRootNode.addNode(nodeName2, testNodeType);
+ child3 = testRootNode.addNode(nodeName2, testNodeType);
+ child4 = testRootNode.addNode(nodeName2, testNodeType);
+ }
+
+ @Override
+ public void testRevertReorder() throws RepositoryException {
+ testRootNode.orderBefore(getRelPath(child4), getRelPath(child2));
+ testOrder(testRootNode, new Node[] { child1, child4, child2, child3});
+
+ // NEW child nodes -> must be removed upon refresh
+ testRootNode.refresh(false);
+ NodeIterator it = testRootNode.getNodes(nodeName2);
+ if (it.hasNext()) {
+ fail("Reverting creation and reordering of new SNSs must remove the children again.");
+ }
+ }
+
+ @Override
+ public void testRevertReorderToEnd() throws RepositoryException {
+ testRootNode.orderBefore(getRelPath(child1), null);
+ testOrder(testRootNode, new Node[] { child2, child3, child4, child1});
+
+ // NEW child nodes -> must be removed upon refresh
+ testRootNode.refresh(false);
+ NodeIterator it = testRootNode.getNodes(nodeName2);
+ if (it.hasNext()) {
+ fail("Reverting creation and reordering of new SNSs must remove the children again.");
+ }
+ }
+}
Propchange: jackrabbit/branches/2.4/jackrabbit-jcr2spi/src/test/java/org/apache/jackrabbit/jcr2spi/ReorderNewSNSTest.java
------------------------------------------------------------------------------
svn:eol-style = native