You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by fm...@apache.org on 2008/04/14 10:28:31 UTC
svn commit: r647695 - in /incubator/sling/trunk:
api/src/main/java/org/apache/sling/api/servlets/
sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/
sling/servlet-resolver/src/test/ sling/servlet-resolver/src/test/java/
sling/servl...
Author: fmeschbe
Date: Mon Apr 14 01:28:23 2008
New Revision: 647695
URL: http://svn.apache.org/viewvc?rev=647695&view=rev
Log:
SLING-352 Apply modified patch provided by Vidar Ramdal
Added:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java
incubator/sling/trunk/sling/servlet-resolver/src/test/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/SlingServletResolverTest.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundle.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundleContext.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockComponentContext.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockRequestPathInfo.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockResourceResolver.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceReference.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceRegistration.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockSlingHttpServletRequest.java
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/
incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/MockServletResource.java
Modified:
incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockRequestPathInfo.java
incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockSlingHttpServletRequest.java
Added: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java (added)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/OptingServlet.java Mon Apr 14 01:28:23 2008
@@ -0,0 +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.sling.api.servlets;
+
+import javax.servlet.Servlet;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+
+/**
+ * The <code>OptingServlet</code> interface may be implemented by
+ * <code>Servlets</code> used by Sling which may choose to not handle all
+ * requests for which they would be selected based on their registration
+ * properties.
+ */
+public interface OptingServlet extends Servlet {
+
+ /**
+ * Examines the request, and return <code>true</code> if this servlet is
+ * willing to handle the request. If <code>false</code> is returned, the
+ * request will be ignored by this servlet, and may be handled by other
+ * servlets.
+ *
+ * @param request The request to examine
+ * @return <code>true</code> if this servlet will handle the request,
+ * <code>false</code> otherwise
+ */
+ public boolean accepts(SlingHttpServletRequest request);
+
+}
Modified: incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java?rev=647695&r1=647694&r2=647695&view=diff
==============================================================================
--- incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java (original)
+++ incubator/sling/trunk/api/src/main/java/org/apache/sling/api/servlets/ServletResolver.java Mon Apr 14 01:28:23 2008
@@ -42,14 +42,20 @@
* The returned servlet must be assumed to be initialized and ready to run.
* That is, the <code>init</code> nor the <code>destroy</code> methods
* must <em>NOT</em> be called on the returned servlet.
- *
+ * <p>
+ * This method must not return a <code>Servlet</code> instance
+ * implementing the {@link OptingServlet} interface and returning
+ * <code>false</code> when the
+ * {@link OptingServlet#accepts(SlingHttpServletRequest)} method is called.
+ *
* @param request The {@link SlingHttpServletRequest} object used to drive
* selection of the servlet.
* @return The servlet whose <code>service</code> method may be called to
* handle the request.
- * @throws org.apache.sling.api.SlingException Is thrown if an error occurrs while trying to find
- * an appropriate servlet to handle the request or if no servlet
- * could be resolved to handle the request.
+ * @throws org.apache.sling.api.SlingException Is thrown if an error occurrs
+ * while trying to find an appropriate servlet to handle the
+ * request or if no servlet could be resolved to handle the
+ * request.
*/
Servlet resolveServlet(SlingHttpServletRequest request);
Modified: incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java?rev=647695&r1=647694&r2=647695&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java (original)
+++ incubator/sling/trunk/sling/servlet-resolver/src/main/java/org/apache/sling/servlet/resolver/SlingServletResolver.java Mon Apr 14 01:28:23 2008
@@ -52,6 +52,7 @@
import org.apache.sling.api.scripting.SlingScriptResolver;
import org.apache.sling.api.servlets.HttpConstants;
import org.apache.sling.api.servlets.ServletResolver;
+import org.apache.sling.api.servlets.OptingServlet;
import org.apache.sling.core.servlets.AbstractServiceReferenceConfig;
import org.apache.sling.core.servlets.ErrorHandler;
import org.apache.sling.jcr.resource.JcrResourceUtil;
@@ -135,12 +136,12 @@
PathIterator pathIterator = new PathIterator(
request.getResource().getResourceType(),
request.getRequestPathInfo().getSelectorString(), path);
- servlet = getServlet(resolver, pathIterator, baseName);
+ servlet = getServlet(resolver, pathIterator, baseName, request);
// (2) GET/HEAD and according to resource type and selectors
if (servlet == null && !baseName.equals(request.getMethod())) {
pathIterator.reset();
- servlet = getServlet(resolver, pathIterator, request.getMethod());
+ servlet = getServlet(resolver, pathIterator, request.getMethod(), request);
}
// (3) Repeate steps (1) and (2) for the super type hierarchy
@@ -150,12 +151,12 @@
// (3a) default script name and according to resource type and selectors
pathIterator.reset(resourceSuperType);
- servlet = getServlet(resolver, pathIterator, baseName);
+ servlet = getServlet(resolver, pathIterator, baseName, request);
// (3b) GET/HEAD and according to resource type and selectors
if (servlet == null && !baseName.equals(request.getMethod())) {
pathIterator.reset();
- servlet = getServlet(resolver, pathIterator, request.getMethod());
+ servlet = getServlet(resolver, pathIterator, request.getMethod(), request);
}
// the next supertype or null
@@ -169,12 +170,12 @@
// (4) default script name and default servlet name and selectors
if (servlet == null) {
pathIterator.reset(DEFAULT_SERVLET_NAME);
- servlet = getServlet(resolver, pathIterator, baseName);
+ servlet = getServlet(resolver, pathIterator, baseName, request);
// (5) GET/HEAD and default servlet name and selectors
if (servlet == null && !baseName.equals(request.getMethod())) {
pathIterator.reset();
- servlet = getServlet(resolver, pathIterator, request.getMethod());
+ servlet = getServlet(resolver, pathIterator, request.getMethod(), request);
}
}
@@ -258,7 +259,7 @@
// search the servlet by absolute path
PathIterator pathIterator = new PathIterator(
ServletResolverConstants.ERROR_HANDLER_PATH, path);
- Servlet servlet = getServlet(resolver, pathIterator, baseName);
+ Servlet servlet = getServlet(resolver, pathIterator, baseName, request);
if (servlet == null) {
servlet = getDefaultErrorServlet();
}
@@ -301,7 +302,7 @@
String baseName = tClass.getSimpleName();
pathIterator.reset();
- servlet = getServlet(resolver, pathIterator, baseName);
+ servlet = getServlet(resolver, pathIterator, baseName, request);
// go to the base class
tClass = tClass.getSuperclass();
@@ -324,13 +325,19 @@
// ---------- internal helper ---------------------------------------------
private Servlet getServlet(ResourceResolver resolver,
- Iterator<String> paths, String baseName) {
+ Iterator<String> paths, String baseName,
+ SlingHttpServletRequest request) {
+
while (paths.hasNext()) {
String location = paths.next();
try {
Servlet result = getServletAt(resolver, location, baseName);
if (result != null) {
- return result;
+ boolean servletAcceptsRequest = !(result instanceof OptingServlet)
+ || ((OptingServlet) result).accepts(request);
+ if (servletAcceptsRequest) {
+ return result;
+ }
}
} catch (SlingException se) {
log.warn("getServlet: Problem resolving servlet at " + location
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/SlingServletResolverTest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/SlingServletResolverTest.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/SlingServletResolverTest.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/SlingServletResolverTest.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,111 @@
+/*
+ * 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.sling.servlet.resolver;
+
+import javax.servlet.Servlet;
+import javax.servlet.http.HttpServlet;
+
+import junit.framework.TestCase;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.servlets.OptingServlet;
+import org.apache.sling.core.CoreConstants;
+import org.apache.sling.servlet.resolver.mock.MockBundle;
+import org.apache.sling.servlet.resolver.mock.MockComponentContext;
+import org.apache.sling.servlet.resolver.mock.MockResourceResolver;
+import org.apache.sling.servlet.resolver.mock.MockServiceReference;
+import org.apache.sling.servlet.resolver.mock.MockSlingHttpServletRequest;
+import org.apache.sling.servlet.resolver.resource.MockServletResource;
+import org.osgi.framework.Constants;
+
+public class SlingServletResolverTest extends TestCase {
+ private Servlet servlet;
+
+ private SlingServletResolver servletResolver;
+
+ public static final String SERVLET_PATH = "/mock";
+
+ public static final String SERVLET_NAME = "TestServlet";
+
+ private static final String ROOT = "/";
+
+ private static final String SERVLET_EXTENSION = ".";
+
+ private MockResourceResolver mockResourceResolver;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ servlet = new MockSlingRequestHandlerServlet();
+ servletResolver = new SlingServletResolver();
+ MockBundle bundle = new MockBundle(1L);
+ MockComponentContext mockComponentContext = new MockComponentContext(
+ bundle, SlingServletResolverTest.this.servlet);
+ MockServiceReference serviceReference = new MockServiceReference(bundle);
+ serviceReference.setProperty(Constants.SERVICE_ID, 1L);
+ serviceReference.setProperty(CoreConstants.SLING_SERLVET_NAME,
+ SERVLET_NAME);
+ serviceReference.setProperty(
+ ServletResolverConstants.SLING_SERVLET_PATHS, SERVLET_PATH);
+ serviceReference.setProperty(
+ ServletResolverConstants.SLING_SERVLET_EXTENSIONS,
+ SERVLET_EXTENSION);
+ mockComponentContext.locateService("MockService", serviceReference);
+
+ servletResolver.bindServlet(serviceReference);
+ servletResolver.activate(mockComponentContext);
+ mockResourceResolver = new MockResourceResolver();
+ mockResourceResolver.setSearchPath(new String[] { "/" });
+ mockResourceResolver.addResource("/"
+ + MockSlingHttpServletRequest.RESOURCE_TYPE,
+ new MockServletResource(mockResourceResolver, servlet, ROOT));
+ }
+
+ public void testAcceptsRequest() {
+ MockSlingHttpServletRequest secureRequest = new MockSlingHttpServletRequest(
+ SERVLET_PATH, "", SERVLET_EXTENSION, "", "");
+ secureRequest.setResourceResolver(mockResourceResolver);
+ secureRequest.setSecure(true);
+ Servlet result = servletResolver.resolveServlet(secureRequest);
+ assertEquals("Did not resolve to correct servlet", servlet, result);
+ }
+
+ public void testIgnoreRequest() {
+ MockSlingHttpServletRequest insecureRequest = new MockSlingHttpServletRequest(
+ SERVLET_PATH, "", SERVLET_EXTENSION, "", "");
+ insecureRequest.setResourceResolver(mockResourceResolver);
+ insecureRequest.setSecure(false);
+ Servlet result = servletResolver.resolveServlet(insecureRequest);
+ assertTrue("Did not ignore unwanted request",
+ result.getClass() != MockSlingRequestHandlerServlet.class);
+ }
+
+ /**
+ * This sample servlet will only handle secure requests.
+ *
+ * @see org.apache.sling.api.servlets.OptingServlet#accepts
+ */
+ private static class MockSlingRequestHandlerServlet extends HttpServlet
+ implements OptingServlet {
+
+ public boolean accepts(SlingHttpServletRequest request) {
+ return request.isSecure();
+ }
+ }
+
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundle.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundle.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundle.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundle.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,127 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.io.InputStream;
+import java.net.URL;
+import java.util.Dictionary;
+import java.util.Enumeration;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+
+public class MockBundle implements Bundle {
+
+ private long bundleId;
+
+ public MockBundle(long bundleId) {
+ this.bundleId = bundleId;
+ }
+
+ public long getBundleId() {
+ return bundleId;
+ }
+
+ public Enumeration<?> findEntries(String path, String filePattern,
+ boolean recurse) {
+ return null;
+ }
+
+ public URL getEntry(String name) {
+ return null;
+ }
+
+ public Enumeration<?> getEntryPaths(String path) {
+ return null;
+ }
+
+ public Dictionary<?, ?> getHeaders() {
+ return null;
+ }
+
+ public Dictionary<?, ?> getHeaders(String locale) {
+ return null;
+ }
+
+ public long getLastModified() {
+ return 0;
+ }
+
+ public String getLocation() {
+ return null;
+ }
+
+ public ServiceReference[] getRegisteredServices() {
+ return null;
+ }
+
+ public URL getResource(String name) {
+ return null;
+ }
+
+ public Enumeration<?> getResources(String name) {
+ return null;
+ }
+
+ public ServiceReference[] getServicesInUse() {
+ return null;
+ }
+
+ public int getState() {
+ return 0;
+ }
+
+ public String getSymbolicName() {
+ return null;
+ }
+
+ public boolean hasPermission(Object permission) {
+ return false;
+ }
+
+ public Class<?> loadClass(String name) throws ClassNotFoundException {
+ throw new ClassNotFoundException(name);
+ }
+
+ public void start() {
+
+ }
+
+ public void stop() {
+
+ }
+
+ public void uninstall() {
+
+ }
+
+ public void update() {
+
+ }
+
+ public void update(InputStream in) {
+
+ }
+
+ public BundleContext getBundleContext() {
+ return null;
+ }
+
+}
\ No newline at end of file
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundleContext.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundleContext.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundleContext.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockBundleContext.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,157 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.io.File;
+import java.io.InputStream;
+import java.util.Dictionary;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.BundleListener;
+import org.osgi.framework.Filter;
+import org.osgi.framework.FrameworkListener;
+import org.osgi.framework.InvalidSyntaxException;
+import org.osgi.framework.ServiceListener;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+class MockBundleContext implements BundleContext {
+ private MockBundle bundle;
+
+ public MockBundleContext(MockBundle bundle) {
+ this.bundle = bundle;
+ }
+
+ public String getProperty(String s) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Bundle getBundle() {
+ return bundle;
+
+ }
+
+ public Bundle installBundle(String s) throws BundleException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Bundle installBundle(String s, InputStream inputStream)
+ throws BundleException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Bundle getBundle(long l) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Bundle[] getBundles() {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void addServiceListener(ServiceListener serviceListener, String s)
+ throws InvalidSyntaxException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void addServiceListener(ServiceListener serviceListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void removeServiceListener(ServiceListener serviceListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void addBundleListener(BundleListener bundleListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void removeBundleListener(BundleListener bundleListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void addFrameworkListener(FrameworkListener frameworkListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void removeFrameworkListener(FrameworkListener frameworkListener) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public ServiceRegistration registerService(String[] strings, Object o,
+ Dictionary dictionary) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public ServiceRegistration registerService(String s, Object o,
+ Dictionary dictionary) {
+ return new MockServiceRegistration();
+ }
+
+ public ServiceReference[] getServiceReferences(String s, String s1)
+ throws InvalidSyntaxException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public ServiceReference[] getAllServiceReferences(String s, String s1)
+ throws InvalidSyntaxException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public ServiceReference getServiceReference(String s) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Object getService(ServiceReference serviceReference) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public boolean ungetService(ServiceReference serviceReference) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public File getDataFile(String s) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Filter createFilter(String s) throws InvalidSyntaxException {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockComponentContext.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockComponentContext.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockComponentContext.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,94 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.util.Dictionary;
+import java.util.Properties;
+
+import javax.servlet.Servlet;
+
+import org.apache.sling.core.CoreConstants;
+import org.apache.sling.servlet.resolver.SlingServletResolverTest;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.ServiceReference;
+import org.osgi.service.component.ComponentContext;
+import org.osgi.service.component.ComponentInstance;
+
+public class MockComponentContext implements ComponentContext {
+ private Dictionary properties = new Properties();
+
+ private MockBundleContext mockBundleContext;
+
+ private Servlet servlet;
+
+ public MockComponentContext(MockBundle bundle, Servlet servlet) {
+ mockBundleContext = new MockBundleContext(bundle);
+ this.servlet = servlet;
+ }
+
+ public void setProperty(Object key, Object value) {
+ // noinspection unchecked
+ this.properties.put(key, value);
+ }
+
+ public Dictionary getProperties() {
+ // noinspection ReturnOfCollectionOrArrayField
+ return this.properties;
+ }
+
+ public Object locateService(String name, ServiceReference reference) {
+ String referenceName = (String) reference.getProperty(CoreConstants.SLING_SERLVET_NAME);
+ if (referenceName.equals(SlingServletResolverTest.SERVLET_NAME)) {
+ return this.servlet;
+ } else {
+ return null;
+ }
+ }
+
+ public BundleContext getBundleContext() {
+ return mockBundleContext;
+ }
+
+ public void disableComponent(String name) {
+ }
+
+ public void enableComponent(String name) {
+ }
+
+ public ComponentInstance getComponentInstance() {
+ return null;
+ }
+
+ public ServiceReference getServiceReference() {
+ return null;
+ }
+
+ public Bundle getUsingBundle() {
+ return null;
+ }
+
+ public Object locateService(String name) {
+ return null;
+ }
+
+ public Object[] locateServices(String name) {
+ return null;
+ }
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockRequestPathInfo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockRequestPathInfo.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockRequestPathInfo.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockRequestPathInfo.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,58 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import org.apache.sling.api.request.RequestPathInfo;
+
+class MockRequestPathInfo implements RequestPathInfo {
+
+ private final String selectors;
+
+ private final String extension;
+
+ private final String suffix;
+
+ public MockRequestPathInfo(String selectors, String extension, String suffix) {
+ this.selectors = selectors;
+ this.extension = extension;
+ this.suffix = suffix;
+ }
+
+ public String getExtension() {
+ return extension;
+ }
+
+ public String getResourcePath() {
+ return null;
+ }
+
+ public String getSelectorString() {
+ return selectors;
+ }
+
+ public String[] getSelectors() {
+ return (getSelectorString() != null)
+ ? getSelectorString().split(".")
+ : new String[0];
+ }
+
+ public String getSuffix() {
+ return suffix;
+ }
+}
\ No newline at end of file
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockResourceResolver.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockResourceResolver.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockResourceResolver.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockResourceResolver.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,106 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+
+public class MockResourceResolver implements ResourceResolver {
+
+ private String[] searchPath;
+
+ private HashMap<String, Resource> resources = new HashMap<String, Resource>();
+
+ public void addResource(String path, Resource resource) {
+ this.resources.put(path, resource);
+ }
+
+ public Resource resolve(HttpServletRequest request) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Resource resolve(String absPath) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public String map(String resourcePath) {
+ return null;
+
+ }
+
+ public Resource getResource(String path) {
+ return resources.get(path);
+ }
+
+ public Resource getResource(Resource base, String path) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public String[] getSearchPath() {
+ // noinspection ReturnOfCollectionOrArrayField
+ return searchPath;
+
+ }
+
+ public Iterator<Resource> listChildren(Resource parent) {
+ return new Iterator<Resource>() {
+
+ public boolean hasNext() {
+ return false;
+
+ }
+
+ public Resource next() {
+ return null;
+ }
+
+ public void remove() {
+ }
+ };
+ }
+
+ public Iterator<Resource> findResources(String query, String language) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public Iterator<Map<String, Object>> queryResources(String query,
+ String language) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public <AdapterType> AdapterType adaptTo(Class<AdapterType> type) {
+ throw new UnsupportedOperationException("Not implemented");
+
+ }
+
+ public void setSearchPath(String[] searchPath) {
+ this.searchPath = searchPath;
+ }
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceReference.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceReference.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceReference.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceReference.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,63 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.util.Collections;
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.ServiceReference;
+
+public class MockServiceReference implements ServiceReference {
+
+ private Bundle bundle;
+
+ private Dictionary<String, Object> props;
+
+ public MockServiceReference(Bundle bundle) {
+ this.bundle = bundle;
+ this.props = new Hashtable<String, Object>();
+ }
+
+ public Bundle getBundle() {
+ return bundle;
+ }
+
+ public void setProperty(String key, Object value) {
+ props.put(key, value);
+ }
+
+ public Object getProperty(String key) {
+ return props.get(key);
+ }
+
+ public String[] getPropertyKeys() {
+ return Collections.list(props.keys()).toArray(new String[props.size()]);
+ }
+
+ public Bundle[] getUsingBundles() {
+ return null;
+ }
+
+ public boolean isAssignableTo(Bundle bundle, String className) {
+ return false;
+ }
+
+}
\ No newline at end of file
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceRegistration.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceRegistration.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceRegistration.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockServiceRegistration.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.util.Dictionary;
+
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+
+class MockServiceRegistration implements ServiceRegistration {
+
+ public ServiceReference getReference() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public void setProperties(Dictionary dictionary) {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+
+ public void unregister() {
+ throw new UnsupportedOperationException("Not implemented");
+ }
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockSlingHttpServletRequest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockSlingHttpServletRequest.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockSlingHttpServletRequest.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/mock/MockSlingHttpServletRequest.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,361 @@
+/*
+ * 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.sling.servlet.resolver.mock;
+
+import java.io.BufferedReader;
+import java.security.Principal;
+import java.util.Enumeration;
+import java.util.Locale;
+import java.util.Map;
+import java.util.ResourceBundle;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletInputStream;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpSession;
+
+import org.apache.sling.api.SlingHttpServletRequest;
+import org.apache.sling.api.request.RequestDispatcherOptions;
+import org.apache.sling.api.request.RequestParameter;
+import org.apache.sling.api.request.RequestParameterMap;
+import org.apache.sling.api.request.RequestPathInfo;
+import org.apache.sling.api.request.RequestProgressTracker;
+import org.apache.sling.api.resource.Resource;
+import org.apache.sling.api.resource.ResourceResolver;
+import org.apache.sling.api.resource.SyntheticResource;
+
+/**
+ * Mock request object. This does not do anything useful, it just returns the
+ * constructor parameter <code>secure</code> in the <code>isSecure</code>
+ * method.
+ */
+public class MockSlingHttpServletRequest implements SlingHttpServletRequest {
+
+ private final Resource resource;
+
+ private final RequestPathInfo requestPathInfo;
+
+ private final String queryString;
+
+ private boolean secure = false;
+
+ private MockResourceResolver mockResourceResolver;
+
+ private static final String METHOD = "GET";
+
+ public static final String RESOURCE_TYPE = "foo/bar";
+
+ MockSlingHttpServletRequest() {
+ this(null, null, null, null, null);
+ }
+
+ public MockSlingHttpServletRequest(String resourcePath, String selectors,
+ String extension, String suffix, String queryString) {
+ this.resource = new SyntheticResource(null, resourcePath, RESOURCE_TYPE);
+ this.requestPathInfo = new MockRequestPathInfo(selectors, extension,
+ suffix);
+ this.queryString = queryString;
+ }
+
+ public void setResourceResolver(MockResourceResolver resolver) {
+ this.mockResourceResolver = resolver;
+ }
+
+ public void setSecure(boolean secure) {
+ this.secure = secure;
+ }
+
+ public Cookie getCookie(String name) {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path,
+ RequestDispatcherOptions options) {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(Resource resource,
+ RequestDispatcherOptions options) {
+ return null;
+ }
+
+ public RequestDispatcher getRequestDispatcher(Resource resource) {
+ return null;
+ }
+
+ public RequestParameter getRequestParameter(String name) {
+ return null;
+ }
+
+ public RequestParameterMap getRequestParameterMap() {
+ return null;
+ }
+
+ public RequestParameter[] getRequestParameters(String name) {
+ return null;
+ }
+
+ public RequestPathInfo getRequestPathInfo() {
+ return requestPathInfo;
+ }
+
+ public RequestProgressTracker getRequestProgressTracker() {
+ return null;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public ResourceBundle getResourceBundle(Locale locale) {
+ return null;
+ }
+
+ public ResourceBundle getResourceBundle(String baseName, Locale locale) {
+ return null;
+ }
+
+ public ResourceResolver getResourceResolver() {
+ return mockResourceResolver;
+ }
+
+ public String getResponseContentType() {
+ return null;
+ }
+
+ public Enumeration<String> getResponseContentTypes() {
+ return null;
+ }
+
+ public String getAuthType() {
+ return null;
+ }
+
+ public String getContextPath() {
+ return null;
+ }
+
+ public Cookie[] getCookies() {
+ return null;
+ }
+
+ public long getDateHeader(String name) {
+ return 0;
+ }
+
+ public String getHeader(String name) {
+ return null;
+ }
+
+ public Enumeration<?> getHeaderNames() {
+ return null;
+ }
+
+ public Enumeration<?> getHeaders(String name) {
+ return null;
+ }
+
+ public int getIntHeader(String name) {
+ return 0;
+ }
+
+ public String getMethod() {
+ return METHOD;
+ }
+
+ public String getPathInfo() {
+ return null;
+ }
+
+ public String getPathTranslated() {
+ return null;
+ }
+
+ public String getQueryString() {
+ return queryString;
+ }
+
+ public String getRemoteUser() {
+ return null;
+ }
+
+ public String getRequestURI() {
+ return null;
+ }
+
+ public StringBuffer getRequestURL() {
+ return null;
+ }
+
+ public String getRequestedSessionId() {
+ return null;
+ }
+
+ public String getServletPath() {
+ return null;
+ }
+
+ public HttpSession getSession() {
+ return null;
+ }
+
+ public HttpSession getSession(boolean create) {
+ return null;
+ }
+
+ public Principal getUserPrincipal() {
+ return null;
+ }
+
+ public boolean isRequestedSessionIdFromCookie() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromURL() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdFromUrl() {
+ return false;
+ }
+
+ public boolean isRequestedSessionIdValid() {
+ return false;
+ }
+
+ public boolean isUserInRole(String role) {
+ return false;
+ }
+
+ public Object getAttribute(String name) {
+ return null;
+ }
+
+ public Enumeration<?> getAttributeNames() {
+ return null;
+ }
+
+ public String getCharacterEncoding() {
+ return null;
+ }
+
+ public int getContentLength() {
+ return 0;
+ }
+
+ public String getContentType() {
+ return null;
+ }
+
+ public ServletInputStream getInputStream() {
+ return null;
+ }
+
+ public String getLocalAddr() {
+ return null;
+ }
+
+ public String getLocalName() {
+ return null;
+ }
+
+ public int getLocalPort() {
+ return 0;
+ }
+
+ public Locale getLocale() {
+ return null;
+ }
+
+ public Enumeration<?> getLocales() {
+ return null;
+ }
+
+ public String getParameter(String name) {
+ return null;
+ }
+
+ public Map<?, ?> getParameterMap() {
+ return null;
+ }
+
+ public Enumeration<?> getParameterNames() {
+ return null;
+ }
+
+ public String[] getParameterValues(String name) {
+ return null;
+ }
+
+ public String getProtocol() {
+ return null;
+ }
+
+ public BufferedReader getReader() {
+ return null;
+ }
+
+ public String getRealPath(String path) {
+ return null;
+ }
+
+ public String getRemoteAddr() {
+ return null;
+ }
+
+ public String getRemoteHost() {
+ return null;
+ }
+
+ public int getRemotePort() {
+ return 0;
+ }
+
+ public RequestDispatcher getRequestDispatcher(String path) {
+ return null;
+ }
+
+ public String getScheme() {
+ return null;
+ }
+
+ public String getServerName() {
+ return null;
+ }
+
+ public int getServerPort() {
+ return 0;
+ }
+
+ public boolean isSecure() {
+ return this.secure;
+ }
+
+ public void removeAttribute(String name) {
+
+ }
+
+ public void setAttribute(String name, Object o) {
+
+ }
+
+ public void setCharacterEncoding(String env) {
+
+ }
+}
Added: incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/MockServletResource.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/MockServletResource.java?rev=647695&view=auto
==============================================================================
--- incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/MockServletResource.java (added)
+++ incubator/sling/trunk/sling/servlet-resolver/src/test/java/org/apache/sling/servlet/resolver/resource/MockServletResource.java Mon Apr 14 01:28:23 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.sling.servlet.resolver.resource;
+
+import javax.servlet.Servlet;
+
+import org.apache.sling.api.resource.ResourceResolver;
+
+public class MockServletResource extends
+ org.apache.sling.servlet.resolver.resource.ServletResource {
+ public MockServletResource(ResourceResolver resourceResolver,
+ Servlet servlet, String path) {
+ super(resourceResolver, servlet, path);
+ }
+}
Modified: incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockRequestPathInfo.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockRequestPathInfo.java?rev=647695&r1=647694&r2=647695&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockRequestPathInfo.java (original)
+++ incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockRequestPathInfo.java Mon Apr 14 01:28:23 2008
@@ -28,7 +28,7 @@
private final String suffix;
- MockRequestPathInfo(String selectors, String extension, String suffix) {
+ public MockRequestPathInfo(String selectors, String extension, String suffix) {
this.selectors = selectors;
this.extension = extension;
this.suffix = suffix;
Modified: incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockSlingHttpServletRequest.java
URL: http://svn.apache.org/viewvc/incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockSlingHttpServletRequest.java?rev=647695&r1=647694&r2=647695&view=diff
==============================================================================
--- incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockSlingHttpServletRequest.java (original)
+++ incubator/sling/trunk/sling/servlets-default/src/test/java/org/apache/sling/servlets/MockSlingHttpServletRequest.java Mon Apr 14 01:28:23 2008
@@ -40,7 +40,7 @@
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.SyntheticResource;
-class MockSlingHttpServletRequest implements SlingHttpServletRequest {
+public class MockSlingHttpServletRequest implements SlingHttpServletRequest {
private final Resource resource;
@@ -52,7 +52,7 @@
this(null, null, null, null, null);
}
- MockSlingHttpServletRequest(String resourcePath, String selectors,
+ public MockSlingHttpServletRequest(String resourcePath, String selectors,
String extension, String suffix, String queryString) {
this.resource = new SyntheticResource(null, resourcePath, null);
this.requestPathInfo = new MockRequestPathInfo(selectors, extension,