You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by kw...@apache.org on 2016/04/19 08:13:37 UTC
svn commit: r1739844 - in
/sling/trunk/bundles/extensions/models/integration-tests: ./
src/main/java/org/apache/sling/models/it/
src/main/java/org/apache/sling/models/it/models/
src/main/java/org/apache/sling/models/it/services/
Author: kwin
Date: Tue Apr 19 06:13:36 2016
New Revision: 1739844
URL: http://svn.apache.org/viewvc?rev=1739844&view=rev
Log:
SLING-5664 make compatible with OSGi Core 4.1
add missing licenses
Modified:
sling/trunk/bundles/extensions/models/integration-tests/pom.xml
sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
Modified: sling/trunk/bundles/extensions/models/integration-tests/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/pom.xml?rev=1739844&r1=1739843&r2=1739844&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/pom.xml (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/pom.xml Tue Apr 19 06:13:36 2016
@@ -252,7 +252,6 @@
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<scope>provided</scope>
- <version>4.3.0</version> <!-- newer than specific in parent version to use FrameworkUtil.getBundle(Class) -->
</dependency>
<dependency>
<groupId>org.osgi</groupId>
Modified: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java?rev=1739844&r1=1739843&r2=1739844&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/ServiceInjectionWithDifferentRankingTest.java Tue Apr 19 06:13:36 2016
@@ -1,3 +1,19 @@
+/*
+ * 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.models.it;
import static org.junit.Assert.assertArrayEquals;
@@ -17,6 +33,7 @@ import org.apache.commons.lang.RandomStr
import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ResourceResolver;
import org.apache.sling.api.resource.ResourceResolverFactory;
+import org.apache.sling.junit.Activator;
import org.apache.sling.junit.annotations.SlingAnnotationsTestRunner;
import org.apache.sling.junit.annotations.TestReference;
import org.apache.sling.models.factory.ModelFactory;
@@ -29,7 +46,6 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Constants;
-import org.osgi.framework.FrameworkUtil;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ConfigurationAdmin;
import org.osgi.util.tracker.ServiceTracker;
@@ -54,7 +70,7 @@ public class ServiceInjectionWithDiffere
private Resource resource;
private Node createdNode;
private BundleContext bundleContext;
- private Collection<ServiceRegistration<SimpleService>> serviceRegistrations;
+ private Collection<ServiceRegistration> serviceRegistrations;
@Before
public void setUp() throws Exception {
@@ -69,8 +85,8 @@ public class ServiceInjectionWithDiffere
resource = resolver.getResource(createdNode.getPath());
- bundleContext = FrameworkUtil.getBundle(SimpleServiceWithCustomRanking.class).getBundleContext();
- serviceRegistrations = new ArrayList<ServiceRegistration<SimpleService>>();
+ bundleContext = Activator.getBundleContext();
+ serviceRegistrations = new ArrayList<ServiceRegistration>();
}
@After
@@ -82,15 +98,17 @@ public class ServiceInjectionWithDiffere
resolver.close();
}
- for (ServiceRegistration<?> serviceRegistration : serviceRegistrations) {
+ for (ServiceRegistration serviceRegistration : serviceRegistrations) {
serviceRegistration.unregister();
}
}
+ @SuppressWarnings("unchecked")
private void registerSimpleService(int ranking) {
- Dictionary<String, Object> serviceProps = new Hashtable<String, Object>();
+ @SuppressWarnings("rawtypes")
+ Dictionary serviceProps = new Hashtable();
serviceProps.put(Constants.SERVICE_RANKING, new Integer(ranking));
- ServiceRegistration<SimpleService> serviceRegistration = bundleContext.registerService(SimpleService.class,
+ ServiceRegistration serviceRegistration = bundleContext.registerService(SimpleService.class.getName(),
new SimpleServiceWithCustomRanking(ranking), serviceProps);
serviceRegistrations.add(serviceRegistration);
}
Modified: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java?rev=1739844&r1=1739843&r2=1739844&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/models/ServiceInjectionTestModel.java Tue Apr 19 06:13:36 2016
@@ -1,3 +1,19 @@
+/*
+ * 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.models.it.models;
import java.util.ArrayList;
Modified: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java?rev=1739844&r1=1739843&r2=1739844&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleService.java Tue Apr 19 06:13:36 2016
@@ -1,3 +1,19 @@
+/*
+ * 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.models.it.services;
public interface SimpleService {
Modified: sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java
URL: http://svn.apache.org/viewvc/sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java?rev=1739844&r1=1739843&r2=1739844&view=diff
==============================================================================
--- sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java (original)
+++ sling/trunk/bundles/extensions/models/integration-tests/src/main/java/org/apache/sling/models/it/services/SimpleServiceWithCustomRanking.java Tue Apr 19 06:13:36 2016
@@ -1,3 +1,19 @@
+/*
+ * 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.models.it.services;
public class SimpleServiceWithCustomRanking implements SimpleService {