sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jus...@apache.org
Subject svn commit: r1354130 - in /sling/trunk: bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/ launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/ launchpad/test-services/src/main/jav...
Date Tue, 26 Jun 2012 17:47:33 GMT
Author: justin
Date: Tue Jun 26 17:47:32 2012
New Revision: 1354130

URL: http://svn.apache.org/viewvc?rev=1354130&view=rev
Log:
SLING-2522 - adding AdapterFactory class to filter used by AdapterWebConsolePlugin

Added:
    sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
  (with props)
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
  (with props)
    sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
  (with props)
Modified:
    sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterWebConsolePlugin.java

Modified: sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterWebConsolePlugin.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterWebConsolePlugin.java?rev=1354130&r1=1354129&r2=1354130&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterWebConsolePlugin.java
(original)
+++ sling/trunk/bundles/extensions/adapter/src/main/java/org/apache/sling/adapter/internal/AdapterWebConsolePlugin.java
Tue Jun 26 17:47:32 2012
@@ -44,6 +44,7 @@ import org.apache.felix.scr.annotations.
 import org.apache.felix.scr.annotations.Properties;
 import org.apache.felix.scr.annotations.Property;
 import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.adapter.AdapterFactory;
 import org.apache.sling.commons.json.JSONArray;
 import org.apache.sling.commons.json.JSONException;
 import org.apache.sling.commons.json.JSONObject;
@@ -206,7 +207,7 @@ public class AdapterWebConsolePlugin ext
         }
 
         this.bundleContext.addBundleListener(this);
-        final Filter filter = this.bundleContext.createFilter("(&(adaptables=*)(adapters=*))");
+        final Filter filter = this.bundleContext.createFilter("(&(adaptables=*)(adapters=*)("
+ Constants.OBJECTCLASS + "=" + AdapterFactory.SERVICE_NAME + "))");
         this.adapterTracker = new ServiceTracker(this.bundleContext, filter, this);
         this.adapterTracker.open();
     }

Added: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java?rev=1354130&view=auto
==============================================================================
--- sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
(added)
+++ sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
Tue Jun 26 17:47:32 2012
@@ -0,0 +1,29 @@
+/*
+ * 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.launchpad.webapp.integrationtest.issues;
+
+import org.apache.sling.commons.testing.integration.HttpTestBase;
+
+public class SLING2522Test extends HttpTestBase {
+
+    public void testThatServicesWhichLikeAdapterFactoriesArentShowInTheW() throws Exception
{
+        String content = getContent(HTTP_BASE_URL + "/system/console/adapters", "text/html");
+        assertFalse("page contains wrong class", content.contains("something_which_shouldnt_appear"));
+        assertTrue("page doesn't contain correct class", content.contains("something_which_should_appear"));
+    }
+
+}

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/integration-tests/src/main/java/org/apache/sling/launchpad/webapp/integrationtest/issues/SLING2522Test.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java?rev=1354130&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
(added)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
Tue Jun 26 17:47:32 2012
@@ -0,0 +1,41 @@
+/*
+ * 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.launchpad.testservices.adapter;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.adapter.AdapterFactory;
+
+/**
+ * Service which looks like an adapter factory, but isn't. See SLING-2522.
+ */
+@Component
+@Service(NotReallyAnAdapterFactory.class)
+@Properties({
+    @Property(name=AdapterFactory.ADAPTABLE_CLASSES, value="org.apache.sling.api.resource.Resource"),
+    @Property(name=AdapterFactory.ADAPTER_CLASSES, value="something_which_shouldnt_appear")
+})
+public class NotReallyAnAdapterFactory implements AdapterFactory {
+
+    public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType>
type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/NotReallyAnAdapterFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL

Added: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
URL: http://svn.apache.org/viewvc/sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java?rev=1354130&view=auto
==============================================================================
--- sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
(added)
+++ sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
Tue Jun 26 17:47:32 2012
@@ -0,0 +1,40 @@
+/*
+ * 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.launchpad.testservices.adapter;
+
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Properties;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
+import org.apache.sling.api.adapter.AdapterFactory;
+/**
+ * Service which actually is an adapter factory. See SLING-2522.
+ */
+@Component
+@Service(AdapterFactory.class)
+@Properties({
+    @Property(name=AdapterFactory.ADAPTABLE_CLASSES, value="org.apache.sling.api.resource.Resource"),
+    @Property(name=AdapterFactory.ADAPTER_CLASSES, value="something_which_should_appear")
+})
+public class ReallyAnAdapterFactory implements AdapterFactory {
+
+    public <AdapterType> AdapterType getAdapter(Object adaptable, Class<AdapterType>
type) {
+        // TODO Auto-generated method stub
+        return null;
+    }
+
+}

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/launchpad/test-services/src/main/java/org/apache/sling/launchpad/testservices/adapter/ReallyAnAdapterFactory.java
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision Rev URL



Mime
View raw message