Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/ServiceComponentTest.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/ServiceComponentTest.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/ServiceComponentTest.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/ServiceComponentTest.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,177 @@ +/* + * 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.felix.scr.integration; + + +import org.apache.felix.scr.integration.components.SimpleComponent; +import org.junit.Test; +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceReference; +import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO; + +import junit.framework.TestCase; + + +public class ServiceComponentTest extends ComponentTestBase +{ + @Test + public void test_SimpleComponent_service() throws Exception + { + final String pid = "ServiceComponent"; + + // one single component exists without configuration + getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.ACTIVE); + final SimpleComponent instance = SimpleComponent.INSTANCE; + TestCase.assertNotNull( instance ); + + // assert component properties (all !) + TestCase.assertEquals( "required", instance.getProperty( "prop.public" ) ); + TestCase.assertEquals( "private", instance.getProperty( ".prop.private" ) ); + + // get the service + ServiceReference<?> reference = findServiceByPid(bundleContext, "java.lang.Object", "(service.pid=ServiceComponent)" ); + TestCase.assertNotNull( reference ); + try + { + TestCase.assertEquals( instance, bundleContext.getService( reference ) ); + } + finally + { + bundleContext.ungetService( reference ); + } + + // check service properties + TestCase.assertEquals( "required", reference.getProperty( "prop.public" ) ); + TestCase.assertNull( reference.getProperty( ".prop.private" ) ); + + // check property keys do not contain private keys + for ( String propKey : reference.getPropertyKeys() ) + { + TestCase.assertTrue( "Property key [" + propKey + + "] must have at least one character and not start with a dot", propKey.length() > 0 + && !propKey.startsWith( "." ) ); + } + } + + + @Test + public void test_DelayedSimpleComponent_service_single_use() throws Exception + { + final String pid = "DelayedServiceComponent"; + + // one single component exists without configuration + getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.SATISFIED); + TestCase.assertNull( SimpleComponent.INSTANCE ); + + // get the service + ServiceReference<?> reference = findServiceByPid(bundleContext, "java.lang.Object", "(service.pid=ServiceComponent)"); + TestCase.assertNotNull( reference ); + try + { + final Object theService = bundleContext.getService( reference ); + + // service must now be active + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + + // and of course we expect the instance + TestCase.assertEquals( SimpleComponent.INSTANCE, theService ); + } + finally + { + bundleContext.ungetService( reference ); + } + + // service is not used anymore, ensure REGISTERED state and INSTANCE==null + findComponentConfigurationByName(pid, ComponentConfigurationDTO.SATISFIED); + TestCase.assertNull( SimpleComponent.INSTANCE ); + } + + + @Test + public void test_DelayedSimpleComponent_service_multi_use() throws Exception + { + final String pid = "DelayedServiceComponent"; + + // one single component exists without configuration + // the delayed service is expected to only be registered before use + getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.SATISFIED); + TestCase.assertNull( SimpleComponent.INSTANCE ); + + // get the service once + final ServiceReference<?> reference1 = findServiceByPid(bundleContext, "java.lang.Object", "(service.pid=ServiceComponent)"); + TestCase.assertNotNull( reference1 ); + bundleContext.getService( reference1 ); + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + TestCase.assertNotNull( SimpleComponent.INSTANCE ); + + // get the service a second time + final BundleContext bundleContext2 = bundle.getBundleContext(); + final ServiceReference reference2 = findServiceByPid(bundleContext2, "java.lang.Object", "(service.pid=ServiceComponent)"); + TestCase.assertNotNull( reference2 ); + bundleContext2.getService( reference2 ); + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + TestCase.assertNotNull( SimpleComponent.INSTANCE ); + + // unget the service once -- must still be active ! + bundleContext2.ungetService( reference2 ); + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + TestCase.assertNotNull( SimpleComponent.INSTANCE ); + + // unget the service second time -- must be registered and null now + bundleContext.ungetService( reference1 ); + findComponentConfigurationByName(pid, ComponentConfigurationDTO.SATISFIED); + TestCase.assertNull( SimpleComponent.INSTANCE ); + } + + @Test + public void test_DelayedSimpleComponent_service_keep_instance() throws Exception + { + // configure SCR to keep instances + + final String pid = "DelayedKeepInstancesServiceComponent"; + + // one single component exists without configuration + // the delayed service is expected to only be registered before use + getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.SATISFIED); + TestCase.assertNull( SimpleComponent.INSTANCE ); + + // get the service + ServiceReference reference = findServiceByPid(bundleContext, "java.lang.Object", "(service.pid=ServiceComponent)" ); + TestCase.assertNotNull( reference ); + try + { + final Object theService = bundleContext.getService( reference ); + + // service must now be active + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + + // and of course we expect the instance + TestCase.assertEquals( SimpleComponent.INSTANCE, theService ); + } + finally + { + bundleContext.ungetService( reference ); + } + + // component instance must not be disposed off (due to config) + findComponentConfigurationByName(pid, ComponentConfigurationDTO.ACTIVE); + TestCase.assertNotNull( SimpleComponent.INSTANCE ); + + } +}
Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetPropertyTest.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetPropertyTest.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetPropertyTest.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetPropertyTest.java Wed Jul 8 22:10:14 2015 @@ -0,0 +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.felix.scr.integration; + +import org.apache.felix.scr.integration.components.SimpleComponent; +import org.apache.felix.scr.integration.components.SimpleServiceImpl; +import org.junit.Test; +import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO; + +import junit.framework.TestCase; + +public class TargetPropertyTest extends ComponentTestBase +{ + + public TargetPropertyTest() + { + super("/resource/integration_test_target_properties.xml"); + } + + @Test + public void test_1() throws Exception + { + String pid = "components.target.properties.1"; + singleTest( pid, "foo" ); + } + + @Test + public void test_1_2() throws Exception + { + String pid = "components.target.properties.1.2"; + singleTest( pid, "foo" ); + } + + @Test + public void test_1_3() throws Exception + { + String pid = "components.target.properties.1.3"; + singleTest( pid, "foo" ); + } + + @Test + public void test_2() throws Exception + { + String pid = "components.target.properties.2"; + singleTest( pid, "foo" ); + } + + @Test + public void test_3() throws Exception + { + String pid = "components.target.properties.3"; + singleTest( pid, "bar" ); + } + + + private void singleTest(String pid, String expected) throws Exception + { + final SimpleServiceImpl srv1 = SimpleServiceImpl.create( bundleContext, expected ); + final SimpleServiceImpl srv2 = SimpleServiceImpl.create( bundleContext, "baz" ); + + ComponentConfigurationDTO cc = getDisabledConfigurationAndEnable(pid, ComponentConfigurationDTO.ACTIVE); + checkTarget(expected, srv1); + + //configuration not setting target property does not change it + configure( pid ); + delay();//all cm event to complete + checkTarget(expected, srv1); + + // update configuration to target srv2 + theConfig.put("one.target", "(value=baz)"); + configure( pid ); + delay(); + checkTarget("baz", srv2); + + //update configuration removing target property + theConfig.remove("one.target"); + configure( pid ); + delay();//all cm event to complete + checkTarget(expected, srv1); + + // cleanup + disableAndCheck(cc); + deleteConfig(pid); + srv1.drop(); + srv2.drop(); + } + + void checkTarget(String expected, final SimpleServiceImpl srv1) + { + final SimpleComponent comp10 = SimpleComponent.INSTANCE; + TestCase.assertNotNull( comp10 ); + TestCase.assertEquals("(value=" + expected + ")", comp10.getProperty("one.target")); + TestCase.assertEquals( srv1, comp10.m_singleRef ); + } + + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetedPIDTest.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetedPIDTest.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetedPIDTest.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/TargetedPIDTest.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,145 @@ +/* + * 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.felix.scr.integration; + +import java.util.HashSet; +import java.util.Set; + +import org.apache.felix.scr.integration.components.SimpleComponent; +import org.junit.Test; +import org.osgi.framework.Bundle; +//import org.osgi.framework.ServiceRegistration; +import org.osgi.service.cm.Configuration; +//import org.osgi.service.cm.ConfigurationEvent; +//import org.osgi.service.cm.ConfigurationListener; +import org.osgi.service.cm.ConfigurationPermission; +import org.osgi.service.component.runtime.dto.ComponentConfigurationDTO; + +import junit.framework.TestCase; + +public class TargetedPIDTest extends ComponentTestBase +{ + + private static final String TARGETED_PID = "targetedPID"; + private static final String COMPONENT_NAME = "SimpleComponent.configuration.require"; + private static final String REGION = "?foo"; + + public TargetedPIDTest() + { + super("/resource/integration_test_simple_components_location.xml"); + // by default, the org.osgi.framework.bsnversion property is set to multiple in bnd.bnd file (see -runproperties). + } + + @Test + public void testTargetedPID() throws Exception + { + try + { + new ConfigurationPermission(REGION, ConfigurationPermission.TARGET); + } + catch (IllegalArgumentException e) + { + return;//not an R5 CA + } + String pid = COMPONENT_NAME; + theConfig.put(TARGETED_PID, pid); + Configuration config = configure( pid ); + config.setBundleLocation( REGION ); + + String pidSN = pid + "|simplecomponent2"; + theConfig.put(TARGETED_PID, pidSN); + Configuration configSN = configure( pidSN ); + configSN.setBundleLocation( REGION ); + + String pidSNV = pidSN + "|0.0.12"; + theConfig.put(TARGETED_PID, pidSNV); + Configuration configSNV = configure( pidSNV ); + configSNV.setBundleLocation( REGION ); + + String pidSNVL = pidSNV + "|bundleLocation"; + theConfig.put(TARGETED_PID, pidSNVL); + Configuration configSNVL = configure( pidSNVL ); + configSNVL.setBundleLocation( REGION ); + + delay(); + + //Add more and more specific components to check that they pick up the appropriate configuration + Set<ComponentConfigurationDTO> known = new HashSet<ComponentConfigurationDTO>(); + + final ComponentConfigurationDTO component = findComponentConfigurationByName( COMPONENT_NAME, ComponentConfigurationDTO.ACTIVE ); + known.add( component ); + + TestCase.assertNotNull( SimpleComponent.INSTANCE ); + SimpleComponent sc = SimpleComponent.INSTANCE; + TestCase.assertEquals( pid, sc.getProperty( TARGETED_PID ) ); + + + Bundle bSN = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.11", null ); + bSN.start(); + findComponentConfigurationByName( bSN, pid, ComponentConfigurationDTO.ACTIVE ); + + + SimpleComponent scSN = SimpleComponent.INSTANCE; + TestCase.assertEquals( pidSN, scSN.getProperty( TARGETED_PID ) ); + + Bundle bSNV = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.12", null ); + bSNV.start(); + findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE ); + SimpleComponent scSNV = SimpleComponent.INSTANCE; + TestCase.assertEquals( pidSNV, scSNV.getProperty( TARGETED_PID ) ); + + Bundle bSNVL = installBundle( descriptorFile, COMPONENT_PACKAGE, "simplecomponent2", "0.0.12", "bundleLocation" ); + bSNVL.start(); + findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE ); + + SimpleComponent scSNVL = SimpleComponent.INSTANCE; + TestCase.assertEquals( pidSNVL, scSNVL.getProperty( TARGETED_PID ) ); + + //remove configurations to check that the components now use the less specific configurations. + + configSNVL.delete(); + delay(); + findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pidSNV, scSNVL.getProperty( TARGETED_PID ) ); + + configSNV.delete(); + delay(); + findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pidSN, scSNVL.getProperty( TARGETED_PID ) ); + findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pidSN, scSNV.getProperty( TARGETED_PID ) ); + + configSN.delete(); + delay(); + findComponentConfigurationsByName( bSNVL, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pid, scSNVL.getProperty( TARGETED_PID ) ); + findComponentConfigurationByName( bSNV, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pid, scSNV.getProperty( TARGETED_PID ) ); + findComponentConfigurationByName( bSN, pid, ComponentConfigurationDTO.ACTIVE ); + TestCase.assertEquals( pid, scSN.getProperty( TARGETED_PID ) ); + + // cleanup + config.delete(); + delay(); + bSN.uninstall(); + bSNV.uninstall(); + bSNVL.uninstall(); + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/ActivatorComponent.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/ActivatorComponent.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/ActivatorComponent.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/ActivatorComponent.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,104 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.Map; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.ServiceRegistration; + + +public class ActivatorComponent +{ + + public static final String FLAG_FAIL_ACTIVATE = "failActivate"; + + public static final String FLAG_FAIL_DEACTIVATE = "failDeactivate"; + + public static final String FLAG_REGISTER_SERVICE = "registerService"; + + private static ActivatorComponent activatorComponent; + + private ServiceRegistration registration; + + private SimpleService simpleService; + + public static ActivatorComponent getInstance() + { + return activatorComponent; + } + + @SuppressWarnings("unused") + private void myActivate( BundleContext context, Map<?, ?> configuration ) + { + if ( configuration.containsKey( FLAG_FAIL_ACTIVATE ) ) + { + throw new IllegalStateException( "myActivate fails" ); + } + if ( configuration.containsKey( FLAG_REGISTER_SERVICE ) ) + { + registration = context.registerService( SimpleService.class.getName(), new SimpleServiceImpl(), null ); + } + if ( activatorComponent != null ) + { + throw new IllegalStateException( "not the only activator component"); + } + this.activatorComponent = this; + } + + + @SuppressWarnings("unused") + private void myDeactivate( Map<?, ?> configuration ) + { + this.activatorComponent = null; + if ( configuration.containsKey( FLAG_FAIL_DEACTIVATE ) ) + { + throw new IllegalStateException( "myDeactivate fails" ); + } + if ( registration != null ) + { + registration.unregister(); + registration = null; + } + } + + + public SimpleService getSimpleService() + { + return simpleService; + } + + + @SuppressWarnings("unused") + private void bindSimpleService( SimpleService simpleService ) + { + this.simpleService = simpleService; + } + + + @SuppressWarnings("unused") + private void unbindSimpleService( SimpleService simpleService ) + { + if ( this.simpleService == simpleService ) + { + this.simpleService = null; + } + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/EnableComponent.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/EnableComponent.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/EnableComponent.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/EnableComponent.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,48 @@ +/* + * 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.felix.scr.integration.components; + +import org.osgi.service.component.ComponentContext; + +public class EnableComponent +{ + + private ComponentContext cc; + + protected void activate(ComponentContext cc) + { + this.cc = cc; + } + + protected void deactivate() + { + cc = null; + } + + public void enable( String component ) + { + cc.enableComponent(component); + } + + public void disable( String component ) + { + cc.disableComponent(component); + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4188Component.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4188Component.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4188Component.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4188Component.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,44 @@ +/* + * 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.felix.scr.integration.components; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +public class Felix4188Component { + + public BundleContext bundleContext; + public Throwable throwable; + + void start() + { + bundleContext = FrameworkUtil.getBundle(getClass()).getBundleContext(); + } + + void stop() + { + try { + Thread.sleep(2000); + bundleContext.getBundle(); + } catch (Throwable t) { + throwable = t; + } + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4350Component.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4350Component.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4350Component.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/Felix4350Component.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,76 @@ +/* + * 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.felix.scr.integration.components; + +public class Felix4350Component { + + private static Felix4350Component m_instance; + private static int m_activateCount; + private static int m_deactivateCount; + + private SimpleComponent component1; + private SimpleComponent2 component2; + + public static void init() { + m_instance = null; + m_activateCount = 0; + m_deactivateCount = 0; + } + + public void bindComponent1(SimpleComponent component1) { + this.component1 = component1; + } + + public void unbindComponent1(SimpleComponent component1) { + this.component1 = null; + } + + public void bindComponent2(SimpleComponent2 component2) { + this.component2 = component2; + } + + public void unbindComponent2(SimpleComponent2 component2) { + this.component2 = null; + } + + public void start() { + m_instance = this; + m_activateCount++; + } + + public void stop() { + m_instance = null; + m_deactivateCount++; + } + + public static void check(int activateCount, int deactivateCount, boolean activated) + { + if (activateCount != m_activateCount || + deactivateCount != m_deactivateCount || + activated == (m_instance == null)) + { + String message = "activation: expected " + activateCount + " actual " + m_activateCount + + " deactivation: expected " + deactivateCount + " actual " + m_deactivateCount + + " activated: expected " + activated + " actual " + (m_instance != null); + throw new IllegalStateException( message ); + + } + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingService.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingService.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingService.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingService.java Wed Jul 8 22:10:14 2015 @@ -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.felix.scr.integration.components; + + +import java.util.Dictionary; + +public interface MutatingService +{ + + void updateProperties(Dictionary changes); + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingServiceImpl.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingServiceImpl.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingServiceImpl.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/MutatingServiceImpl.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,92 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.Collections; +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Map; + +import org.apache.felix.scr.component.ExtComponentContext; +import org.osgi.service.component.ComponentContext; + + +public class MutatingServiceImpl implements MutatingService +{ + private ComponentContext activateContext; + + private void activate( ComponentContext activateContext ) + { + this.activateContext = activateContext; + } + + private void modified( ComponentContext activateContext ) + { + + } + + private Map activateMutate( ComponentContext activateContext ) + { + this.activateContext = activateContext; + Map result = new Hashtable( (Map )activateContext.getProperties() ); + result.put( "theValue", "anotherValue1" ); + if (result.containsKey( ".p2" )) + { + result.put( ".theValue", "privateValue" ); + } + return result; + } + + private Map modifiedMutate( ComponentContext activateContext ) + { + Map result = new Hashtable( (Map )activateContext.getProperties() ); + result.put( "theValue", "anotherValue2" ); + return result; + } + + private Map deactivateMutate( ComponentContext activateContext ) + { + Map result = new Hashtable( (Map )activateContext.getProperties() ); + result.put( "theValue", "anotherValue3" ); + return result; + } + + public void updateProperties( Dictionary changes ) + { + ( ( ExtComponentContext ) activateContext ).setServiceProperties( changes ); + } + + private Map bindSimpleService( SimpleService ss ) + { + return Collections.singletonMap( "SimpleService", "bound" ); + } + + private Map unbindSimpleService( SimpleService ss ) + { + return Collections.singletonMap( "SimpleService", "unbound" ); + } + + private Map updateSimpleService( SimpleService ss ) + { + return Collections.singletonMap( "SimpleService", "updated" ); + } + + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,180 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.Dictionary; +import java.util.Enumeration; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.ComponentContext; + + +public class SimpleComponent +{ + + // component configuration property whose existence causes the + // activate method to fail + public static final String PROP_ACTIVATE_FAILURE = "request.activation.failure"; + + public static final Map<Long, SimpleComponent> INSTANCES = new HashMap<Long, SimpleComponent>(); + + public static final Set<SimpleComponent> PREVIOUS_INSTANCES = new HashSet<SimpleComponent>(); + + public static SimpleComponent INSTANCE; + + private Map<?, ?> m_config; + + public long m_id; + + public ComponentContext m_activateContext; + + public SimpleService m_singleRef; + + public int m_singleRefBind = 0; + + public int m_singleRefUnbind = 0; + + public final Set<SimpleService> m_multiRef = new HashSet<SimpleService>(); + + public int m_multiRefBind = 0; + + public int m_multiRefUnbind = 0; + + public int m_modified = 0; + + + @SuppressWarnings("unused") + private void activate( ComponentContext activateContext, Map<?, ?> config ) + { + // fail activation if requested so + if ( config.containsKey( PROP_ACTIVATE_FAILURE ) ) + { + throw new RuntimeException( String.valueOf( config.get( PROP_ACTIVATE_FAILURE ) ) ); + } + + m_id = ( Long ) config.get( ComponentConstants.COMPONENT_ID ); + m_activateContext = activateContext; + + INSTANCE = this; + INSTANCES.put( m_id, this ); + setConfig( config ); + + if ( PREVIOUS_INSTANCES.contains( this ) ) + { + System.err.println(); + System.err.println( "An instance has been reused !!!" ); + System.err.println( "Existing: " + PREVIOUS_INSTANCES ); + System.err.println( "New : " + this ); + System.err.println(); + } + else + { + PREVIOUS_INSTANCES.add( this ); + } + } + + + @SuppressWarnings("unused") + private void configure( ComponentContext context ) + { + setConfig( context.getProperties() ); + } + + @SuppressWarnings("unused") + private void modified( ComponentContext context ) + { + setConfig( context.getProperties() ); + m_modified++; + } + + @SuppressWarnings("unused") + private void deactivate() + { + INSTANCES.remove( getProperty( ComponentConstants.COMPONENT_ID ) ); + + m_activateContext = null; + INSTANCE = null; + setConfig( new HashMap<Object, Object>() ); + } + + + protected void setConfig( Map<?, ?> config ) + { + m_config = config; + } + + + protected void setConfig( Dictionary<?, ?> config ) + { + Map<Object, Object> configMap = new HashMap<Object, Object>(); + for ( Enumeration<?> ce = config.keys(); ce.hasMoreElements(); ) + { + Object key = ce.nextElement(); + Object value = config.get( key ); + configMap.put( key, value ); + } + m_config = configMap; + } + + + public Object getProperty( Object name ) + { + return m_config.get( name ); + } + + + // bind method for single service binding + public void setSimpleService( SimpleService simpleService ) + { + this.m_singleRef = simpleService; + this.m_singleRefBind++; + } + + + // unbind method for single service binding + public void unsetSimpleService( SimpleService simpleService ) + { + if ( this.m_singleRef == simpleService ) + { + this.m_singleRef = null; + } + this.m_singleRefUnbind++; + } + + + // bind method for multi-service binding + public void bindSimpleService( SimpleService simpleService ) + { + this.m_multiRef.add( simpleService ); + this.m_multiRefBind++; + } + + + // unbind method for multi-service binding + public void unbindSimpleService( SimpleService simpleService ) + { + this.m_multiRef.remove( simpleService ); + this.m_multiRefUnbind++; + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent2.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent2.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent2.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleComponent2.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,76 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.ArrayList; +import java.util.List; + + +public class SimpleComponent2 +{ + + public static SimpleComponent2 INSTANCE; + + private List<String> bindings = new ArrayList<String>(); + + + public List<String> getBindings() + { + return bindings; + } + + + @SuppressWarnings("unused") + private void activate() + { + INSTANCE = this; + } + + + @SuppressWarnings("unused") + private void deactivate() + { + INSTANCE = null; + } + + + public void bindSimpleService( @SuppressWarnings("unused") SimpleService simpleService ) + { + bindings.add( "bindSimpleService" ); + } + + + public void unbindSimpleService( @SuppressWarnings("unused") SimpleService simpleService ) + { + bindings.add( "unbindSimpleService" ); + } + + + public void bindSimpleService2( @SuppressWarnings("unused") SimpleService2 simpleService2 ) + { + bindings.add( "bindSimpleService2" ); + } + + + public void unbindSimpleService2( @SuppressWarnings("unused") SimpleService2 simpleService2 ) + { + bindings.add( "unbindSimpleService2" ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,26 @@ +/* + * 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.felix.scr.integration.components; + + +public interface SimpleService +{ + + String getValue(); +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,26 @@ +/* + * 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.felix.scr.integration.components; + + +public interface SimpleService2 +{ + + String getValue2(); +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2Impl.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2Impl.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2Impl.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleService2Impl.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,133 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Properties; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; + + +public class SimpleService2Impl implements SimpleService2 +{ + + private String m_value; + + private int m_ranking; + + private String m_filterProp; + + private ServiceRegistration m_registration; + + + public static SimpleService2Impl create( BundleContext bundleContext, String value ) + { + return create( bundleContext, value, 0 ); + } + + + public static SimpleService2Impl create( BundleContext bundleContext, String value, int ranking ) + { + SimpleService2Impl instance = new SimpleService2Impl( value, ranking ); + Dictionary<String,?> props = instance.getProperties(); + instance.setRegistration( bundleContext.registerService( SimpleService2.class.getName(), instance, props ) ); + return instance; + } + + + SimpleService2Impl( final String value, final int ranking ) + { + this.m_value = value; + this.m_ranking = ranking; + this.m_filterProp = "match"; + } + + + private Dictionary<String,?> getProperties() + { + final Dictionary<String, Object> props = new Hashtable<String, Object>(); + props.put( "value", m_value ); + props.put( "filterprop", m_filterProp ); + if ( m_ranking != 0 ) + { + props.put( Constants.SERVICE_RANKING, Integer.valueOf( m_ranking ) ); + } + return props; + } + + + public void update( String value ) + { + if ( this.m_registration != null ) + { + this.m_value = value; + this.m_registration.setProperties( getProperties() ); + } + } + + + public void setFilterProperty( String filterProp ) + { + if ( this.m_registration != null ) + { + this.m_filterProp = filterProp; + this.m_registration.setProperties( getProperties() ); + } + } + + + public void drop() + { + ServiceRegistration sr = getRegistration(); + if ( sr != null ) + { + setRegistration( null ); + sr.unregister(); + } + } + + + public String getValue2() + { + return m_value; + } + + + public void setRegistration( ServiceRegistration registration ) + { + m_registration = registration; + } + + + public ServiceRegistration getRegistration() + { + return m_registration; + } + + + @Override + public String toString() + { + return getClass().getSimpleName() + ": value=" + getValue2() + ", filterprop=" + m_filterProp; + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleServiceImpl.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleServiceImpl.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleServiceImpl.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/SimpleServiceImpl.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,141 @@ +/* + * 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.felix.scr.integration.components; + + +import java.util.Dictionary; +import java.util.Hashtable; +import java.util.Properties; + +import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; +import org.osgi.framework.ServiceRegistration; + + +public class SimpleServiceImpl implements SimpleService +{ + + private String m_value; + + private int m_ranking; + + private String m_filterProp; + + private ServiceRegistration m_registration; + + + public static SimpleServiceImpl create( BundleContext bundleContext, String value ) + { + return create( bundleContext, value, 0 ); + } + + + public static SimpleServiceImpl create( BundleContext bundleContext, String value, int ranking ) + { + SimpleServiceImpl instance = new SimpleServiceImpl( value, ranking ); + Dictionary<String,?> props = instance.getProperties(); + instance.setRegistration( bundleContext.registerService( SimpleService.class.getName(), instance, props ) ); + return instance; + } + + public SimpleServiceImpl() + { + this("", 0); + } + + SimpleServiceImpl( final String value, final int ranking ) + { + this.m_value = value; + this.m_ranking = ranking; + this.m_filterProp = "match"; + } + + + private Dictionary<String,?> getProperties() + { + final Dictionary<String, Object> props = new Hashtable<String, Object>(); + props.put( "value", m_value ); + props.put( "filterprop", m_filterProp ); + if ( m_ranking != 0 ) + { + props.put( Constants.SERVICE_RANKING, Integer.valueOf( m_ranking ) ); + } + return props; + } + + + public SimpleService update( String value ) + { + if ( this.m_registration != null ) + { + this.m_value = value; + this.m_registration.setProperties( getProperties() ); + } + return this; + } + + + public SimpleServiceImpl setFilterProperty( String filterProp ) + { + if ( this.m_registration != null ) + { + this.m_filterProp = filterProp; + this.m_registration.setProperties( getProperties() ); + } + return this; + } + + + public SimpleServiceImpl drop() + { + ServiceRegistration sr = getRegistration(); + if ( sr != null ) + { + setRegistration( null ); + sr.unregister(); + } + return this; + } + + + public String getValue() + { + return m_value; + } + + + public SimpleServiceImpl setRegistration( ServiceRegistration registration ) + { + m_registration = registration; + return this; + } + + + public ServiceRegistration getRegistration() + { + return m_registration; + } + + + @Override + public String toString() + { + return getClass().getSimpleName() + ": value=" + getValue() + ", filterprop=" + m_filterProp; + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/AbstractActivateSignatureTestComponent.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/AbstractActivateSignatureTestComponent.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/AbstractActivateSignatureTestComponent.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/AbstractActivateSignatureTestComponent.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,68 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import java.util.HashMap; +import java.util.Map; + +import org.osgi.service.component.ComponentConstants; +import org.osgi.service.component.ComponentContext; + + +public abstract class AbstractActivateSignatureTestComponent +{ + + private static final Map<String, AbstractActivateSignatureTestComponent> instances = new HashMap<String, AbstractActivateSignatureTestComponent>(); + + public static AbstractActivateSignatureTestComponent getInstance(String name) + { + return instances.get(name); + } + + private String methodCalled; + + + public String getMethodCalled() + { + return methodCalled; + } + + + protected void setMethodCalled( String methodCalled ) + { + this.methodCalled = methodCalled; + instances.put(methodCalled, this); + } + + + protected void setMethodCalled( ComponentContext context ) + { + final String method = ( String ) context.getProperties().get( ComponentConstants.COMPONENT_NAME ); + setMethodCalled( method ); + } + + + protected void setMethodCalled( Map<?, ?> context ) + { + final String method = ( String ) context.get( ComponentConstants.COMPONENT_NAME ); + setMethodCalled( method ); + } + +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_BundleContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_BundleContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_BundleContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_BundleContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.framework.BundleContext; + + +public class Signature_Package_BundleContext extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings("unused") + void activate( BundleContext context ) + { + setMethodCalled( "package_activate_BundleContext" ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_ComponentContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_ComponentContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_ComponentContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_ComponentContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,32 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.service.component.ComponentContext; + + +public class Signature_Package_ComponentContext extends AbstractActivateSignatureTestComponent +{ + + void activate( @SuppressWarnings("unused") ComponentContext context ) + { + setMethodCalled( context ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_Map.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_Map.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_Map.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Package_Map.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import java.util.Map; + + +public class Signature_Package_Map extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings({ "unchecked" }) + void activate( Map config ) + { + setMethodCalled( config ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_BundleContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_BundleContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_BundleContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_BundleContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.framework.BundleContext; + + +public class Signature_Private_BundleContext extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings("unused") + private void activate( BundleContext context ) + { + setMethodCalled( "private_activate_BundleContext" ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_ComponentContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_ComponentContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_ComponentContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_ComponentContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.service.component.ComponentContext; + + +public class Signature_Private_ComponentContext extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings("unused") + private void activate( ComponentContext context ) + { + setMethodCalled( context ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_Map.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_Map.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_Map.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Private_Map.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import java.util.Map; + + +public class Signature_Private_Map extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings({ "unchecked", "unused" }) + private void activate( Map config ) + { + setMethodCalled( config ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_BundleContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_BundleContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_BundleContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_BundleContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.framework.BundleContext; + + +public class Signature_Protected_BundleContext extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings("unused") + protected void activate( BundleContext context ) + { + setMethodCalled( "protected_activate_BundleContext" ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_ComponentContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_ComponentContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_ComponentContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_ComponentContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,32 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.service.component.ComponentContext; + + +public class Signature_Protected_ComponentContext extends AbstractActivateSignatureTestComponent +{ + + protected void activate( @SuppressWarnings("unused") ComponentContext context ) + { + setMethodCalled( context ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_Map.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_Map.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_Map.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Protected_Map.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import java.util.Map; + + +public class Signature_Protected_Map extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings({ "unchecked" }) + protected void activate( Map config ) + { + setMethodCalled( config ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_BundleContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_BundleContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_BundleContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_BundleContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.framework.BundleContext; + + +public class Signature_Public_BundleContext extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings("unused") + public void activate( BundleContext context ) + { + setMethodCalled( "public_activate_BundleContext" ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_ComponentContext.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_ComponentContext.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_ComponentContext.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_ComponentContext.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,32 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import org.osgi.service.component.ComponentContext; + + +public class Signature_Public_ComponentContext extends AbstractActivateSignatureTestComponent +{ + + public void activate( @SuppressWarnings("unused") ComponentContext context ) + { + setMethodCalled( context ); + } +} Added: felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_Map.java URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_Map.java?rev=1689973&view=auto ============================================================================== --- felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_Map.java (added) +++ felix/sandbox/pderop/dependencymanager.ds/org.apache.felix.dependencymanager.ds.itest/src/org/apache/felix/scr/integration/components/activatesignature/Signature_Public_Map.java Wed Jul 8 22:10:14 2015 @@ -0,0 +1,33 @@ +/* + * 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.felix.scr.integration.components.activatesignature; + + +import java.util.Map; + + +public class Signature_Public_Map extends AbstractActivateSignatureTestComponent +{ + + @SuppressWarnings({ "unchecked" }) + public void activate( Map config ) + { + setMethodCalled( config ); + } +}
