From 3881a5dd9d85c782defb443982f46ad9d6df8126 Mon Sep 17 00:00:00 2001 From: Vaclav Haisman Date: Mon, 24 Aug 2026 19:27:07 +0200 Subject: [PATCH] Delete iPOJO --- README.md | 1 - ipojo/.gitignore | 4 - ipojo/arch/changelog.txt | 26 - ipojo/arch/obr.xml | 24 - ipojo/arch/pom.xml | 118 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../felix/ipojo/arch/ArchCommandImpl.java | 233 --- .../FooService-And-Impl/pom.xml | 65 - .../apache/felix/ipojo/foo/FooService.java | 29 - .../felix/ipojo/foo/impl/FooServiceImpl.java | 41 - .../Log-Handler-Consumer/pom.xml | 57 - .../log/handler/example/SimpleComponent.java | 26 - .../Log-Handler-In-Felix/pom.xml | 107 -- .../handler-tutorial/Log-Handler/pom.xml | 76 - .../apache/felix/ipojo/log/handler/Log.java | 35 - .../felix/ipojo/log/handler/LogHandler.java | 109 -- .../Property-Handler-Consumer/pom.xml | 68 - .../src/main/ipojo/metadata.xml | 9 - .../properties/example/PropertiesTester.java | 78 - .../Property-Handler-In-Felix/pom.xml | 120 -- .../resources/props/my-properties.properties | 21 - .../resources/props/properties-i1.properties | 21 - .../handler-tutorial/Property-Handler/pom.xml | 61 - .../ipojo/handler/properties/Properties.java | 33 - .../handler/properties/PropertiesHandler.java | 295 --- ipojo/distributions/handler-tutorial/pom.xml | 139 -- .../ipojo-webconsole-quicktart/pom.xml | 148 -- .../src/main/assembly/distribution.xml | 59 - ipojo/distributions/pom.xml | 92 - ipojo/handler/eventadmin/changelog.txt | 32 - .../eventadmin/eventadmin-handler-it/pom.xml | 378 ---- .../src/it/event-admin-it/pom.xml | 46 - .../test/donut/AsyncEventProviderImpl.java | 74 - .../handler/eventadmin/test/donut/Donut.java | 100 - .../eventadmin/test/donut/DonutConsumer.java | 81 - .../test/donut/DonutConsumerImpl.java | 194 -- .../test/donut/DonutEventProviderImpl.java | 74 - .../eventadmin/test/donut/DonutProvider.java | 35 - .../test/donut/DonutProviderImpl.java | 76 - .../test/donut/EventConsumerImpl.java | 199 -- .../eventadmin/test/donut/EventTracker.java | 63 - .../test/donut/EventTrackerImpl.java | 152 -- .../test/donut/SyncEventProviderImpl.java | 74 - .../src/main/resources/metadata.xml | 199 -- .../ipojo/handler/eventadmin/test/Common.java | 76 - .../handler/eventadmin/test/EahTestUtils.java | 226 --- .../test/TestBadConfigurations.java | 958 ---------- .../test/TestEventAdminHandler.java | 714 ------- ...estEventAdminHandlerWithNewAttributes.java | 715 ------- .../eventadmin/test/TestPublisher.java | 714 ------- .../main/appended-resources/META-INF/NOTICE | 0 .../eventadmin-handler/changelog.txt | 32 - .../eventadmin-handler/metadata.xml | 41 - .../eventadmin/eventadmin-handler/obr.xml | 31 - .../eventadmin/eventadmin-handler/pom.xml | 113 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../felix/ipojo/handlers/event/EventUtil.java | 173 -- .../publisher/EventAdminPublisherHandler.java | 282 --- ...EventAdminPublisherHandlerDescription.java | 102 - .../EventAdminPublisherMetadata.java | 242 --- .../handlers/event/publisher/Publisher.java | 70 - .../event/publisher/PublisherDescription.java | 76 - .../event/publisher/PublisherImpl.java | 145 -- .../EventAdminSubscriberHandler.java | 421 ----- ...ventAdminSubscriberHandlerDescription.java | 61 - .../EventAdminSubscriberMetadata.java | 305 --- .../src/main/resources/event-admin.xsd | 90 - ipojo/handler/eventadmin/pom.xml | 37 - .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 ipojo/handler/extender/changelog.txt | 26 - ipojo/handler/extender/metadata.xml | 24 - ipojo/handler/extender/obr.xml | 25 - ipojo/handler/extender/pom.xml | 102 - .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../ipojo/handler/extender/BundleTracker.java | 157 -- .../handler/extender/ExtenderManager.java | 135 -- .../extender/ExtenderModelHandler.java | 95 - .../src/main/resources/extender-pattern.xsd | 42 - ipojo/handler/jmx/changelog.txt | 23 - ipojo/handler/jmx/jmx-handler-it/pom.xml | 389 ---- .../jmx/jmx-handler-it/src/it/jmx-it/pom.xml | 52 - .../components/SimpleManagedComponent.java | 55 - .../SimpleManagedComponentAnnotated.java | 69 - ...leManagedComponentAnnotatedDeprecated.java | 70 - .../it/jmx-it/src/main/resources/metadata.xml | 46 - .../felix/ipojo/handler/jmx/test/Common.java | 216 --- .../ipojo/handler/jmx/test/TestMBean.java | 224 --- .../main/appended-resources/META-INF/NOTICE | 0 ipojo/handler/jmx/jmx-handler/changelog.txt | 23 - ipojo/handler/jmx/jmx-handler/metadata.xml | 22 - ipojo/handler/jmx/jmx-handler/obr.xml | 30 - ipojo/handler/jmx/jmx-handler/pom.xml | 105 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../ipojo/handlers/jmx/DynamicMBeanImpl.java | 408 ---- .../jmx/DynamicMBeanWRegisterImpl.java | 165 -- .../handlers/jmx/JMXHandlerDescription.java | 71 - .../ipojo/handlers/jmx/JmxConfigFieldMap.java | 297 --- .../ipojo/handlers/jmx/MBeanHandler.java | 664 ------- .../felix/ipojo/handlers/jmx/MethodField.java | 101 - .../ipojo/handlers/jmx/NotificationField.java | 69 - .../ipojo/handlers/jmx/PropertyField.java | 196 -- .../jmx-handler/src/main/resources/jmx.xsd | 177 -- ipojo/handler/jmx/pom.xml | 115 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 ipojo/handler/temporal/changelog.txt | 42 - ipojo/handler/temporal/pom.xml | 115 -- .../appended-resources/META-INF/DEPENDENCIES | 17 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 4 - .../temporal-dependency-handler-it/pom.xml | 390 ---- .../src/it/temporal-it/pom.xml | 46 - .../components/CheckServiceProvider.java | 47 - .../CollectionCheckServiceProvider.java | 58 - .../temporal/components/FooProvider.java | 55 - .../MultipleCheckServiceProvider.java | 48 - .../components/NullableFooProvider.java | 55 - .../proxy/CheckServiceProviderHelper.java | 64 - .../CollectionCheckServiceProviderHelper.java | 62 - .../proxy/HelpedCheckServiceProvider.java | 43 - .../HelpedCollectionCheckServiceProvider.java | 43 - .../handler/temporal/services/BarService.java | 29 - .../temporal/services/CheckService.java | 31 - .../temporal/services/ChildInterface.java | 25 - .../handler/temporal/services/FooService.java | 39 - .../temporal/services/ParentInterface1.java | 25 - .../temporal/services/ParentInterface2.java | 25 - .../services/ParentParentInterface.java | 25 - .../src/main/resources/metadata.xml | 262 --- .../ipojo/handler/temporal/test/Common.java | 40 - .../test/DefaultImplementationTest.java | 535 ------ .../handler/temporal/test/DelayTest.java | 494 ----- .../temporal/test/DelayedProvider.java | 71 - .../handler/temporal/test/EmptyTest.java | 303 --- .../handler/temporal/test/FilterTest.java | 264 --- .../handler/temporal/test/NoDelayTest.java | 146 -- .../ipojo/handler/temporal/test/NullTest.java | 536 ------ .../handler/temporal/test/NullableTest.java | 535 ------ .../handler/temporal/test/TemporalTest.java | 345 ---- .../main/appended-resources/META-INF/NOTICE | 0 .../temporal-dependency-handler/changelog.txt | 42 - .../temporal-dependency-handler/obr.xml | 25 - .../temporal-dependency-handler/pom.xml | 122 -- .../appended-resources/META-INF/DEPENDENCIES | 17 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 4 - .../handler/temporal/ProxyGenerator.java | 183 -- .../handler/temporal/ServiceCollection.java | 334 ---- .../ipojo/handler/temporal/ServiceUsage.java | 77 - .../handler/temporal/TemporalDependency.java | 555 ------ .../handler/temporal/TemporalHandler.java | 317 ---- .../src/main/resources/metadata.xml | 28 - .../src/main/resources/temporal.xsd | 63 - ipojo/handler/transaction/pom.xml | 115 -- .../transaction-handler-it/pom.xml | 413 ----- .../src/it/transaction-it/pom.xml | 52 - .../components/ComponentUsingAnnotations.java | 53 - .../transaction/components/FooDelegator.java | 96 - .../transaction/components/FooImpl.java | 47 - .../transaction/services/CheckService.java | 44 - .../handler/transaction/services/Foo.java | 32 - .../src/main/resources/annotation.xml | 22 - .../transaction-it/src/main/resources/foo.xml | 24 - .../src/main/resources/mandatory.xml | 44 - .../src/main/resources/never.xml | 44 - .../src/main/resources/notsupported.xml | 44 - .../src/main/resources/requires.xml | 44 - .../src/main/resources/requiresnew.xml | 44 - .../src/main/resources/supported.xml | 44 - .../handler/transaction/test/Common.java | 217 --- .../transaction/test/TestAnnotations.java | 138 -- .../transaction/test/TestInstallation.java | 128 -- .../transaction/test/TestInvalidation.java | 121 -- .../transaction/test/TestMandatory.java | 397 ---- .../handler/transaction/test/TestNever.java | 169 -- .../transaction/test/TestNotSupported.java | 403 ---- .../transaction/test/TestRequires.java | 406 ---- .../transaction/test/TestRequiresNew.java | 219 --- .../transaction/test/TestSupported.java | 411 ---- .../main/appended-resources/META-INF/NOTICE | 0 .../transaction/transaction-handler/pom.xml | 99 - .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../ipojo/transaction/TransactionHandler.java | 310 ---- .../transaction/TransactionalMethod.java | 306 --- .../src/main/resources/metadata.xml | 32 - ipojo/handler/whiteboard/changelog.txt | 33 - ipojo/handler/whiteboard/pom.xml | 115 -- .../appended-resources/META-INF/DEPENDENCIES | 12 - .../main/appended-resources/META-INF/NOTICE | 0 .../whiteboard/whiteboard-handler-it/pom.xml | 385 ---- .../src/it/whiteboard-it/pom.xml | 52 - .../whiteboard/components/FooProvider.java | 36 - .../components/FooWhiteBoardPattern.java | 94 - .../whiteboard/services/FooService.java | 26 - .../whiteboard/services/Observable.java | 28 - .../src/main/resources/metadata.xml | 65 - .../ipojo/handler/whiteboard/test/Common.java | 216 --- .../test/TestWhiteboardPatternHandler.java | 302 --- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../whiteboard-handler/changelog.txt | 33 - .../whiteboard-handler/metadata.xml | 30 - .../whiteboard/whiteboard-handler/obr.xml | 25 - .../whiteboard/whiteboard-handler/pom.xml | 103 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../ipojo/handler/wbp/WhiteBoardManager.java | 174 -- .../handler/wbp/WhiteBoardPatternHandler.java | 131 -- .../src/main/resources/whiteboard-pattern.xsd | 45 - ipojo/junit4osgi/felix-command/LICENSE | 202 -- ipojo/junit4osgi/felix-command/NOTICE | 28 - .../felix-command/doc/changelog.txt | 3 - ipojo/junit4osgi/felix-command/metadata.xml | 28 - ipojo/junit4osgi/felix-command/pom.xml | 111 -- .../junit4osgi/command/JunitCommand.java | 140 -- ipojo/junit4osgi/immediate-launcher/LICENSE | 202 -- ipojo/junit4osgi/immediate-launcher/NOTICE | 27 - .../immediate-launcher/metadata.xml | 29 - ipojo/junit4osgi/immediate-launcher/pom.xml | 111 -- .../junit4osgi/command/ImmediateRunner.java | 42 - ipojo/junit4osgi/junit4osgi/LICENSE | 202 -- ipojo/junit4osgi/junit4osgi/LICENSE.junit | 86 - ipojo/junit4osgi/junit4osgi/NOTICE | 27 - ipojo/junit4osgi/junit4osgi/doc/changelog.txt | 3 - ipojo/junit4osgi/junit4osgi/metadata.xml | 36 - ipojo/junit4osgi/junit4osgi/pom.xml | 152 -- .../apache/felix/ipojo/junit4osgi/Helper.java | 58 - .../ipojo/junit4osgi/OSGiJunitRunner.java | 72 - .../felix/ipojo/junit4osgi/OSGiTestCase.java | 782 -------- .../felix/ipojo/junit4osgi/OSGiTestSuite.java | 127 -- .../ipojo/junit4osgi/helpers/IPOJOHelper.java | 737 -------- .../ipojo/junit4osgi/impl/JunitExtender.java | 399 ---- .../ipojo/junit4osgi/impl/LogServiceImpl.java | 107 -- .../ipojo/junit4osgi/impl/ResultPrinter.java | 227 --- .../junit4osgi/test/TestOSGiTestCase.java | 37 - .../junit4osgi/test/TestOSGiTestSuite.java | 48 - .../ipojo/junit4osgi/test/TestTestCase.java | 49 - .../ipojo/junit4osgi/test/TestTestSuite.java | 41 - .../maven-junit4osgi-plugin/LICENSE | 202 -- .../junit4osgi/maven-junit4osgi-plugin/NOTICE | 31 - .../maven-junit4osgi-plugin/doc/changelog.txt | 3 - .../maven-junit4osgi-plugin/pom.xml | 113 -- .../ipojo/junit4osgi/plugin/Installer.java | 207 --- .../junit4osgi/plugin/Junit4osgiPlugin.java | 755 -------- .../felix/ipojo/junit4osgi/plugin/Report.java | 239 --- .../junit4osgi/plugin/ReportPrintStream.java | 101 - .../junit4osgi/plugin/StringOutputStream.java | 121 -- .../ipojo/junit4osgi/plugin/XMLReport.java | 359 ---- .../junit4osgi/plugin/log/LogServiceImpl.java | 187 -- ipojo/junit4osgi/pom.xml | 59 - ipojo/junit4osgi/swing-runner/LICENSE | 202 -- ipojo/junit4osgi/swing-runner/NOTICE | 27 - .../junit4osgi/swing-runner/doc/changelog.txt | 3 - ipojo/junit4osgi/swing-runner/metadata.xml | 28 - ipojo/junit4osgi/swing-runner/pom.xml | 104 -- .../command/ResultCellRenderer.java | 69 - .../junit4osgi/command/ResultTableModel.java | 278 --- .../ipojo/junit4osgi/command/SwingRunner.form | 317 ---- .../ipojo/junit4osgi/command/SwingRunner.java | 543 ------ .../junit4osgi/command/TestListModel.java | 129 -- ipojo/manipulator/annotations/changelog.txt | 225 --- ipojo/manipulator/annotations/pom.xml | 57 - .../src/main/appended-resources/NOTICE | 0 .../apache/felix/ipojo/annotations/Bind.java | 87 - .../ipojo/annotations/BindingPolicy.java | 29 - .../felix/ipojo/annotations/Component.java | 178 -- .../felix/ipojo/annotations/Context.java | 54 - .../felix/ipojo/annotations/Controller.java | 52 - .../felix/ipojo/annotations/Handler.java | 63 - .../ipojo/annotations/HandlerBinding.java | 85 - .../ipojo/annotations/HandlerDeclaration.java | 44 - .../felix/ipojo/annotations/Ignore.java | 42 - .../felix/ipojo/annotations/Instantiate.java | 55 - .../felix/ipojo/annotations/Invalidate.java | 38 - .../felix/ipojo/annotations/Modified.java | 81 - .../ipojo/annotations/PostRegistration.java | 40 - .../ipojo/annotations/PostUnregistration.java | 40 - .../felix/ipojo/annotations/Property.java | 56 - .../felix/ipojo/annotations/Provides.java | 92 - .../felix/ipojo/annotations/Requires.java | 112 -- .../ipojo/annotations/ServiceController.java | 43 - .../ipojo/annotations/ServiceProperty.java | 57 - .../annotations/StaticServiceProperty.java | 61 - .../felix/ipojo/annotations/Stereotype.java | 72 - .../felix/ipojo/annotations/Unbind.java | 88 - .../felix/ipojo/annotations/Updated.java | 47 - .../felix/ipojo/annotations/Validate.java | 38 - .../apache/felix/ipojo/extender/Extender.java | 49 - .../ipojo/handler/temporal/Requires.java | 70 - .../ipojo/handler/temporal/Temporal.java | 75 - .../felix/ipojo/handlers/event/Publisher.java | 69 - .../felix/ipojo/handlers/event/Publishes.java | 60 - .../ipojo/handlers/event/Subscriber.java | 83 - .../felix/ipojo/handlers/jmx/Config.java | 62 - .../felix/ipojo/handlers/jmx/JMXBean.java | 61 - .../felix/ipojo/handlers/jmx/JMXMethod.java | 42 - .../felix/ipojo/handlers/jmx/JMXProperty.java | 55 - .../felix/ipojo/handlers/jmx/Method.java | 43 - .../felix/ipojo/handlers/jmx/Property.java | 56 - .../felix/ipojo/transaction/Transaction.java | 51 - .../ipojo/transaction/Transactional.java | 56 - .../apache/felix/ipojo/whiteboard/Wbp.java | 54 - .../felix/ipojo/whiteboard/Whiteboards.java | 38 - .../bnd-ipojo-plugin/changelog.txt | 152 -- ipojo/manipulator/bnd-ipojo-plugin/pom.xml | 108 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 1 - .../felix/ipojo/bnd/BndJarResourceStore.java | 243 --- .../apache/felix/ipojo/bnd/BndReporter.java | 84 - .../felix/ipojo/bnd/ByteArrayResource.java | 43 - .../org/apache/felix/ipojo/bnd/Manifests.java | 56 - .../felix/ipojo/bnd/PojoizationPlugin.java | 191 -- .../ipojo/bnd/ResourceMetadataProvider.java | 75 - .../bnd/BndJarResourceStoreTestCase.java | 170 -- .../felix/ipojo/bnd/EmptyComponent.java | 31 - .../ipojo/bnd/PojoizationPluginTestCase.java | 110 -- .../test/resources/EMBED-MANIFEST-EMPTY.MF | 6 - .../src/test/resources/EMBED-MANIFEST.MF | 21 - .../metadata-components-and-instances.xml | 24 - .../resources/metadata-components-only.xml | 22 - .../resources/metadata-instances-only.xml | 22 - .../resources/metadata-test-component.xml | 22 - ipojo/manipulator/changelog.txt | 158 -- .../manipulator/ipojo-ant-task/changelog.txt | 197 -- ipojo/manipulator/ipojo-ant-task/pom.xml | 171 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 3 - .../apache/felix/ipojo/task/AntReporter.java | 68 - .../apache/felix/ipojo/task/IPojoTask.java | 348 ---- .../org/apache/felix/ipojo/task/IPojoc.java | 247 --- .../resources/META-INF/constants.properties | 22 - ....apache.felix.ipojo.manipulator.spi.Module | 1 - .../main/resources/META-INF/xsd/composite.xsd | 147 -- .../src/main/resources/META-INF/xsd/core.xsd | 704 ------- .../resources/META-INF/xsd/event-admin.xsd | 90 - .../META-INF/xsd/extender-pattern.xsd | 42 - .../src/main/resources/META-INF/xsd/jmx.xsd | 177 -- .../main/resources/META-INF/xsd/temporal.xsd | 61 - .../META-INF/xsd/whiteboard-pattern.xsd | 45 - ipojo/manipulator/manipulator-bom/pom.xml | 73 - .../ipojo-manipulator-creation-test/pom.xml | 33 - .../core/components/ASimpleParentClass.java | 30 - .../core/components/CallSuperConstructor.java | 29 - .../CallSuperConstructorWithBC.java | 32 - .../CallSuperConstructorWithNew.java | 29 - .../CallSuperSuperConstructorWithNew.java | 29 - .../core/components/FooProviderType1.java | 118 -- .../core/components/NoEmptyConstructor.java | 50 - .../NoEmptyConstructorWithParentClass.java | 46 - .../runtime/core/components/ParentClass.java | 34 - .../runtime/core/components/ParentClass2.java | 28 - .../core/components/ParentClassWithBC.java | 33 - .../core/components/SeveralConstructors.java | 50 - .../core/components/SuperParentClass.java | 36 - .../core/services/A123/CheckService2.java | 26 - .../runtime/core/services/BarService.java | 30 - .../runtime/core/services/CheckService.java | 32 - .../runtime/core/services/FooService.java | 40 - .../ipojo/runtime/core/services/Plop.java | 26 - .../PrimitiveManipulationTestService.java | 76 - .../src/main/resources/metadata.xml | 95 - .../ipojo/runtime/core/TestPOJOCreation.java | 283 --- .../runtime/core/TestSeveralConstructor.java | 72 - .../pom.xml | 35 - .../ipojo/runtime/core/components/Child.java | 28 - .../components/ComponentWithInnerClasses.java | 75 - .../core/components/FooBarProviderType1.java | 65 - .../core/components/FooProviderType1.java | 129 -- .../core/components/FooProviderTypeDyn.java | 77 - .../core/components/Manipulation23Tester.java | 189 -- .../core/components/Multiconstructor.java | 36 - .../core/components/MultipleCheckService.java | 159 -- .../ipojo/runtime/core/components/Parent.java | 34 - .../core/services/A123/CheckService2.java | 26 - .../runtime/core/services/BarService.java | 30 - .../runtime/core/services/CheckService.java | 32 - .../runtime/core/services/FooService.java | 40 - .../ipojo/runtime/core/services/Plop.java | 26 - .../PrimitiveManipulationTestService.java | 76 - .../src/main/resources/metadata.xml | 76 - .../core/TestManipulationMetadata.java | 295 --- .../core/TestManipulationMetadataAPI.java | 330 ---- .../pom.xml | 35 - .../components/A123/Manipulation23Tester.java | 189 -- .../runtime/core/components/Annotation.java | 63 - .../core/components/FooProviderType1.java | 129 -- .../core/components/FooServiceImpl.java | 63 - .../HandlerBindingTestComponent.java | 61 - .../core/components/ImmediateComponent.java | 40 - .../runtime/core/components/InnerClasses.java | 213 --- .../runtime/core/components/Invisible.java | 24 - .../core/components/Manipulation23Tester.java | 130 -- .../ipojo/runtime/core/components/Marker.java | 40 - .../runtime/core/components/MultiBind.java | 39 - .../runtime/core/components/PlopImpl.java | 31 - .../components/StereotypedBazComponent.java | 35 - .../core/components/StereotypedMultiBind.java | 37 - .../runtime/core/components/SubMarker.java | 31 - .../runtime/core/components/Switches.java | 88 - .../core/components/TestTypedList.java | 51 - .../components/nativ/NativeComponent.java | 46 - .../ipojo/runtime/core/handlers/Foo.java | 39 - .../runtime/core/handlers/FooHandler.java | 84 - .../runtime/core/handlers/IgnoredFoo.java | 40 - .../core/services/A123/CheckService2.java | 26 - .../runtime/core/services/BarService.java | 30 - .../runtime/core/services/BazService.java | 29 - .../runtime/core/services/CheckService.java | 32 - .../ipojo/runtime/core/services/Color.java | 30 - .../runtime/core/services/FooService.java | 40 - .../services/HandlerBindingTestService.java | 29 - .../ipojo/runtime/core/services/Job.java | 29 - .../ipojo/runtime/core/services/Plop.java | 26 - .../PrimitiveManipulationTestService.java | 76 - .../src/main/resources/libs/linux32/libfoo.so | Bin 7011 -> 0 bytes .../src/main/resources/libs/linux64/libfoo.so | Bin 6629 -> 0 bytes .../src/main/resources/libs/mac/libfoo.jnilib | Bin 8696 -> 0 bytes .../src/main/resources/metadata-java5.xml | 50 - .../main/resources/metadata-primitives.xml | 41 - .../src/main/resources/metadata.xml | 61 - .../core/TestAnnotationProcessing.java | 193 -- .../runtime/core/TestDuplicateMethods.java | 51 - .../runtime/core/TestExceptionHandling.java | 100 - .../ipojo/runtime/core/TestGenericList.java | 86 - .../core/TestGetComponentInstance.java | 112 -- ...TestHandlerBindingAndIgnoreAnnotation.java | 84 - .../ipojo/runtime/core/TestNativeMethod.java | 169 -- .../ipojo/runtime/core/TestNestedClasses.java | 228 --- .../runtime/core/TestPrimitiveTypes.java | 117 -- .../TestPrimitiveTypesWithNumberInNames.java | 121 -- .../core/TestStereotypeAnnotation.java | 86 - .../ipojo/runtime/core/TestSwitches.java | 87 - .../ipojo/runtime/core/TestTypeBoxing.java | 84 - .../online-manipulator-it/pom.xml | 35 - .../test/online/components/Consumer.java | 36 - .../online/components/FrenchHelloService.java | 40 - .../online/components/GermanHelloService.java | 40 - .../test/online/components/MyProvider.java | 31 - .../components/MyProviderWithAnnotations.java | 37 - .../ipojo/test/online/module/Activator.java | 45 - .../felix/ipojo/test/online/module/Type.java | 36 - .../felix/ipojo/test/online/module/Type2.java | 38 - .../ipojo/test/online/module/TypeModule.java | 84 - .../ipojo/test/online/services/Hello.java | 26 - .../src/main/resources/consumer.xml | 22 - .../src/main/resources/provider.xml | 25 - .../test/online/OnlineManipulatorTest.java | 593 ------ ipojo/manipulator/manipulator-it/pom.xml | 413 ----- .../main/appended-resources/META-INF/NOTICE | 0 ipojo/manipulator/manipulator/changelog.txt | 249 --- ipojo/manipulator/manipulator/pom.xml | 197 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 3 - .../ipojo/manipulation/ClassChecker.java | 857 --------- .../ClassLoaderAwareClassWriter.java | 92 - .../ipojo/manipulation/ClassManipulator.java | 1184 ------------ .../manipulation/ConstructorCodeAdapter.java | 300 --- .../ipojo/manipulation/InnerClassAdapter.java | 341 ---- .../ipojo/manipulation/InnerClassChecker.java | 61 - .../manipulation/ManipulationProperty.java | 124 -- .../felix/ipojo/manipulation/Manipulator.java | 314 ---- .../ipojo/manipulation/MethodCodeAdapter.java | 122 -- .../ipojo/manipulation/MethodDescriptor.java | 264 --- .../manipulator/ManifestAttributeFilter.java | 39 - .../ipojo/manipulator/ManifestProvider.java | 37 - .../ipojo/manipulator/ManipulationEngine.java | 185 -- .../ManipulationResultVisitor.java | 48 - .../ipojo/manipulator/ManipulationUnit.java | 70 - .../manipulator/ManipulationVisitor.java | 48 - .../ipojo/manipulator/MetadataProvider.java | 40 - .../felix/ipojo/manipulator/Pojoization.java | 388 ---- .../ipojo/manipulator/QuotedTokenizer.java | 200 -- .../felix/ipojo/manipulator/Reporter.java | 74 - .../ipojo/manipulator/ResourceStore.java | 76 - .../ipojo/manipulator/ResourceVisitor.java | 34 - .../manifest/DirectManifestProvider.java | 49 - .../manifest/FileManifestProvider.java | 63 - .../metadata/AnnotationMetadataProvider.java | 126 -- .../metadata/CacheableMetadataProvider.java | 62 - .../metadata/CompositeMetadataProvider.java | 99 - .../metadata/EmptyMetadataProvider.java | 42 - .../metadata/FileMetadataProvider.java | 109 -- .../metadata/StreamMetadataProvider.java | 113 -- .../annotation/ClassMetadataCollector.java | 196 -- .../annotation/ComponentWorkbench.java | 176 -- .../annotation/FieldMetadataCollector.java | 73 - .../annotation/MethodMetadataCollector.java | 95 - .../annotation/model/AnnotationDiscovery.java | 31 - .../annotation/model/AnnotationType.java | 54 - .../metadata/annotation/model/Playback.java | 42 - .../discovery/ChainedAnnotationDiscovery.java | 57 - .../discovery/HandlerBindingDiscovery.java | 76 - .../model/discovery/IgnoredDiscovery.java | 48 - .../model/discovery/StereotypeDiscovery.java | 48 - .../model/literal/AnnotationPlayback.java | 264 --- .../model/parser/AnnotationParser.java | 38 - .../model/parser/AnnotationTypeVisitor.java | 58 - .../parser/replay/AnnotationRecorder.java | 68 - .../replay/AnnotationVisitorPlayback.java | 77 - .../model/parser/replay/Replay.java | 31 - .../annotation/model/parser/replay/Visit.java | 41 - .../model/parser/replay/VisitAnnotation.java | 46 - .../model/parser/replay/VisitArray.java | 44 - .../model/parser/replay/VisitEnd.java | 34 - .../model/parser/replay/VisitEnum.java | 42 - .../module/DefaultBindingModule.java | 290 --- .../metadata/annotation/registry/Binding.java | 67 - .../annotation/registry/BindingRegistry.java | 43 - .../registry/CompletableBindingRegistry.java | 62 - .../registry/DefaultBindingRegistry.java | 79 - .../registry/IgnoreAllBindingRegistry.java | 46 - .../LegacyGenericBindingRegistry.java | 95 - .../MetaAnnotationBindingRegistry.java | 164 -- .../annotation/registry/Selection.java | 150 -- .../annotation/visitor/ComponentVisitor.java | 139 -- .../annotation/visitor/ControllerVisitor.java | 54 - .../visitor/FieldPropertyVisitor.java | 164 -- .../visitor/HandlerDeclarationVisitor.java | 160 -- .../annotation/visitor/HandlerVisitor.java | 94 - .../visitor/InstantiateVisitor.java | 71 - .../annotation/visitor/LifecycleVisitor.java | 58 - .../visitor/MethodPropertyVisitor.java | 177 -- .../visitor/ParameterPropertyVisitor.java | 66 - .../visitor/PostRegistrationVisitor.java | 52 - .../visitor/PostUnregistrationVisitor.java | 52 - .../annotation/visitor/ProvidesVisitor.java | 138 -- .../annotation/visitor/RequiresVisitor.java | 268 --- .../visitor/ServiceControllerVisitor.java | 81 - .../annotation/visitor/UpdatedVisitor.java | 51 - .../visitor/bind/AbstractBindVisitor.java | 223 --- .../annotation/visitor/bind/Action.java | 27 - .../visitor/bind/MethodBindVisitor.java | 89 - .../visitor/bind/ParameterBindVisitor.java | 63 - .../visitor/generic/FieldGenericVisitor.java | 37 - .../visitor/generic/GenericVisitor.java | 114 -- .../generic/GenericVisitorFactory.java | 70 - .../visitor/generic/MethodGenericVisitor.java | 39 - .../generic/ParameterGenericVisitor.java | 54 - .../visitor/generic/RootGenericVisitor.java | 109 -- .../visitor/generic/SubArrayVisitor.java | 130 -- .../visitor/generic/TypeGenericVisitor.java | 34 - .../visitor/ignore/NullBinding.java | 40 - .../visitor/ignore/NullVisitorFactory.java | 42 - .../stereotype/FieldStereotypeVisitor.java | 49 - .../stereotype/MethodStereotypeVisitor.java | 49 - .../ParameterStereotypeVisitor.java | 53 - .../stereotype/StereotypeVisitorFactory.java | 68 - .../stereotype/TypeStereotypeVisitor.java | 51 - .../annotation/visitor/util/Bindings.java | 56 - .../annotation/visitor/util/Elements.java | 94 - .../annotation/visitor/util/Names.java | 136 -- .../render/ManipulatedMetadataFilter.java | 53 - .../manipulator/render/MetadataFilter.java | 39 - .../manipulator/render/MetadataRenderer.java | 140 -- .../manipulator/reporter/EmptyReporter.java | 84 - .../manipulator/reporter/SystemReporter.java | 112 -- .../manipulator/spi/AbsBindingModule.java | 212 --- .../manipulator/spi/AnnotationLiteral.java | 84 - .../spi/AnnotationVisitorFactory.java | 34 - .../ipojo/manipulator/spi/BindingContext.java | 162 -- .../felix/ipojo/manipulator/spi/Module.java | 37 - .../ipojo/manipulator/spi/ModuleProvider.java | 38 - .../ipojo/manipulator/spi/Predicate.java | 39 - .../manipulator/spi/helper/Predicates.java | 224 --- .../spi/provider/CompositeModuleProvider.java | 55 - .../spi/provider/CoreModuleProvider.java | 33 - .../spi/provider/DefaultModuleProvider.java | 53 - .../provider/ServiceLoaderModuleProvider.java | 52 - .../store/DirectoryResourceStore.java | 170 -- .../store/JarFileResourceStore.java | 250 --- .../manipulator/store/ManifestBuilder.java | 52 - .../manipulator/store/ResourceMapper.java | 43 - .../store/builder/DefaultManifestBuilder.java | 262 --- .../mapper/FileSystemResourceMapper.java | 75 - .../store/mapper/IdentityResourceMapper.java | 37 - .../store/mapper/WABResourceMapper.java | 58 - .../util/ChainedAnnotationVisitor.java | 92 - .../ipojo/manipulator/util/Classpath.java | 180 -- .../ipojo/manipulator/util/Collections5.java | 85 - .../ipojo/manipulator/util/Constants.java | 60 - .../manipulator/util/IsolatedClassLoader.java | 85 - .../ipojo/manipulator/util/Metadatas.java | 120 -- .../felix/ipojo/manipulator/util/Streams.java | 101 - .../felix/ipojo/manipulator/util/Strings.java | 55 - .../visitor/ManipulationAdapter.java | 51 - .../visitor/ManipulationResultAdapter.java | 50 - .../CheckFieldConsistencyResultVisitor.java | 104 -- .../check/CheckFieldConsistencyVisitor.java | 52 - .../writer/ManipulatedResourcesWriter.java | 81 - .../writer/ManipulatedResultWriter.java | 60 - .../ipojo/xml/parser/ParseException.java | 40 - .../ipojo/xml/parser/SchemaResolver.java | 81 - .../ipojo/xml/parser/XMLMetadataParser.java | 295 --- .../resources/META-INF/constants.properties | 22 - ....apache.felix.ipojo.manipulator.spi.Module | 1 - .../src/main/resources/xsd/composite.xsd | 147 -- .../src/main/resources/xsd/core.xsd | 704 ------- .../src/main/resources/xsd/event-admin.xsd | 90 - .../main/resources/xsd/extender-pattern.xsd | 42 - .../src/main/resources/xsd/jmx.xsd | 177 -- .../src/main/resources/xsd/temporal.xsd | 61 - .../main/resources/xsd/whiteboard-pattern.xsd | 45 - .../apache/felix/ipojo/ComponentInstance.java | 31 - .../apache/felix/ipojo/InstanceManager.java | 51 - .../java/org/apache/felix/ipojo/Pojo.java | 29 - .../manipulation/ClassCheckerTestCase.java | 129 -- .../manipulation/DirManipulationTest.java | 101 - .../manipulation/InnerClassAdapterTest.java | 399 ---- .../manipulation/ManipulatedClassLoader.java | 97 - .../ipojo/manipulation/ManipulatorTest.java | 495 ----- .../ipojo/manipulation/PojoizationTest.java | 65 - .../manipulation/RemanipulationTest.java | 162 -- .../ManipulationEngineTestCase.java | 113 -- .../DirectManifestProviderTestCase.java | 33 - .../FileManifestProviderTestCase.java | 37 - .../AnnotationMetadataProviderTestCase.java | 94 - .../CacheableMetadataProviderTestCase.java | 46 - .../CompositeMetadataProviderTestCase.java | 112 -- .../EmptyMetadataProviderTestCase.java | 29 - .../FileMetadataProviderTestCase.java | 51 - .../StreamMetadataProviderTestCase.java | 60 - .../ComponentWorkbenchTestCase.java | 90 - .../literal/AnnotationPlaybackTestCase.java | 196 -- .../literal/types/AnnotationAnnotation.java | 36 - .../model/literal/types/ArrayAnnotation.java | 40 - .../model/literal/types/EnumAnnotation.java | 38 - .../model/literal/types/InnerAnnotation.java | 37 - .../annotation/model/literal/types/Mode.java | 29 - .../model/literal/types/SimpleTypes.java | 56 - .../model/literal/types/Support.java | 44 - .../replay/AnnotationRecorderTestCase.java | 92 - .../CompletableBindingRegistryTestCase.java | 83 - .../DefaultBindingRegistryTestCase.java | 82 - .../IgnoreAllBindingRegistryTestCase.java | 58 - .../LegacyGenericBindingRegistryTestCase.java | 95 - ...MetaAnnotationBindingRegistryTestCase.java | 174 -- .../registry/SelectionTestCase.java | 237 --- .../visitor/ComponentVisitorTestCase.java | 91 - .../HandlerDeclarationVisitorTestCase.java | 103 -- .../bind/MethodBindVisitorTestCase.java | 87 - .../visitor/util/NamesTestCase.java | 145 -- .../ManipulatedMetadataFilterTestCase.java | 65 - .../render/MetadataRendererTestCase.java | 100 - .../spi/AbsBindingModuleTestCase.java | 259 --- .../spi/AnnotationLiteralTestCase.java | 50 - .../store/DirectoryResourceStoreTestCase.java | 88 - .../store/JarFileResourceStoreTestCase.java | 82 - .../DefaultManifestBuilderTestCase.java | 99 - .../FileSystemResourceMapperTestCase.java | 75 - .../IdentityResourceMapperTestCase.java | 37 - .../mapper/WABResourceMapperTestCase.java | 65 - .../manipulator/util/StreamsTestCase.java | 59 - .../manipulator/util/StringsTestCase.java | 37 - ...FieldConsistencyResultVisitorTestCase.java | 91 - .../ManipulatedResourcesWriterTestCase.java | 64 - .../ManipulatedResultWriterTestCase.java | 56 - .../test/java/test/AnnotatedComponent.java | 39 - .../manipulator/src/test/java/test/Child.java | 36 - .../src/test/java/test/ClusterDaemon.java | 41 - .../src/test/java/test/ConstructorCheck.java | 31 - .../src/test/java/test/DoubleArray.java | 44 - .../src/test/java/test/FakeAnnotation.java | 35 - .../test/java/test/InterfaceWithStatic.java | 33 - .../test/java/test/NoValidConstructor.java | 34 - .../src/test/java/test/NonSunClass.java | 38 - .../src/test/java/test/Parent.java | 34 - .../test/java/test/PlentyOfAnnotations.java | 63 - .../test/java/test/PojoWithFinalArray.java | 34 - .../src/test/java/test/PojoWithInner.java | 40 - .../java/test/PojoWithStaticInterface.java | 32 - .../src/test/java/test/SimplePojo.java | 32 - .../test/frames/CryptoServiceSingleton.java | 435 ----- .../src/test/java/test/frames/Hash.java | 42 - .../test/inner/ComponentWithInnerClasses.java | 105 -- .../src/test/java/test/inner/Computation.java | 28 - .../src/test/java/test/inner/Example.java | 80 - .../test/java/test/ipojo/ExternalHandler.java | 23 - .../src/test/resources/MANIFEST.MF | 19 - .../src/test/resources/empty-metadata.xml | 23 - .../src/test/resources/metadata.xml | 56 - .../tests.manipulation-no-annotations.jar | Bin 26078 -> 0 bytes .../resources/tests.manipulation.java5.jar | Bin 22366 -> 0 bytes .../tests.manipulator-annotations.jar | Bin 83285 -> 0 bytes .../maven-ipojo-plugin/changelog.txt | 203 -- ipojo/manipulator/maven-ipojo-plugin/pom.xml | 195 -- .../appended-resources/META-INF/DEPENDENCIES | 10 - .../main/appended-resources/META-INF/NOTICE | 1 - .../felix/ipojo/plugin/ManipulatorMojo.java | 310 ---- .../felix/ipojo/plugin/MavenReporter.java | 86 - .../META-INF/maven/archetype-metadata.xml | 45 - .../archetype-resources/bundle.properties | 4 - .../resources/archetype-resources/pom.xml | 75 - .../src/main/java/HelloComponent.java | 14 - .../src/main/java/source.txt | 1 - .../src/main/resources/metadata.xml | 16 - .../online-manipulator/changelog.txt | 133 -- ipojo/manipulator/online-manipulator/pom.xml | 203 -- .../appended-resources/META-INF/DEPENDENCIES | 21 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 3 - .../online/manipulator/BridgeClassLoader.java | 65 - .../BundleAwareJarFileResourceStore.java | 91 - .../felix/ipojo/online/manipulator/Files.java | 54 - .../online/manipulator/IPOJOURLHandler.java | 313 ---- .../online/manipulator/SystemLogService.java | 83 - .../resources/META-INF/constants.properties | 22 - ipojo/manipulator/pom.xml | 68 - .../main/appended-resources/META-INF/NOTICE | 0 ipojo/metadata/changelog.txt | 29 - ipojo/metadata/pom.xml | 67 - .../appended-resources/META-INF/DEPENDENCIES | 10 - .../felix/ipojo/metadata/Attribute.java | 91 - .../apache/felix/ipojo/metadata/Element.java | 400 ---- ipojo/pom.xml | 85 - ipojo/runtime/api/changelog.txt | 219 --- ipojo/runtime/api/pom.xml | 137 -- .../appended-resources/META-INF/DEPENDENCIES | 16 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 3 - .../apache/felix/ipojo/api/ComponentType.java | 195 -- .../apache/felix/ipojo/api/Dependency.java | 412 ----- .../felix/ipojo/api/HandlerConfiguration.java | 36 - .../ipojo/api/PrimitiveComponentType.java | 560 ------ .../org/apache/felix/ipojo/api/Property.java | 205 -- .../org/apache/felix/ipojo/api/Service.java | 320 ---- .../felix/ipojo/api/ServiceProperty.java | 192 -- .../ipojo/api/SingletonComponentType.java | 140 -- .../felix/ipojo/api/TemporalDependency.java | 195 -- .../api/composite/CompositeComponentType.java | 329 ---- .../ipojo/api/composite/ExportedService.java | 188 -- .../ipojo/api/composite/ImportedService.java | 237 --- .../felix/ipojo/api/composite/Instance.java | 246 --- .../api/composite/InstantiatedService.java | 362 ---- .../ipojo/api/composite/ProvidedService.java | 112 -- .../felix/ipojo/api/DependencyTest.java | 149 -- .../apache/felix/ipojo/api/PropertyTest.java | 60 - .../apache/felix/ipojo/api/ServiceTest.java | 81 - .../api/composite/ExportedServiceTest.java | 161 -- .../api/composite/ImportedServiceTest.java | 192 -- .../ipojo/api/composite/InstanceTest.java | 274 --- .../composite/InstantiatedServiceTest.java | 210 --- ipojo/runtime/changelog.txt | 223 --- .../pom.xml | 36 - .../core/components/Baz2CheckProvider.java | 81 - .../core/components/BazProviderType1.java | 51 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 92 - .../core/components/FooProviderTypeDyn.java | 63 - .../core/components/FooProviderTypeDyn2.java | 58 - .../runtime/core/components/TataProvider.java | 222 --- .../runtime/core/components/TotoProvider.java | 73 - .../core/components/TotoProviderGlue.java | 81 - .../core/services/A123/CheckService2.java | 25 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/BazService.java | 39 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../ipojo/runtime/core/services/Tata.java | 62 - .../ipojo/runtime/core/services/Tota.java | 78 - .../ipojo/runtime/core/services/Toto.java | 37 - .../main/resources/metadata-import-export.xml | 106 -- .../src/main/resources/metadata.xml | 131 -- .../felix/ipojo/runtime/core/Common.java | 61 - .../core/exporter/TestFilteredExport.java | 237 --- .../core/exporter/TestMultipleExport.java | 260 --- .../core/exporter/TestOptionalExport.java | 241 --- .../exporter/TestOptionalMultipleExport.java | 260 --- .../core/exporter/TestSimpleExport.java | 241 --- .../importer/TestDelayedFilteredImport.java | 157 -- .../importer/TestDelayedMultipleImport.java | 163 -- .../importer/TestDelayedOptionalImport.java | 163 -- .../TestDelayedOptionalMultipleImport.java | 169 -- .../importer/TestDelayedSimpleImport.java | 158 -- .../core/importer/TestFilteredImport.java | 157 -- .../core/importer/TestMultipleImport.java | 199 -- .../core/importer/TestOptionalImport.java | 193 -- .../importer/TestOptionalMultipleImport.java | 210 --- .../core/importer/TestSimpleImport.java | 193 -- .../ipojo-composite-instance-test/pom.xml | 36 - .../core/components/Baz2CheckProvider.java | 81 - .../core/components/BazProviderType1.java | 51 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 92 - .../core/components/FooProviderTypeDyn.java | 63 - .../core/components/FooProviderTypeDyn2.java | 58 - .../core/components/ServiceConsumer.java | 46 - .../core/components/ServiceProvider.java | 34 - .../runtime/core/components/TataProvider.java | 222 --- .../runtime/core/components/TotoProvider.java | 73 - .../core/components/TotoProviderGlue.java | 81 - .../core/services/A123/CheckService2.java | 25 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/BazService.java | 39 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../ipojo/runtime/core/services/Service.java | 26 - .../ipojo/runtime/core/services/Tata.java | 62 - .../ipojo/runtime/core/services/Tota.java | 78 - .../ipojo/runtime/core/services/Toto.java | 37 - .../src/main/resources/metadata-instance.xml | 108 -- .../src/main/resources/metadata.xml | 131 -- .../felix/ipojo/runtime/core/Common.java | 47 - .../core/instance/TestInstanceScope.java | 105 -- .../core/instance/TestSimpleInstance.java | 279 --- .../TestConfigurableInstantiation.java | 112 -- .../core/instantiator/TestConfiguration.java | 98 - .../TestMultipleInstantiation.java | 287 --- .../TestOptionalInstantiation.java | 273 --- .../TestOptionalMultipleInstantiation.java | 214 --- .../instantiator/TestSimpleInstantiation.java | 274 --- .../ipojo-composite-runtime-test/pom.xml | 36 - .../core/components/Baz2CheckProvider.java | 81 - .../core/components/BazProviderType1.java | 51 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 92 - .../core/components/FooProviderTypeDyn.java | 63 - .../core/components/FooProviderTypeDyn2.java | 58 - .../runtime/core/components/TataProvider.java | 222 --- .../runtime/core/components/TotoProvider.java | 73 - .../core/components/TotoProviderGlue.java | 81 - .../core/services/A123/CheckService2.java | 25 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/BazService.java | 39 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../ipojo/runtime/core/services/Tata.java | 62 - .../ipojo/runtime/core/services/Tota.java | 78 - .../ipojo/runtime/core/services/Toto.java | 37 - .../src/main/resources/metadata.xml | 131 -- .../felix/ipojo/runtime/core/Common.java | 48 - .../runtime/core/EmptyCompositeTest.java | 228 --- .../runtime/core/FactoryManagementTest.java | 330 ---- .../ipojo/runtime/core/ServiceRangeTest.java | 510 ----- .../runtime/core/ServiceRegistryTest.java | 282 --- .../pom.xml | 36 - .../core/components/Baz2CheckProvider.java | 81 - .../core/components/BazProviderType1.java | 51 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 92 - .../core/components/FooProviderTypeDyn.java | 63 - .../core/components/FooProviderTypeDyn2.java | 58 - .../core/components/ServiceConsumer.java | 46 - .../core/components/ServiceProvider.java | 34 - .../runtime/core/components/TataProvider.java | 222 --- .../runtime/core/components/TotoProvider.java | 73 - .../core/components/TotoProviderGlue.java | 81 - .../core/services/A123/CheckService2.java | 25 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/BazService.java | 39 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../ipojo/runtime/core/services/Service.java | 26 - .../ipojo/runtime/core/services/Tata.java | 62 - .../ipojo/runtime/core/services/Tota.java | 78 - .../ipojo/runtime/core/services/Toto.java | 37 - .../src/main/resources/metadata-providing.xml | 174 -- .../src/main/resources/metadata.xml | 131 -- .../felix/ipojo/runtime/core/Common.java | 57 - .../ipojo/runtime/core/TestCompositeAPI.java | 184 -- .../runtime/core/providing/TestComp0.java | 343 ---- .../runtime/core/providing/TestComp1.java | 341 ---- .../runtime/core/providing/TestComp2.java | 238 --- .../runtime/core/providing/TestComp3.java | 271 --- .../runtime/core/providing/TestComp4.java | 270 --- .../runtime/core/providing/TestComp5.java | 272 --- .../runtime/core/providing/TestComp6.java | 295 --- .../runtime/core/providing/TestComp7.java | 339 ---- .../runtime/core/providing/TestComp8.java | 369 ---- ipojo/runtime/composite-it/pom.xml | 354 ---- .../main/appended-resources/META-INF/NOTICE | 0 ipojo/runtime/composite/changelog.txt | 268 --- ipojo/runtime/composite/obr.xml | 40 - ipojo/runtime/composite/pom.xml | 189 -- .../appended-resources/META-INF/DEPENDENCIES | 16 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 4 - .../ipojo/composite/CompositeFactory.java | 180 -- .../ipojo/composite/CompositeHandler.java | 83 - .../CompositeInstanceDescription.java | 130 -- .../ipojo/composite/CompositeManager.java | 442 ----- .../composite/CompositeServiceContext.java | 506 ----- .../felix/ipojo/composite/FactoryProxy.java | 189 -- .../architecture/ArchitectureHandler.java | 111 -- .../composite/instance/InstanceHandler.java | 441 ----- .../instance/InstanceHandlerDescription.java | 90 - .../ServiceDependencyHandler.java | 393 ---- .../service/instantiator/ServiceImporter.java | 326 ---- .../ServiceInstantiatorDescription.java | 117 -- .../service/instantiator/SvcInstance.java | 295 --- .../provides/CompositionException.java | 44 - .../service/provides/CompositionMetadata.java | 361 ---- .../service/provides/FieldMetadata.java | 105 -- .../service/provides/MethodMetadata.java | 138 -- .../service/provides/POJOWriter.java | 323 ---- .../service/provides/ProvidedService.java | 238 --- .../provides/ProvidedServiceHandler.java | 504 ----- .../ProvidedServiceHandlerDescription.java | 96 - .../service/provides/ServiceExporter.java | 176 -- .../provides/SpecificationMetadata.java | 158 -- .../ipojo/composite/util/SourceManager.java | 376 ---- .../src/main/resources/composite.xsd | 147 -- .../composite/src/main/resources/metadata.xml | 43 - ipojo/runtime/core-it/ipojo-api-test/pom.xml | 67 - .../runtime/core/api/components/FooImpl.java | 41 - .../runtime/core/api/components/HostImpl.java | 38 - .../core/api/components/MyComponentImpl.java | 50 - .../core/api/components/MyServiceImpl.java | 28 - .../core/api/components/PlainHelloImpl.java | 46 - .../runtime/core/api/services/BarService.java | 27 - .../ipojo/runtime/core/api/services/Foo.java | 27 - .../runtime/core/api/services/MyService.java | 24 - .../runtime/core/api/services/PlainHello.java | 24 - .../felix/ipojo/runtime/core/api/Common.java | 73 - .../ipojo/runtime/core/api/CompositeTest.java | 247 --- .../runtime/core/api/ExternalHandlerTest.java | 91 - .../core/api/PrimitiveComponentTest.java | 181 -- .../core/api/SingletonComponentTest.java | 177 -- .../ipojo/runtime/core/api/Whiteboard.java | 90 - .../core-it/ipojo-compatibility-test/pom.xml | 35 - .../ipojo/HelloServiceConsumer.java | 50 - .../ipojo/HelloServiceProvider.java | 44 - .../scr/HelloServiceConsumer.java | 67 - .../scr/HelloServiceProvider.java | 41 - .../compatibility/service/CheckService.java | 31 - .../compatibility/service/HelloService.java | 28 - .../resources/blueprint/HelloConsumer.xml | 32 - .../resources/blueprint/HelloProvider.xml | 29 - .../src/main/resources/scr/HelloConsumer.xml | 33 - .../src/main/resources/scr/HelloProvider.xml | 26 - .../ipojo/test/compatibility/Common.java | 307 --- ...estBeingConsumedByAriesBlueprint1_1_0.java | 60 - .../TestBeingConsumedByEquinoxSCR1_4_100.java | 66 - .../TestBeingConsumedByFelixSCR1_6_2.java | 57 - ...stBeingConsumedByKnopflerfishSCR4_0_2.java | 65 - ...umingProviderUsingAriesBlueprint1_1_0.java | 61 - ...nsumingProviderUsingEquinoxSCR1_4_100.java | 68 - ...stConsumingProviderUsingFelixSCR1_6_2.java | 58 - ...mingProviderUsingKnopflerfishSCR4_0_2.java | 64 - .../test/compatibility/TestiPOJOOnly.java | 49 - .../ipojo-core-annotations-test/pom.xml | 35 - .../src/main/java/foo/Foo.java | 29 - .../src/main/java/foo/RGB.java | 28 - .../src/main/java/foo/ipojo/IPOJOFoo.java | 35 - .../test/components/AggregateDependency.java | 44 - .../runtime/core/test/components/Arch.java | 26 - .../test/components/ComponentTypeVersion.java | 28 - .../components/CustomAnnotationWithEnum.java | 30 - .../DefaultImplementationDependency.java | 32 - .../core/test/components/Dependency.java | 103 -- .../DependencyUsingSpecification.java | 55 - .../runtime/core/test/components/Factory.java | 26 - .../test/components/FactoryDeprecated.java | 26 - .../core/test/components/FactoryMethod.java | 30 - .../components/FactoryMethodDeprecated.java | 30 - .../test/components/FilteredDependency.java | 56 - .../core/test/components/FromDependency.java | 83 - .../core/test/components/Immediate.java | 26 - .../test/components/InstantiateSimple.java | 30 - .../test/components/InstantiateWithName.java | 30 - .../core/test/components/Lifecycle.java | 41 - .../test/components/ManagedServicePID.java | 93 - .../core/test/components/MyComparator.java | 30 - .../core/test/components/NoAnnotation.java | 24 - .../runtime/core/test/components/NoArch.java | 26 - .../core/test/components/NoFactory.java | 26 - .../core/test/components/NoImmediate.java | 26 - .../core/test/components/NoPropagation.java | 93 - .../test/components/NullableDependency.java | 36 - .../runtime/core/test/components/OnlyFoo.java | 27 - .../core/test/components/OnlyiPOJOFoo.java | 27 - .../test/components/OptionalDependency.java | 60 - .../test/components/PIDandPropagation.java | 94 - .../test/components/PSServiceController.java | 75 - .../components/PSServiceControllerSpec.java | 78 - .../test/components/PolicyDependency.java | 56 - .../core/test/components/Propagation.java | 94 - .../test/components/PropagationandPID.java | 94 - .../core/test/components/Properties.java | 93 - .../core/test/components/ProvidesDouble.java | 61 - .../test/components/ProvidesProperties.java | 86 - .../core/test/components/ProvidesQuatro.java | 77 - .../core/test/components/ProvidesSimple.java | 70 - .../components/ProvidesStaticProperties.java | 94 - .../core/test/components/ProvidesTriple.java | 76 - .../test/components/RankedDependency.java | 69 - .../components/UpdatedWithManagedService.java | 102 - .../components/UpdatedWithProperties.java | 104 -- .../components/ComponentWithProperties.java | 79 - .../components/InstantiatedComponent.java | 33 - .../context/ComponentUsingContext.java | 46 - .../test/components/error/AbstractClass.java | 29 - .../core/test/components/event/PubSub.java | 56 - .../components/event/PubSubDeprecated.java | 56 - .../components/event/PubSubWithPublishes.java | 57 - .../test/components/extender/Extender.java | 37 - .../test/components/jmx/JMXDeprecated.java | 44 - .../core/test/components/jmx/JMXSimple.java | 44 - .../test/components/temporal/Temporal.java | 33 - .../temporal/TemporalCollection.java | 44 - .../components/temporal/TemporalSimple.java | 32 - .../components/temporal/TemporalWithDI.java | 32 - .../temporal/TemporalWithEmptyArray.java | 32 - .../temporal/TemporalWithFilter.java | 32 - .../components/temporal/TemporalWithNull.java | 32 - .../temporal/TemporalWithNullable.java | 33 - .../temporal/TemporalWithTimeout.java | 35 - .../whiteboard/WhiteBoardWIModification.java | 44 - .../whiteboard/WhiteBoardWOModification.java | 37 - .../components/whiteboard/WhiteBoards.java | 46 - .../core/test/services/BarService.java | 29 - .../core/test/services/CheckService.java | 31 - .../core/test/services/ChildInterface.java | 25 - .../core/test/services/FooService.java | 39 - .../core/test/services/ParentInterface1.java | 25 - .../core/test/services/ParentInterface2.java | 25 - .../test/services/ParentParentInterface.java | 25 - .../runtime/core/test/annotations/Common.java | 49 - .../annotations/TestAggregateDependency.java | 83 - .../test/annotations/TestArchitecture.java | 50 - .../core/test/annotations/TestContext.java | 95 - .../annotations/TestCustomAnnotations.java | 55 - .../core/test/annotations/TestDependency.java | 187 -- .../annotations/TestDependencyPolicy.java | 104 -- .../core/test/annotations/TestEventAdmin.java | 287 --- .../core/test/annotations/TestExtender.java | 49 - .../core/test/annotations/TestFactory.java | 98 - .../annotations/TestFilteredDependency.java | 132 -- .../test/annotations/TestInstantiate.java | 128 -- .../TestInstantiatedComponent.java | 45 - .../core/test/annotations/TestJMX.java | 85 - .../annotations/TestLifecycleCallbacks.java | 74 - .../annotations/TestLifecycleController.java | 42 - .../annotations/TestOptionalDependency.java | 136 -- .../core/test/annotations/TestProperties.java | 189 -- .../annotations/TestRankedDependency.java | 98 - .../annotations/TestServiceProviding.java | 204 -- .../annotations/TestTemporalDependencies.java | 197 -- .../core/test/annotations/TestWhiteBoard.java | 108 -- .../ipojo-core-bad-configuration-test/pom.xml | 35 - .../bad/components/BadConstructors.java | 40 - .../bad/components/CallbackCheckService.java | 68 - .../components/CheckProviderParentClass.java | 51 - .../bad/components/CheckServiceProvider.java | 83 - .../components/LifecycleControllerTest.java | 49 - .../runtime/bad/components/ParentClass.java | 51 - .../runtime/bad/services/BarService.java | 29 - .../runtime/bad/services/CheckService.java | 31 - .../runtime/bad/services/FooService.java | 39 - .../src/main/resources/metadata.xml | 71 - .../felix/ipojo/runtime/bad/test/Common.java | 31 - .../runtime/bad/test/TestBadFactories.java | 140 -- .../runtime/bad/test/TestBadLFCCallback.java | 262 --- .../bad/test/TestBadLFCController.java | 106 -- .../bad/test/TestBadServiceDependencies.java | 370 ---- .../src/test/resources/exam.properties | 19 - .../pom.xml | 34 - .../components/ConfigurableFooProvider.java | 72 - ...onfigurableFooProviderWithPropagation.java | 73 - .../ImmediateConfigurableFooProvider.java | 87 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../src/main/resources/metadata.xml | 40 - .../felix/ipojo/runtime/core/Common.java | 59 - ...ManagedServiceFactoryTestForImmediate.java | 346 ---- ...tManagedServiceFactoryTestForServices.java | 356 ---- .../TestManagedServiceTestForImmediate.java | 368 ---- .../TestManagedServiceTestForService.java | 362 ---- .../ipojo/runtime/core/TestPropagation.java | 91 - .../felix/ipojo/runtime/core/TestUpdated.java | 121 -- .../pom.xml | 35 - .../ipojo/runtime/core/components/Bean.java | 46 - .../components/ConfigureAnotherInstance.java | 43 - .../core/components/ConfigureNothing.java | 32 - .../core/components/ConfigureOneInstance.java | 43 - .../ConfigureThreeInstancesUsingMethods.java | 66 - .../components/ConfigureTwoInstances.java | 53 - .../ConfigureTwoInstancesWithInheritance.java | 43 - .../ConfigureTwoInstancesWithOverridding.java | 52 - .../core/components/MyComplexComponent.java | 106 -- .../runtime/core/components/MyComponent.java | 89 - .../core/components/ParentConfiguration.java | 54 - .../core/components/SimpleConfiguration.java | 38 - .../configuration/MyComplexConfiguration.java | 77 - .../configuration/MyConfiguration.java | 45 - .../runtime/core/services/FooService.java | 39 - .../felix/ipojo/runtime/core/Common.java | 45 - .../core/TestComplexConfigurations.java | 145 -- .../TestConfigurationInAnotherBundle.java | 112 -- .../core/TestConfigurationOfMyComponent.java | 87 - ...igurationOfThreeInstancesUsingMethods.java | 99 - .../core/TestConfigurationOfTwoInstances.java | 97 - ...estConfigurationWithInheritedInstance.java | 99 - ...stConfigurationWithOverriddenInstance.java | 99 - .../runtime/core/TestEmptyConfiguration.java | 77 - .../core/TestSeveralConfigurations.java | 99 - .../runtime/core/TestSimpleConfiguration.java | 80 - .../ipojo-core-configuration-test/pom.xml | 34 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/ComplexConfiguration.java | 57 - .../ConfigurableCheckServiceProvider.java | 223 --- .../core/components/FooProviderType1.java | 134 -- .../core/components/FooProviderType2.java | 115 -- .../core/components/FooProviderTypeDyn.java | 83 - .../runtime/core/components/ParentClass.java | 51 - ...arentConfigurableCheckServiceProvider.java | 194 -- .../core/components/PropertyModifier.java | 60 - .../arch/MyComponentToIntrospect.java | 95 - ...eProviderWithBundleContextAndProperty.java | 54 - ...rviceProviderWithDefaultValueProperty.java | 51 - ...CheckServiceProviderWithNamedProperty.java | 51 - ...CheckServiceProviderWithTwoProperties.java | 54 - ...eckServiceProviderWithUnnamedProperty.java | 51 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../src/main/resources/metadata.xml | 267 --- .../src/main/resources/updated.xml | 103 -- .../felix/ipojo/runtime/core/Common.java | 61 - .../ipojo/runtime/core/TestArchitecture.java | 236 --- .../runtime/core/TestBothProperties.java | 870 --------- .../runtime/core/TestComplexProperties.java | 234 --- .../TestConstructorInjectionOfProperties.java | 120 -- ...onfigurablePropertiesUsingConfigAdmin.java | 399 ---- .../runtime/core/TestFieldProperties.java | 768 -------- .../ipojo/runtime/core/TestListeners.java | 205 -- ...tManagedServiceConfigurableProperties.java | 618 ------- .../runtime/core/TestMethodProperties.java | 1647 ----------------- .../runtime/core/TestPropertyModifier.java | 108 -- .../runtime/core/TestSimpleProperties.java | 261 --- .../core/TestSuperMethodProperties.java | 631 ------- .../ipojo/runtime/core/TestUpdatedMethod.java | 218 --- .../core/TestUpdatedMethodAndConfigAdmin.java | 330 ---- .../TestUpdatedMethodAndManagedService.java | 405 ---- .../TestUpdatedNoArgMethodAndConfigAdmin.java | 319 ---- ...stUpdatedNoArgMethodAndManagedService.java | 325 ---- .../ipojo-core-context-injection-test/pom.xml | 35 - .../components/ComponentUsingConstructor.java | 52 - .../core/components/ComponentUsingField.java | 49 - .../core/components/ComponentUsingMethod.java | 51 - ...ntBundleContextInjectionInConstructor.java | 60 - ...omponentBundleContextInjectionInField.java | 54 - ...mponentBundleContextInjectionInMethod.java | 57 - .../ComponentWithThreeConstructorParams.java | 69 - .../ComponentWithTwoConstructorParams.java | 63 - .../annotations/ComponentWithTwoFields.java | 60 - .../annotations/ComponentWithTwoSetters.java | 66 - ...ceBundleContextInjectionInConstructor.java | 57 - ...InstanceBundleContextInjectionInField.java | 54 - ...nstanceBundleContextInjectionInMethod.java | 57 - .../configuration/MyConfiguration.java | 31 - .../components/mix/MixWithProperties1.java | 64 - .../components/mix/MixWithProperties2.java | 64 - .../runtime/core/services/CheckService.java | 29 - .../src/main/resources/metadata.xml | 65 - .../felix/ipojo/runtime/core/Common.java | 30 - .../TestContextInjectionFromAnnotations.java | 129 -- .../core/TestContextInjectionFromXML.java | 113 -- ...tInjectingComponentAndInstanceContext.java | 128 -- .../TestInjectingContextAndProperties.java | 76 - .../src/test/resources/exam.properties | 19 - .../ipojo-core-declaration-test/pom.xml | 47 - .../test/components/EnglishHelloService.java | 43 - .../test/components/EnglishHelloService2.java | 43 - .../test/components/FrenchHelloService.java | 43 - .../test/components/GermanHelloService.java | 40 - .../core/test/services/HelloService.java | 29 - .../runtime/core/test/declaration/Common.java | 45 - .../TestDeclarationBuilderService.java | 209 --- .../ipojo-core-external-handlers-test/pom.xml | 33 - ...heckServiceAndFieldInterceptorHandler.java | 131 -- .../components/CheckServiceHandler.java | 106 -- .../components/FooProviderType1.java | 74 - .../services/CheckService.java | 32 - .../CheckServiceHandlerDescription.java | 38 - .../externalhandlers/services/FooService.java | 42 - .../src/main/resources/metadata.xml | 77 - .../test/AutoHandlerTest.java | 109 -- .../runtime/externalhandlers/test/Common.java | 29 - .../externalhandlers/test/HandlerTest.java | 213 --- .../test/HandlerWithFieldInterceptorTest.java | 84 - .../core-it/ipojo-core-factory-test/pom.xml | 35 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FiveInstances.java | 27 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 117 -- .../core/components/FooProviderTypeDyn.java | 64 - .../core/components/FooProviderTypeDyn2.java | 58 - .../runtime/core/components/NoInstances.java | 27 - .../core/components/OneDuplicateInstance.java | 27 - .../components/ReconfigurableSimpleType.java | 63 - .../runtime/core/components/SimpleType.java | 26 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../runtime/core/services/NoService.java | 23 - .../src/main/resources/metadata.xml | 174 -- .../felix/ipojo/runtime/core/Common.java | 70 - .../ipojo/runtime/core/TestComponentDesc.java | 345 ---- .../ipojo/runtime/core/TestConfigAdmin.java | 174 -- .../runtime/core/TestFactoryProperties.java | 86 - .../ipojo/runtime/core/TestInstances.java | 176 -- .../ipojo/runtime/core/TestObedience.java | 117 -- .../runtime/core/TestReconfiguration.java | 287 --- .../core/TestUnacceptableConfiguration.java | 836 --------- .../src/test/resources/exam.properties | 19 - .../ipojo-core-factory-version-test/pom.xml | 33 - .../core/tests/components/MyComponent.java | 30 - .../ipojo/core/tests/components/MyCons.java | 32 - .../ipojo/core/tests/services/MyService.java | 26 - .../src/main/resources/cons.xml | 27 - .../src/main/resources/instances.xml | 41 - .../src/main/resources/provider-v1.1.xml | 26 - .../src/main/resources/provider-v1.xml | 31 - .../src/main/resources/vprovider-v1.xml | 27 - .../src/main/resources/vprovider-v2.xml | 28 - .../apache/felix/ipojo/tests/core/Common.java | 91 - .../ipojo/tests/core/FactoryVersionTest.java | 176 -- .../ipojo/tests/core/VersionConflictTest.java | 279 --- .../core-it/ipojo-core-handler-test/pom.xml | 35 - .../runtime/core/components/DummyImpl.java | 35 - .../runtime/core/components/MyComponent.java | 30 - .../runtime/core/handlers/DummyHandler.java | 74 - .../runtime/core/handlers/EmptyHandler.java | 46 - .../ipojo/runtime/core/services/Dummy.java | 24 - .../runtime/core/services/MyService.java | 26 - .../ipojo/runtime/core/services/User.java | 30 - .../src/main/resources/dummy-component.xml | 28 - .../src/main/resources/dummy-handler.xml | 36 - .../src/main/resources/ignorecase.xml | 39 - .../felix/ipojo/runtime/core/Common.java | 39 - .../ipojo/runtime/core/DummyHandlerTest.java | 218 --- .../core/IgnoreCaseHandlerSelectionTest.java | 159 -- .../felix/ipojo/runtime/core/Tools.java | 51 - .../pom.xml | 35 - .../CallbackWithErrorCheckService.java | 44 - .../core/components/FooProviderType1.java | 109 -- .../core/components/FooProviderTypeDyn2.java | 58 - .../components/LifecycleControllerTest.java | 49 - .../runtime/core/components/ParentClass.java | 51 - .../core/services/CallbackCheckService.java | 67 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/FooService.java | 39 - .../src/main/resources/metadata.xml | 108 -- .../felix/ipojo/runtime/core/Common.java | 30 - .../ipojo/runtime/core/TestCallback.java | 118 -- .../ipojo/runtime/core/TestErrorCallback.java | 60 - .../runtime/core/TestImmediateCallback.java | 117 -- ...TestImmediateCallbackSeveralFactories.java | 124 -- ...TestImmediateCallbackSingletonFactory.java | 120 -- .../TestImmediateLifeCycleController.java | 114 -- .../runtime/core/TestParentCallback.java | 108 -- .../src/test/resources/exam.properties | 19 - .../pom.xml | 35 - .../ConfigurableLifecycleControllerTest.java | 42 - .../components/LifecycleControllerTest.java | 49 - .../runtime/core/services/CheckService.java | 31 - .../src/main/resources/metadata.xml | 54 - .../felix/ipojo/runtime/core/Common.java | 31 - .../TestConfigurableLifeCycleController.java | 151 -- .../TestImmediateLifeCycleController.java | 118 -- .../runtime/core/TestLifeCycleController.java | 137 -- .../src/test/resources/exam.properties | 19 - .../core-it/ipojo-core-logger-test/pom.xml | 65 - .../runtime/core/components/MyComponent.java | 30 - .../core/components/MyErroneousComponent.java | 34 - .../runtime/core/services/MyService.java | 26 - .../src/main/resources/component.xml | 25 - .../main/resources/erroneous-component.xml | 24 - .../felix/ipojo/runtime/core/Common.java | 34 - .../core/TestBNDManifestLoggerInfo.java | 111 -- .../ipojo/runtime/core/TestErrorHandler.java | 147 -- .../runtime/core/TestManifestLoggerInfo.java | 127 -- .../runtime/core/TestSystemLoggerInfo.java | 102 - .../runtime/core/TestSystemLoggerWarning.java | 102 - .../pom.xml | 35 - .../test/components/AdvancedFooConsumer.java | 82 - .../core/test/components/FooConsumer.java | 68 - .../core/test/components/FooProvider.java | 56 - .../AddLocationTrackingInterceptor.java | 50 - .../AdvancedTrackerAndRankerInterceptor.java | 126 -- .../EnhancingBindingInterceptor.java | 77 - .../FilterRankingInterceptor.java | 75 - .../test/interceptors/GradeComparator.java | 37 - .../HidingTrackingInterceptor.java | 60 - .../PropertyTrackingInterceptor.java | 56 - .../interceptors/ProxyBindingInterceptor.java | 100 - .../TrackerAndRankerInterceptor.java | 146 -- .../core/test/services/CheckService.java | 32 - .../runtime/core/test/services/Enhanced.java | 27 - .../core/test/services/FooService.java | 32 - .../runtime/core/test/services/Setter.java | 28 - .../core/test/dependencies/Common.java | 40 - .../dependencies/TestBindingInterceptors.java | 203 -- .../TestCombinationOfInterceptors.java | 129 -- .../test/dependencies/TestHidingServices.java | 133 -- ...TestInterceptorsOnSeveralDependencies.java | 94 - .../dependencies/TestRankingServices.java | 221 --- .../TestTransformingServices.java | 177 -- .../pom.xml | 35 - .../components/CheckProviderParentClass.java | 65 - .../test/components/CheckServiceProvider.java | 145 -- .../components/CollectionCheckService.java | 183 -- .../components/DynCheckServiceProvider.java | 97 - .../test/components/FooProviderType1.java | 109 -- .../test/components/FooProviderType2.java | 68 - .../components/FooServiceDefaultImpl.java | 55 - .../test/components/ListCheckService.java | 184 -- .../MethodCheckServiceProvider.java | 134 -- .../MethodMultipleCheckService.java | 178 -- .../test/components/MultipleCheckService.java | 183 -- .../MultipleFilterCheckSubscriber.java | 56 - .../core/test/components/ParentClass.java | 51 - .../components/RankedFooProviderType1.java | 52 - .../core/test/components/SetCheckService.java | 164 -- .../test/components/VectorCheckService.java | 159 -- .../comparator/CheckServiceProvider.java | 64 - .../comparator/GradeComparator.java | 50 - .../comparator/GradedFooServiceProvider.java | 59 - .../ExceptionAwareCheckServiceProvider.java | 73 - .../exceptions/NoServiceException.java | 31 - .../filter/FilterCheckProvider.java | 90 - .../filter/FilterCheckSubscriber.java | 56 - .../filter/MultipleFilterCheckSubscriber.java | 57 - .../core/test/components/inner/C1.java | 30 - .../core/test/components/inner/C2.java | 32 - .../core/test/components/inner/C3.java | 38 - .../core/test/components/inner/MyFilter.java | 26 - .../test/components/optional/MyComponent.java | 42 - .../policies/CheckProviderParentClass.java | 51 - .../policies/CheckServiceProvider.java | 91 - .../policies/DynCheckServiceProvider.java | 87 - .../policies/MethodCheckServiceProvider.java | 123 -- .../policies/MethodMultipleCheckService.java | 165 -- .../policies/MultipleCheckService.java | 158 -- .../policies/RankedFooProviderType1.java | 61 - .../proxy/CheckServiceDelegator.java | 50 - .../proxy/CheckServiceGetAndDelegate.java | 48 - .../proxy/CheckServiceNoDelegate.java | 61 - .../proxy/CheckServiceUsingStringService.java | 47 - .../core/test/components/proxy/Helper.java | 69 - .../runtime/core/test/services/Call.java | 27 - .../core/test/services/CheckService.java | 31 - .../core/test/services/FooService.java | 39 - .../main/resources/metadata-comparator.xml | 55 - .../src/main/resources/metadata-filter.xml | 141 -- .../src/main/resources/metadata-policies.xml | 283 --- .../src/main/resources/metadata.xml | 1083 ----------- .../core/test/dependencies/Common.java | 59 - .../di/TestDelayedOptionalDependencies.java | 365 ---- ...TestMethodDelayedOptionalDependencies.java | 235 --- .../di/TestMethodOptionalDependencies.java | 275 --- .../di/TestOptionalDependencies.java | 399 ---- .../TestDependenciesWithExceptions.java | 95 - .../TestDelayedOptionalDependencies.java | 498 ----- ...stDelayedOptionalMultipleDependencies.java | 368 ---- ...TestMethodDelayedOptionalDependencies.java | 369 ---- ...odDelayedOptionalMultipleDependencies.java | 215 --- .../TestMethodOptionalDependencies.java | 436 ----- ...estMethodOptionalMultipleDependencies.java | 288 --- .../TestNullableTransitiveClassloading.java | 41 - .../optional/TestOptionalDependencies.java | 551 ------ .../TestOptionalMultipleDependencies.java | 485 ----- .../TestOptionalNoNullableDependencies.java | 550 ------ ...estProxiedDelayedOptionalDependencies.java | 498 ----- ...edDelayedOptionalMultipleDependencies.java | 364 ---- .../TestProxiedOptionalDependencies.java | 554 ------ .../pom.xml | 35 - .../components/CheckProviderParentClass.java | 65 - .../test/components/CheckServiceProvider.java | 145 -- .../components/CollectionCheckService.java | 183 -- .../components/DynCheckServiceProvider.java | 97 - .../test/components/FooProviderType1.java | 109 -- .../test/components/FooProviderType2.java | 68 - .../components/FooServiceDefaultImpl.java | 55 - .../test/components/ListCheckService.java | 184 -- .../MethodCheckServiceProvider.java | 134 -- .../MethodMultipleCheckService.java | 178 -- .../test/components/MultipleCheckService.java | 183 -- .../MultipleFilterCheckSubscriber.java | 56 - .../core/test/components/ParentClass.java | 51 - .../components/RankedFooProviderType1.java | 52 - .../core/test/components/SetCheckService.java | 164 -- .../test/components/VectorCheckService.java | 159 -- .../comparator/CheckServiceProvider.java | 64 - .../comparator/GradeComparator.java | 50 - .../comparator/GradedFooServiceProvider.java | 59 - .../filter/FilterCheckProvider.java | 90 - .../filter/FilterCheckSubscriber.java | 56 - .../filter/MultipleFilterCheckSubscriber.java | 57 - .../core/test/components/inner/C1.java | 30 - .../core/test/components/inner/C2.java | 32 - .../core/test/components/inner/C3.java | 38 - .../core/test/components/inner/MyFilter.java | 26 - .../test/components/optional/MyComponent.java | 42 - .../policies/CheckProviderParentClass.java | 51 - .../policies/CheckServiceProvider.java | 91 - .../policies/DynCheckServiceProvider.java | 87 - .../policies/MethodCheckServiceProvider.java | 123 -- .../policies/MethodMultipleCheckService.java | 165 -- .../policies/MultipleCheckService.java | 158 -- .../policies/RankedFooProviderType1.java | 61 - .../proxy/CheckServiceDelegator.java | 50 - .../proxy/CheckServiceGetAndDelegate.java | 48 - .../proxy/CheckServiceNoDelegate.java | 61 - .../proxy/CheckServiceUsingStringService.java | 47 - .../core/test/components/proxy/Helper.java | 69 - .../runtime/core/test/services/Call.java | 27 - .../core/test/services/CheckService.java | 31 - .../core/test/services/FooService.java | 39 - .../main/resources/metadata-comparator.xml | 55 - .../src/main/resources/metadata-filter.xml | 141 -- .../src/main/resources/metadata-policies.xml | 283 --- .../src/main/resources/metadata.xml | 1083 ----------- .../core/test/dependencies/Common.java | 60 - .../comparator/TestComparator.java | 159 -- .../policies/TestDynamicPriority.java | 165 -- .../TestStaticMethodOptionalDependencies.java | 275 --- .../TestStaticMethodSimpleDependencies.java | 198 -- .../TestStaticMultipleDependencies.java | 325 ---- .../TestStaticOptionalDependencies.java | 521 ------ .../TestStaticSimpleDependencies.java | 351 ---- .../pom.xml | 35 - .../components/CheckProviderParentClass.java | 65 - .../test/components/CheckServiceProvider.java | 145 -- .../components/CollectionCheckService.java | 183 -- .../components/DynCheckServiceProvider.java | 97 - .../test/components/FooProviderType1.java | 109 -- .../test/components/FooProviderType2.java | 68 - .../components/FooServiceDefaultImpl.java | 55 - .../test/components/ListCheckService.java | 184 -- .../MethodCheckServiceProvider.java | 134 -- .../MethodMultipleCheckService.java | 178 -- .../test/components/MultipleCheckService.java | 183 -- .../MultipleFilterCheckSubscriber.java | 56 - .../core/test/components/ParentClass.java | 51 - .../components/RankedFooProviderType1.java | 52 - .../core/test/components/SetCheckService.java | 164 -- .../test/components/VectorCheckService.java | 159 -- .../comparator/CheckServiceProvider.java | 64 - .../comparator/GradeComparator.java | 50 - .../comparator/GradedFooServiceProvider.java | 59 - .../filter/FilterCheckProvider.java | 90 - .../filter/FilterCheckSubscriber.java | 56 - .../filter/MultipleFilterCheckSubscriber.java | 57 - .../core/test/components/inner/C1.java | 30 - .../core/test/components/inner/C2.java | 32 - .../core/test/components/inner/C3.java | 38 - .../core/test/components/inner/MyFilter.java | 26 - .../test/components/optional/MyComponent.java | 42 - .../policies/CheckProviderParentClass.java | 51 - .../policies/CheckServiceProvider.java | 91 - .../policies/DynCheckServiceProvider.java | 87 - .../policies/MethodCheckServiceProvider.java | 123 -- .../policies/MethodMultipleCheckService.java | 165 -- .../policies/MultipleCheckService.java | 158 -- .../policies/RankedFooProviderType1.java | 61 - .../proxy/CheckServiceDelegator.java | 50 - .../proxy/CheckServiceGetAndDelegate.java | 48 - .../proxy/CheckServiceNoDelegate.java | 61 - .../proxy/CheckServiceUsingStringService.java | 47 - .../core/test/components/proxy/Helper.java | 68 - .../runtime/core/test/services/Call.java | 27 - .../core/test/services/CheckService.java | 31 - .../core/test/services/FooService.java | 39 - .../main/resources/metadata-comparator.xml | 55 - .../src/main/resources/metadata-filter.xml | 141 -- .../src/main/resources/metadata-policies.xml | 283 --- .../src/main/resources/metadata.xml | 1083 ----------- .../core/test/dependencies/Common.java | 59 - ...ProxiedCollectionMultipleDependencies.java | 256 --- ...estProxiedDelayedMultipleDependencies.java | 525 ------ .../TestProxiedDelayedSimpleDependencies.java | 374 ---- .../TestProxiedListMultipleDependencies.java | 256 --- .../TestProxiedSetMultipleDependencies.java | 256 --- .../TestProxiedSimpleDependencies.java | 418 ----- .../dependencies/proxies/TestProxyTest.java | 270 --- .../pom.xml | 35 - .../components/CheckProviderParentClass.java | 65 - .../test/components/CheckServiceProvider.java | 145 -- .../components/CollectionCheckService.java | 183 -- .../components/DynCheckServiceProvider.java | 97 - .../test/components/FooProviderType1.java | 109 -- .../test/components/FooProviderType2.java | 68 - .../components/FooServiceDefaultImpl.java | 55 - .../test/components/ListCheckService.java | 184 -- .../MethodCheckServiceProvider.java | 134 -- .../MethodMultipleCheckService.java | 178 -- .../test/components/MultipleCheckService.java | 183 -- .../MultipleFilterCheckSubscriber.java | 56 - .../core/test/components/ParentClass.java | 51 - .../components/RankedFooProviderType1.java | 52 - .../core/test/components/SetCheckService.java | 164 -- .../test/components/VectorCheckService.java | 159 -- .../comparator/CheckServiceProvider.java | 64 - .../comparator/GradeComparator.java | 50 - .../comparator/GradedFooServiceProvider.java | 59 - .../context/ContextualFilterConsumer.java | 53 - .../test/components/context/Provider1.java | 75 - .../test/components/context/Provider2.java | 75 - .../error/NullPointerExceptionBinder.java | 37 - .../filter/FilterCheckProvider.java | 90 - .../filter/FilterCheckSubscriber.java | 56 - .../filter/MultipleFilterCheckSubscriber.java | 57 - .../ComponentWithCustomMethods.java | 64 - .../core/test/components/inner/C1.java | 30 - .../core/test/components/inner/C2.java | 32 - .../core/test/components/inner/C3.java | 38 - .../core/test/components/inner/MyFilter.java | 26 - .../components/leak/DefaultHelloService.java | 39 - .../leak/DefaultLeakingService.java | 63 - .../test/components/optional/MyComponent.java | 42 - .../policies/CheckProviderParentClass.java | 51 - .../policies/CheckServiceProvider.java | 91 - .../policies/DynCheckServiceProvider.java | 87 - .../policies/MethodCheckServiceProvider.java | 123 -- .../policies/MethodMultipleCheckService.java | 165 -- .../policies/MultipleCheckService.java | 158 -- .../policies/RankedFooProviderType1.java | 61 - .../proxy/CheckServiceDelegator.java | 50 - .../proxy/CheckServiceGetAndDelegate.java | 48 - .../proxy/CheckServiceNoDelegate.java | 61 - .../proxy/CheckServiceUsingStringService.java | 47 - .../core/test/components/proxy/Helper.java | 69 - .../runtime/core/test/services/Call.java | 27 - .../core/test/services/CheckService.java | 31 - .../core/test/services/FooService.java | 39 - .../core/test/services/HelloService.java | 28 - .../core/test/services/LeakingService.java | 29 - .../runtime/core/test/services/Listener.java | 28 - .../main/resources/metadata-comparator.xml | 55 - .../src/main/resources/metadata-filter.xml | 141 -- .../src/main/resources/metadata.xml | 519 ------ .../core/test/dependencies/Common.java | 52 - .../TestCollectionMultipleDependencies.java | 245 --- .../TestDelayedMultipleDependencies.java | 507 ----- .../TestDelayedSimpleDependencies.java | 373 ---- .../TestDependencyArchitecture.java | 702 ------- .../TestListMultipleDependencies.java | 255 --- ...TestMethodDelayedMultipleDependencies.java | 397 ---- .../TestMethodDelayedSimpleDependencies.java | 286 --- .../TestMethodMultipleDependencies.java | 512 ----- .../TestMethodSimpleDependencies.java | 286 --- .../dependencies/TestModifyDependencies.java | 411 ---- .../TestMultipleDependencies.java | 389 ---- ...estNonProxiedNotInterfaceDependencies.java | 66 - .../TestSetMultipleDependencies.java | 255 --- .../dependencies/TestSimpleDependencies.java | 422 ----- .../TestVectorMultipleDependencies.java | 255 --- .../context/TestContextualFilters.java | 200 -- ...stContextualFiltersAndExternalSources.java | 208 --- .../error/TestNPEInBindMethod.java | 46 - .../filter/TestFromDependencies.java | 320 ---- .../TestMultipleFilterDependencies.java | 595 ------ ...estOptionalMultipleFilterDependencies.java | 621 ------- .../TestOptionalSimpleFilterDependencies.java | 591 ------ .../filter/TestSimpleFilterDependencies.java | 526 ------ .../TestDependencyIdDetection.java | 108 -- .../dependencies/inner/TestInnerProxyMix.java | 85 - .../leak/ListenerStyleLeakTest.java | 106 -- .../pom.xml | 33 - .../components/CheckServiceProvider.java | 44 - .../CollectionCheckServiceProvider.java | 56 - .../timeout/components/FooProvider.java | 56 - .../MultipleCheckServiceProvider.java | 48 - .../components/NullableFooProvider.java | 56 - .../timeout/services/CheckService.java | 30 - .../timeout/services/FooService.java | 40 - .../src/main/resources/metadata.xml | 142 -- .../test/dependencies/timeout/Common.java | 31 - .../timeout/DefaultImplementationTest.java | 111 -- .../test/dependencies/timeout/DelayTest.java | 228 --- .../dependencies/timeout/DelayedProvider.java | 74 - .../test/dependencies/timeout/EmptyTest.java | 232 --- .../test/dependencies/timeout/NullTest.java | 71 - .../dependencies/timeout/NullableTest.java | 110 -- .../dependencies/timeout/TimeoutTest.java | 128 -- .../ipojo-core-service-providing-test/pom.xml | 35 - .../components/CheckProviderParentClass.java | 51 - .../core/components/CheckServiceProvider.java | 83 - .../core/components/FooBarProviderType1.java | 54 - .../core/components/FooProviderType1.java | 117 -- .../core/components/FooProviderTypeDyn.java | 64 - .../core/components/FooProviderTypeDyn2.java | 58 - .../FooProviderWithAnonymousClass.java | 114 -- .../components/NullCheckServiceProvider.java | 76 - .../runtime/core/components/SimpleClass.java | 30 - .../callbacks/CallbacksCheckService.java | 111 -- .../controller/ControllerCheckService.java | 75 - .../DoubleControllerCheckService.java | 85 - .../core/components/inheritance/a/IA.java | 26 - .../core/components/inheritance/b/IB.java | 27 - .../core/components/inheritance/c/C.java | 38 - .../core/components/inheritance/d/D.java | 59 - .../inherited/ProcessImplementation1.java | 45 - .../inherited/ProcessImplementation2.java | 44 - .../inherited/ProcessImplementation3.java | 82 - .../inherited/ProcessImplementation4.java | 82 - .../ProcessParentImplementation.java | 46 - .../components/strategies/BarConsumer.java | 42 - .../core/components/strategies/Consumer.java | 42 - .../strategies/DummyCreationStrategy.java | 191 -- .../strategies/DummyCreationStrategy2.java | 34 - .../strategies/DummyServiceFactory.java | 80 - .../strategies/FooBarProviderType1.java | 86 - .../strategies/FooProviderType1.java | 86 - .../runtime/core/services/BarService.java | 29 - .../runtime/core/services/CheckService.java | 31 - .../runtime/core/services/ChildInterface.java | 25 - .../runtime/core/services/FooService.java | 39 - .../core/services/ParentInterface1.java | 25 - .../core/services/ParentInterface2.java | 25 - .../core/services/ParentParentInterface.java | 25 - .../src/main/resources/basics.xml | 140 -- .../main/resources/callbacks/callbacks.xml | 60 - .../src/main/resources/concrete-abstract.xml | 52 - .../controller/service-controller.xml | 105 -- .../src/main/resources/inheritance/cons.xml | 22 - .../resources/inheritance/inheritance.xml | 64 - .../main/resources/inheritance/provider.xml | 22 - .../strategies/metadata-strategies.xml | 77 - .../felix/ipojo/runtime/core/Common.java | 60 - .../ipojo/runtime/core/TestCallbacks.java | 174 -- .../felix/ipojo/runtime/core/TestClass.java | 93 - .../ipojo/runtime/core/TestDynamicProps.java | 294 --- .../core/TestDynamicPropsReconfiguration.java | 758 -------- .../ipojo/runtime/core/TestExposition.java | 159 -- .../runtime/core/TestInheritedClasses.java | 204 -- .../ipojo/runtime/core/TestListeners.java | 272 --- .../ipojo/runtime/core/TestNullCheck.java | 77 - .../runtime/core/TestOSGiProperties.java | 85 - .../core/TestPropertiesInAnonymousClass.java | 166 -- .../core/TestProvidedServiceArchitecture.java | 231 --- .../runtime/core/TestServiceController.java | 260 --- .../ipojo/runtime/core/TestSimplePS.java | 81 - .../ipojo/runtime/core/TestStaticProps.java | 115 -- .../core/TestStaticPropsReconfiguration.java | 349 ---- .../core/inheritence/InheritanceTest.java | 170 -- .../core/strategies/CustomStrategy2Test.java | 228 --- .../core/strategies/CustomStrategyTest.java | 229 --- .../strategies/PerInstanceStrategyTest.java | 227 --- ipojo/runtime/core-it/pom.xml | 430 ----- .../main/appended-resources/META-INF/NOTICE | 0 ipojo/runtime/core/changelog.txt | 398 ---- ipojo/runtime/core/obr.xml | 44 - ipojo/runtime/core/pom.xml | 375 ---- .../appended-resources/META-INF/DEPENDENCIES | 21 - .../main/appended-resources/META-INF/LICENSE | 42 - .../main/appended-resources/META-INF/NOTICE | 8 - .../apache/felix/ipojo/ComponentFactory.java | 461 ----- .../apache/felix/ipojo/ComponentInstance.java | 128 -- .../felix/ipojo/ConfigurationException.java | 81 - .../felix/ipojo/ConfigurationTracker.java | 327 ---- .../felix/ipojo/ConstructorInjector.java | 53 - .../apache/felix/ipojo/ContextListener.java | 38 - .../org/apache/felix/ipojo/ContextSource.java | 58 - .../org/apache/felix/ipojo/ErrorHandler.java | 45 - .../apache/felix/ipojo/EventDispatcher.java | 181 -- .../java/org/apache/felix/ipojo/Factory.java | 205 -- .../felix/ipojo/FactoryClassloader.java | 88 - .../felix/ipojo/FactoryStateListener.java | 36 - .../apache/felix/ipojo/FieldInterceptor.java | 49 - .../java/org/apache/felix/ipojo/Handler.java | 264 --- .../apache/felix/ipojo/HandlerFactory.java | 65 - .../apache/felix/ipojo/HandlerManager.java | 244 --- .../felix/ipojo/HandlerManagerFactory.java | 223 --- .../felix/ipojo/IPOJOServiceFactory.java | 43 - .../org/apache/felix/ipojo/IPojoContext.java | 511 ----- .../org/apache/felix/ipojo/IPojoFactory.java | 1184 ------------ .../apache/felix/ipojo/InstanceManager.java | 1578 ---------------- .../felix/ipojo/InstanceStateListener.java | 43 - .../apache/felix/ipojo/MethodInterceptor.java | 80 - .../felix/ipojo/MissingHandlerException.java | 65 - .../java/org/apache/felix/ipojo/Nullable.java | 33 - .../java/org/apache/felix/ipojo/Pojo.java | 35 - .../felix/ipojo/PolicyServiceContext.java | 498 ----- .../apache/felix/ipojo/PrimitiveHandler.java | 257 --- .../ipojo/PrimitiveInstanceDescription.java | 178 -- .../felix/ipojo/PrimitiveTypeDescription.java | 228 --- .../apache/felix/ipojo/ServiceContext.java | 149 -- .../ipojo/UnacceptableConfiguration.java | 47 - .../ipojo/architecture/Architecture.java | 40 - .../ComponentTypeDescription.java | 318 ---- .../ipojo/architecture/CustomHandlerInfo.java | 37 - .../architecture/HandlerDescription.java | 86 - .../architecture/InstanceDescription.java | 203 -- .../architecture/PropertyDescription.java | 215 --- .../ipojo/configuration/Configuration.java | 32 - .../felix/ipojo/configuration/Instance.java | 189 -- .../ipojo/context/ServiceReferenceImpl.java | 156 -- .../context/ServiceRegistrationImpl.java | 272 --- .../felix/ipojo/context/ServiceRegistry.java | 346 ---- .../apache/felix/ipojo/context/StringMap.java | 148 -- ...paratorBasedServiceRankingInterceptor.java | 65 - .../dependency/impl/DependencyProperties.java | 109 -- .../EmptyBasedServiceRankingInterceptor.java | 56 - ...FilterBasedServiceTrackingInterceptor.java | 63 - .../impl/ServiceReferenceManager.java | 982 ---------- .../impl/ServiceReferenceUtils.java | 145 -- .../impl/TransformedServiceReferenceImpl.java | 170 -- .../DefaultDependencyInterceptor.java | 59 - .../DefaultServiceRankingInterceptor.java | 71 - .../DefaultServiceTrackingInterceptor.java | 65 - .../interceptors/DependencyInterceptor.java | 56 - .../ServiceBindingInterceptor.java | 70 - .../ServiceRankingInterceptor.java | 81 - .../ServiceTrackingInterceptor.java | 64 - .../TransformedServiceReference.java | 88 - .../ipojo/extender/ConfigurationBuilder.java | 61 - .../felix/ipojo/extender/Declaration.java | 57 - .../extender/DeclarationBuilderService.java | 127 -- .../ipojo/extender/DeclarationHandle.java | 50 - .../ipojo/extender/ExtensionDeclaration.java | 48 - .../felix/ipojo/extender/InstanceBuilder.java | 105 -- .../ipojo/extender/InstanceDeclaration.java | 80 - .../apache/felix/ipojo/extender/Status.java | 49 - .../felix/ipojo/extender/TypeDeclaration.java | 63 - .../extender/builder/FactoryBuilder.java | 41 - .../builder/FactoryBuilderException.java | 46 - .../extender/internal/AbstractService.java | 104 -- .../extender/internal/BundleProcessor.java | 45 - .../ipojo/extender/internal/DefaultJob.java | 67 - .../ipojo/extender/internal/Extender.java | 340 ---- .../ipojo/extender/internal/Lifecycle.java | 36 - .../internal/LifecycleQueueService.java | 29 - .../builder/ReflectiveFactoryBuilder.java | 75 - .../declaration/AbstractDeclaration.java | 148 -- .../DefaultExtensionDeclaration.java | 64 - .../DefaultInstanceDeclaration.java | 107 -- .../declaration/DefaultTypeDeclaration.java | 96 - .../service/DeclarationServiceFactory.java | 65 - .../service/DefaultConfigurationBuilder.java | 60 - .../DefaultDeclarationBuilderService.java | 60 - .../service/DefaultInstanceBuilder.java | 114 -- .../internal/linker/DeclarationLinker.java | 109 -- .../linker/InstanceBundleContextAware.java | 44 - .../extender/internal/linker/ManagedType.java | 384 ---- .../processor/ChainedBundleProcessor.java | 127 -- .../processor/ComponentsBundleProcessor.java | 231 --- .../ConfigurationAnnotationScanner.java | 71 - .../processor/ConfigurationProcessor.java | 331 ---- .../processor/ExtensionBundleProcessor.java | 176 -- .../processor/ForwardingBundleProcessor.java | 52 - .../processor/QueuingActivationProcessor.java | 83 - .../processor/ReverseBundleProcessor.java | 96 - .../internal/queue/AbstractQueueService.java | 86 - .../internal/queue/ExecutorQueueService.java | 250 --- .../internal/queue/GroupThreadFactory.java | 67 - .../internal/queue/JobInfoCallable.java | 198 -- .../internal/queue/NamingThreadFactory.java | 92 - .../internal/queue/PrefixedThreadFactory.java | 74 - .../internal/queue/QueueNotifier.java | 32 - .../extender/internal/queue/Statistic.java | 70 - .../queue/SynchronousQueueService.java | 131 -- .../queue/debug/ReplayQueueEventProxy.java | 157 -- .../queue/pref/HeaderPreferenceSelection.java | 55 - .../internal/queue/pref/Preference.java | 36 - .../queue/pref/PreferenceQueueService.java | 167 -- .../queue/pref/PreferenceSelection.java | 29 - .../pref/enforce/EnforcedQueueService.java | 131 -- .../pref/enforce/ForwardingQueueService.java | 82 - .../felix/ipojo/extender/queue/Callback.java | 42 - .../felix/ipojo/extender/queue/Job.java | 36 - .../felix/ipojo/extender/queue/JobInfo.java | 74 - .../ipojo/extender/queue/QueueListener.java | 67 - .../ipojo/extender/queue/QueueService.java | 125 -- .../extender/queue/debug/QueueEventProxy.java | 42 - .../architecture/ArchitectureHandler.java | 116 -- .../configuration/ConfigurationHandler.java | 909 --------- .../ConfigurationHandlerDescription.java | 152 -- .../configuration/ConfigurationListener.java | 38 - .../context/BundleContextHandler.java | 192 -- .../AggregateDependencyInjectionType.java | 41 - .../ipojo/handlers/dependency/Dependency.java | 1259 ------------- .../dependency/DependencyCallback.java | 319 ---- .../DependencyConfigurationChecker.java | 465 ----- .../dependency/DependencyDescription.java | 174 -- .../dependency/DependencyHandler.java | 558 ------ .../DependencyHandlerDescription.java | 208 --- .../handlers/dependency/NullableObject.java | 94 - .../handlers/dependency/ProxyGenerator.java | 213 --- .../handlers/dependency/ServiceList.java | 456 ----- .../ipojo/handlers/dependency/ServiceSet.java | 453 ----- .../handlers/dependency/ServiceUsage.java | 100 - .../lifecycle/callback/LifecycleCallback.java | 101 - .../callback/LifecycleCallbackHandler.java | 178 -- .../controller/ControllerHandler.java | 162 -- .../providedservice/CreationStrategy.java | 76 - .../providedservice/ProvidedService.java | 1160 ------------ .../ProvidedServiceDescription.java | 195 -- .../ProvidedServiceHandler.java | 682 ------- .../ProvidedServiceHandlerDescription.java | 119 -- .../ProvidedServiceListener.java | 52 - .../ConfigurableCreationStrategy.java | 142 -- .../ErrorPrintingServiceFactoryProxy.java | 109 -- .../strategy/ServiceObjectFactory.java | 36 - .../felix/ipojo/parser/FieldMetadata.java | 159 -- .../ipojo/parser/ManifestMetadataParser.java | 561 ------ .../felix/ipojo/parser/MethodMetadata.java | 246 --- .../felix/ipojo/parser/ParseException.java | 40 - .../apache/felix/ipojo/parser/ParseUtils.java | 85 - .../felix/ipojo/parser/PojoMetadata.java | 306 --- .../org/apache/felix/ipojo/util/Callback.java | 278 --- .../ipojo/util/ContextSourceManager.java | 332 ---- .../ipojo/util/DependencyMetadataHelper.java | 109 -- .../felix/ipojo/util/DependencyModel.java | 1277 ------------- .../ipojo/util/DependencyModelListener.java | 40 - .../ipojo/util/DependencyStateListener.java | 39 - .../org/apache/felix/ipojo/util/Fields.java | 134 -- .../util/InstanceConfigurationSource.java | 115 -- .../felix/ipojo/util/InvocationResult.java | 76 - .../java/org/apache/felix/ipojo/util/Log.java | 47 - .../org/apache/felix/ipojo/util/Logger.java | 318 ---- .../org/apache/felix/ipojo/util/Methods.java | 189 -- .../org/apache/felix/ipojo/util/Property.java | 689 ------- .../apache/felix/ipojo/util/Reflection.java | 35 - .../felix/ipojo/util/SecurityHelper.java | 218 --- .../felix/ipojo/util/ServiceLocator.java | 63 - .../ServiceReferenceRankingComparator.java | 90 - .../apache/felix/ipojo/util/StreamUtils.java | 43 - .../ipojo/util/SystemPropertiesSource.java | 47 - .../org/apache/felix/ipojo/util/Tracker.java | 753 -------- .../felix/ipojo/util/TrackerCustomizer.java | 69 - .../runtime/core/src/main/resources/core.xsd | 704 ------- .../core/src/main/resources/metadata.xml | 49 - .../felix/ipojo/IPojoFactoryTestCase.java | 118 -- .../felix/ipojo/InstanceManagerTest.java | 177 -- .../ipojo/configuration/InstanceDSLTest.java | 102 - .../impl/DependencyPropertiesTest.java | 85 - .../TransformedServiceReferenceTest.java | 95 - .../DefaultExtensionDeclarationTestCase.java | 66 - .../DefaultInstanceDeclarationTestCase.java | 132 -- .../DefaultTypeDeclarationTestCase.java | 81 - .../DefaultConfigurationBuilderTestCase.java | 100 - ...aultDeclarationBuilderServiceTestCase.java | 96 - .../DefaultInstanceBuilderTestCase.java | 111 -- .../linker/DeclarationLinkerTestCase.java | 116 -- .../internal/linker/ManagedTypeTestCase.java | 99 - .../ChainedBundleProcessorTestCase.java | 76 - .../ExtensionBundleProcessorTestCase.java | 79 - .../ReverseBundleProcessorTestCase.java | 84 - .../queue/AbstractQueueServiceTestCase.java | 133 -- .../queue/ExecutorQueueServiceTestCase.java | 205 -- .../queue/GroupThreadFactoryTestCase.java | 45 - .../queue/JobInfoCallableTestCase.java | 101 - .../queue/NamingThreadFactoryTestCase.java | 89 - .../queue/PrefixedThreadFactoryTestCase.java | 48 - .../SynchronousQueueServiceTestCase.java | 96 - .../internal/queue/callable/EmptyJob.java | 59 - .../queue/callable/ExceptionCallable.java | 38 - .../queue/callable/SleepingCallable.java | 40 - .../queue/callable/StringCallable.java | 63 - .../debug/ReplayQueueEventProxyTestCase.java | 122 -- .../HeaderPreferenceSelectionTestCase.java | 79 - .../enforce/EnforcedQueueServiceTestCase.java | 88 - .../dependency/DependencyIdentifierTest.java | 158 -- .../handlers/dependency/NullableTest.java | 67 - .../handlers/dependency/SmartProxyTest.java | 132 -- .../dependency/TestSpecification.java | 24 - .../ComponentTestWithAnotherSuperClass.java | 30 - .../ComponentTestWithSuperClass.java | 25 - .../ProvidedServiceHandlerTest.java | 178 -- .../parser/ManipulationMetadataTest.java | 257 --- .../ipojo/parser/MethodMetadataTest.java | 127 -- .../felix/ipojo/parser/PojoMetadataTest.java | 322 ---- .../apache/felix/ipojo/test/MockBundle.java | 190 -- .../ipojo/util/ContextSourceManagerTest.java | 115 -- .../util/InstanceConfigurationSourceTest.java | 169 -- .../util/ManifestMetadataParserTest.java | 111 -- .../util/SystemPropertiesSourceTest.java | 57 - .../test/resources/manipulation/MANIFEST.MF | 142 -- .../distributions/maven-tutorial/pom.xml | 100 - .../appended-resources/META-INF/DEPENDENCIES | 27 - .../main/appended-resources/META-INF/NOTICE | 8 - .../src/main/assembly/distribution.xml | 45 - .../hello.client.annotations/pom.xml | 72 - .../example/hello/client/HelloClient.java | 88 - .../example/hello/client/MyDummyHello.java | 30 - .../hello.felix.annotations/pom.xml | 123 -- .../hello.impl.annotations/pom.xml | 72 - .../ipojo/example/hello/impl/HelloImpl.java | 53 - .../src/main/skeleton/hello.service/pom.xml | 48 - .../main/java/ipojo/example/hello/Hello.java | 33 - .../maven-tutorial/src/main/skeleton/pom.xml | 94 - .../skeleton/xml/hello.client.xml/pom.xml | 72 - .../example/hello/client/HelloClient.java | 90 - .../src/main/resources/metadata.xml | 47 - .../main/skeleton/xml/hello.felix.xml/pom.xml | 124 -- .../main/skeleton/xml/hello.impl.xml/pom.xml | 72 - .../ipojo/example/hello/impl/HelloImpl.java | 36 - .../src/main/resources/metadata.xml | 28 - .../runtime/distributions/quickstart/pom.xml | 144 -- .../appended-resources/META-INF/DEPENDENCIES | 27 - .../main/appended-resources/META-INF/NOTICE | 8 - .../src/main/assembly/distribution.xml | 61 - .../ten-minutes-tutorial/pom.xml | 256 --- .../src/main/skeleton/build.xml | 53 - .../main/skeleton/spell.checker.gui/build.xml | 75 - .../spell.checker.gui/spell.checker.gui.bnd | 19 - .../src/spell/gui/SpellCheckerGui.java | 133 -- .../src/main/skeleton/spell.checker/build.xml | 75 - .../skeleton/spell.checker/spell.checker.bnd | 19 - .../src/spell/checker/SpellCheck.java | 48 - .../src/main/skeleton/spell.english/build.xml | 75 - .../skeleton/spell.english/spell.english.bnd | 19 - .../src/spell/english/EnglishDictionary.java | 46 - .../main/skeleton/spell.services/build.xml | 55 - .../spell.services/spell.services.bnd | 19 - .../src/spell/services/DictionaryService.java | 30 - .../src/spell/services/SpellChecker.java | 24 - .../src/main/solution/build.xml | 38 - .../main/solution/spell.checker.gui/build.xml | 75 - .../spell.checker.gui/spell.checker.gui.bnd | 19 - .../src/spell/gui/SpellCheckerGui.java | 138 -- .../src/main/solution/spell.checker/build.xml | 75 - .../solution/spell.checker/spell.checker.bnd | 19 - .../src/spell/checker/SpellCheck.java | 78 - .../src/main/solution/spell.english/build.xml | 75 - .../solution/spell.english/spell.english.bnd | 19 - .../src/spell/english/EnglishDictionary.java | 56 - .../main/solution/spell.services/build.xml | 55 - .../spell.services/spell.services.bnd | 19 - .../src/spell/services/DictionaryService.java | 31 - .../src/spell/services/SpellChecker.java | 40 - .../runtime/ipojo-gogo-commands/changelog.txt | 176 -- ipojo/runtime/ipojo-gogo-commands/obr.xml | 24 - ipojo/runtime/ipojo-gogo-commands/pom.xml | 126 -- .../appended-resources/META-INF/DEPENDENCIES | 11 - .../main/appended-resources/META-INF/NOTICE | 0 .../apache/felix/ipojo/arch/gogo/Arch.java | 355 ---- ipojo/runtime/karaf-feature/changelog.txt | 398 ---- ipojo/runtime/karaf-feature/pom.xml | 126 -- .../appended-resources/META-INF/DEPENDENCIES | 10 - .../src/main/assembly/assembly.xml | 54 - .../src/main/features/features.xml | 46 - ipojo/runtime/pom.xml | 81 - .../appended-resources/META-INF/DEPENDENCIES | 21 - .../main/appended-resources/META-INF/NOTICE | 8 - ipojo/webconsole-plugin/changelog.txt | 37 - ipojo/webconsole-plugin/obr.xml | 29 - ipojo/webconsole-plugin/pom.xml | 133 -- .../appended-resources/META-INF/DEPENDENCIES | 17 - .../main/appended-resources/META-INF/LICENSE | 33 - .../main/appended-resources/META-INF/NOTICE | 4 - .../felix/ipojo/webconsole/IPOJOPlugin.java | 821 -------- .../felix/ipojo/webconsole/StateUtils.java | 233 --- .../src/main/resources/res/factories.html | 66 - .../src/main/resources/res/factory.html | 114 -- .../src/main/resources/res/handlers.html | 70 - .../src/main/resources/res/instance.html | 127 -- .../src/main/resources/res/instances.html | 66 - .../src/main/resources/res/ui/factory.js | 87 - .../main/resources/res/ui/factory_detail.js | 161 -- .../src/main/resources/res/ui/handler.js | 95 - .../main/resources/res/ui/instance_detail.js | 189 -- .../src/main/resources/res/ui/ipojo.css | 33 - .../src/main/resources/res/ui/ipojo.js | 84 - 1973 files changed, 236063 deletions(-) delete mode 100644 ipojo/.gitignore delete mode 100644 ipojo/arch/changelog.txt delete mode 100644 ipojo/arch/obr.xml delete mode 100644 ipojo/arch/pom.xml delete mode 100644 ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/arch/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java delete mode 100755 ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml delete mode 100755 ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java delete mode 100755 ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java delete mode 100755 ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml delete mode 100755 ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java delete mode 100644 ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml delete mode 100755 ipojo/distributions/handler-tutorial/Log-Handler/pom.xml delete mode 100644 ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java delete mode 100755 ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java delete mode 100644 ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml delete mode 100644 ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties delete mode 100644 ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler/pom.xml delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java delete mode 100755 ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java delete mode 100644 ipojo/distributions/handler-tutorial/pom.xml delete mode 100644 ipojo/distributions/ipojo-webconsole-quicktart/pom.xml delete mode 100644 ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml delete mode 100644 ipojo/distributions/pom.xml delete mode 100644 ipojo/handler/eventadmin/changelog.txt delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/changelog.txt delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/metadata.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/obr.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/pom.xml delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java delete mode 100644 ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd delete mode 100644 ipojo/handler/eventadmin/pom.xml delete mode 100644 ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/eventadmin/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/extender/changelog.txt delete mode 100644 ipojo/handler/extender/metadata.xml delete mode 100644 ipojo/handler/extender/obr.xml delete mode 100644 ipojo/handler/extender/pom.xml delete mode 100644 ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/extender/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java delete mode 100644 ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java delete mode 100644 ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java delete mode 100644 ipojo/handler/extender/src/main/resources/extender-pattern.xsd delete mode 100644 ipojo/handler/jmx/changelog.txt delete mode 100644 ipojo/handler/jmx/jmx-handler-it/pom.xml delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java delete mode 100644 ipojo/handler/jmx/jmx-handler-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/jmx/jmx-handler/changelog.txt delete mode 100644 ipojo/handler/jmx/jmx-handler/metadata.xml delete mode 100644 ipojo/handler/jmx/jmx-handler/obr.xml delete mode 100644 ipojo/handler/jmx/jmx-handler/pom.xml delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java delete mode 100644 ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd delete mode 100644 ipojo/handler/jmx/pom.xml delete mode 100644 ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/jmx/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/temporal/changelog.txt delete mode 100644 ipojo/handler/temporal/pom.xml delete mode 100644 ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java delete mode 100755 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java delete mode 100755 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java delete mode 100755 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/changelog.txt delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/obr.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/pom.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd delete mode 100644 ipojo/handler/transaction/pom.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/pom.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java delete mode 100644 ipojo/handler/transaction/transaction-handler-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/transaction/transaction-handler/pom.xml delete mode 100644 ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java delete mode 100644 ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java delete mode 100644 ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/whiteboard/changelog.txt delete mode 100644 ipojo/handler/whiteboard/pom.xml delete mode 100644 ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/whiteboard/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/changelog.txt delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/metadata.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/obr.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/pom.xml delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java delete mode 100644 ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd delete mode 100644 ipojo/junit4osgi/felix-command/LICENSE delete mode 100644 ipojo/junit4osgi/felix-command/NOTICE delete mode 100644 ipojo/junit4osgi/felix-command/doc/changelog.txt delete mode 100644 ipojo/junit4osgi/felix-command/metadata.xml delete mode 100644 ipojo/junit4osgi/felix-command/pom.xml delete mode 100644 ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java delete mode 100644 ipojo/junit4osgi/immediate-launcher/LICENSE delete mode 100644 ipojo/junit4osgi/immediate-launcher/NOTICE delete mode 100644 ipojo/junit4osgi/immediate-launcher/metadata.xml delete mode 100644 ipojo/junit4osgi/immediate-launcher/pom.xml delete mode 100644 ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java delete mode 100644 ipojo/junit4osgi/junit4osgi/LICENSE delete mode 100644 ipojo/junit4osgi/junit4osgi/LICENSE.junit delete mode 100644 ipojo/junit4osgi/junit4osgi/NOTICE delete mode 100644 ipojo/junit4osgi/junit4osgi/doc/changelog.txt delete mode 100644 ipojo/junit4osgi/junit4osgi/metadata.xml delete mode 100644 ipojo/junit4osgi/junit4osgi/pom.xml delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java delete mode 100644 ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java delete mode 100644 ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java delete mode 100644 ipojo/junit4osgi/pom.xml delete mode 100644 ipojo/junit4osgi/swing-runner/LICENSE delete mode 100644 ipojo/junit4osgi/swing-runner/NOTICE delete mode 100644 ipojo/junit4osgi/swing-runner/doc/changelog.txt delete mode 100644 ipojo/junit4osgi/swing-runner/metadata.xml delete mode 100644 ipojo/junit4osgi/swing-runner/pom.xml delete mode 100644 ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java delete mode 100644 ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java delete mode 100644 ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form delete mode 100644 ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java delete mode 100644 ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java delete mode 100644 ipojo/manipulator/annotations/changelog.txt delete mode 100644 ipojo/manipulator/annotations/pom.xml delete mode 100644 ipojo/manipulator/annotations/src/main/appended-resources/NOTICE delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java delete mode 100644 ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/changelog.txt delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/pom.xml delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml delete mode 100644 ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml delete mode 100644 ipojo/manipulator/changelog.txt delete mode 100644 ipojo/manipulator/ipojo-ant-task/changelog.txt delete mode 100644 ipojo/manipulator/ipojo-ant-task/pom.xml delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd delete mode 100644 ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd delete mode 100644 ipojo/manipulator/manipulator-bom/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so delete mode 100755 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java delete mode 100644 ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml delete mode 100644 ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java delete mode 100644 ipojo/manipulator/manipulator-it/pom.xml delete mode 100644 ipojo/manipulator/manipulator-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/manipulator/changelog.txt delete mode 100644 ipojo/manipulator/manipulator/pom.xml delete mode 100644 ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassLoaderAwareClassWriter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassChecker.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestAttributeFilter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationEngine.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationResultVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationUnit.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/MetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Reporter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceStore.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitArray.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnd.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnum.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Binding.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ProvidesVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/RequiresVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ServiceControllerVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/UpdatedVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/AbstractBindVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/Action.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/ParameterBindVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/FieldGenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitorFactory.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/MethodGenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/ParameterGenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/RootGenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/SubArrayVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/TypeGenericVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullBinding.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullVisitorFactory.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/FieldStereotypeVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/MethodStereotypeVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/ParameterStereotypeVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/StereotypeVisitorFactory.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/TypeStereotypeVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Bindings.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Elements.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataFilter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataRenderer.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/EmptyReporter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/SystemReporter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModule.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteral.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationVisitorFactory.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/BindingContext.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Module.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/ModuleProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Predicate.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/helper/Predicates.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CompositeModuleProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CoreModuleProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/DefaultModuleProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/ServiceLoaderModuleProvider.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStore.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ManifestBuilder.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ResourceMapper.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilder.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapper.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapper.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapper.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/ChainedAnnotationVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Classpath.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Collections5.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Constants.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/IsolatedClassLoader.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Metadatas.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Streams.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Strings.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationAdapter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationResultAdapter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyVisitor.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriter.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/SchemaResolver.java delete mode 100644 ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/META-INF/constants.properties delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/composite.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/core.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/event-admin.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/extender-pattern.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/jmx.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/temporal.xsd delete mode 100644 ipojo/manipulator/manipulator/src/main/resources/xsd/whiteboard-pattern.xsd delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/ComponentInstance.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/InstanceManager.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/Pojo.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ClassCheckerTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/PojoizationTest.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/ManipulationEngineTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProviderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbenchTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlaybackTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/AnnotationAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/ArrayAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/EnumAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/InnerAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Mode.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/SimpleTypes.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Support.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistryTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistryTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistryTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistryTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistryTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/SelectionTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitorTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitorTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitorTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/NamesTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/MetadataRendererTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModuleTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteralTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStoreTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStoreTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilderTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapperTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapperTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapperTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StreamsTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StringsTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitorTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriterTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriterTestCase.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/AnnotatedComponent.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/Child.java delete mode 100755 ipojo/manipulator/manipulator/src/test/java/test/ClusterDaemon.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/ConstructorCheck.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/DoubleArray.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/FakeAnnotation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/InterfaceWithStatic.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/NoValidConstructor.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/NonSunClass.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/Parent.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/PlentyOfAnnotations.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/PojoWithFinalArray.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/PojoWithStaticInterface.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/SimplePojo.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/frames/CryptoServiceSingleton.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/frames/Hash.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/inner/Computation.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/inner/Example.java delete mode 100644 ipojo/manipulator/manipulator/src/test/java/test/ipojo/ExternalHandler.java delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/MANIFEST.MF delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/empty-metadata.xml delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/metadata.xml delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/tests.manipulation-no-annotations.jar delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/tests.manipulation.java5.jar delete mode 100644 ipojo/manipulator/manipulator/src/test/resources/tests.manipulator-annotations.jar delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/changelog.txt delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/pom.xml delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/MavenReporter.java delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/bundle.properties delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/pom.xml delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/source.txt delete mode 100644 ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml delete mode 100644 ipojo/manipulator/online-manipulator/changelog.txt delete mode 100644 ipojo/manipulator/online-manipulator/pom.xml delete mode 100644 ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BridgeClassLoader.java delete mode 100644 ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BundleAwareJarFileResourceStore.java delete mode 100644 ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/Files.java delete mode 100644 ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/IPOJOURLHandler.java delete mode 100644 ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/SystemLogService.java delete mode 100644 ipojo/manipulator/online-manipulator/src/main/resources/META-INF/constants.properties delete mode 100644 ipojo/manipulator/pom.xml delete mode 100644 ipojo/manipulator/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/metadata/changelog.txt delete mode 100644 ipojo/metadata/pom.xml delete mode 100644 ipojo/metadata/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java delete mode 100644 ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java delete mode 100644 ipojo/pom.xml delete mode 100644 ipojo/runtime/api/changelog.txt delete mode 100644 ipojo/runtime/api/pom.xml delete mode 100644 ipojo/runtime/api/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/api/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/runtime/api/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Property.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Service.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ServiceProperty.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java delete mode 100644 ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/DependencyTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/PropertyTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/ServiceTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java delete mode 100644 ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java delete mode 100644 ipojo/runtime/changelog.txt delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/pom.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata-import-export.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestFilteredExport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestMultipleExport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalExport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalMultipleExport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestSimpleExport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedFilteredImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedMultipleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalMultipleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedSimpleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestFilteredImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestMultipleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalMultipleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestSimpleImport.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/pom.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata-instance.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestInstanceScope.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestSimpleInstance.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfigurableInstantiation.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfiguration.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestMultipleInstantiation.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalInstantiation.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalMultipleInstantiation.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestSimpleInstantiation.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/pom.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/EmptyCompositeTest.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/FactoryManagementTest.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRangeTest.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRegistryTest.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/pom.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata-providing.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCompositeAPI.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp0.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp1.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp2.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp3.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp4.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp5.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp6.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp7.java delete mode 100644 ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp8.java delete mode 100644 ipojo/runtime/composite-it/pom.xml delete mode 100644 ipojo/runtime/composite-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/composite/changelog.txt delete mode 100644 ipojo/runtime/composite/obr.xml delete mode 100644 ipojo/runtime/composite/pom.xml delete mode 100644 ipojo/runtime/composite/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/composite/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/runtime/composite/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeHandler.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/FieldMetadata.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedService.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandlerDescription.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ServiceExporter.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java delete mode 100644 ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/util/SourceManager.java delete mode 100644 ipojo/runtime/composite/src/main/resources/composite.xsd delete mode 100644 ipojo/runtime/composite/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/FooImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/HostImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyComponentImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyServiceImpl.java delete mode 100755 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/PlainHelloImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/BarService.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/Foo.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/MyService.java delete mode 100755 ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/PlainHello.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/CompositeTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/ExternalHandlerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/PrimitiveComponentTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/SingletonComponentTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Whiteboard.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/HelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloConsumer.xml delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloProvider.xml delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloConsumer.xml delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloProvider.xml delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByAriesBlueprint1_1_0.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByFelixSCR1_6_2.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByKnopflerfishSCR4_0_2.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingAriesBlueprint1_1_0.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingFelixSCR1_6_2.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingKnopflerfishSCR4_0_2.java delete mode 100644 ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestiPOJOOnly.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/Foo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/RGB.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DependencyUsingSpecification.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/ComponentWithProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/InstantiatedComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/ComponentUsingContext.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestContext.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiatedComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProviding.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProviderWithPropagation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateConfigurableFooProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForImmediate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForServices.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForImmediate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropagation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdated.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Bean.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureAnotherInstance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureNothing.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureThreeInstancesUsingMethods.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstances.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithInheritance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithOverridding.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComplexComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyComplexConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexConfigurations.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationInAnotherBundle.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfMyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfThreeInstancesUsingMethods.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfTwoInstances.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithInheritedInstance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithOverriddenInstance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConfigurations.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/arch/MyComponentToIntrospect.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithBundleContextAndProperty.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithDefaultValueProperty.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithNamedProperty.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithTwoProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithUnnamedProperty.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/updated.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConstructorInjectionOfProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurablePropertiesUsingConfigAdmin.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestListeners.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndConfigAdmin.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndConfigAdmin.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingConstructor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingField.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInConstructor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInField.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithThreeConstructorParams.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoConstructorParams.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoFields.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoSetters.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInConstructor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInField.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromAnnotations.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromXML.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingComponentAndInstanceContext.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingContextAndProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/resources/exam.properties delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FrenchHelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/GermanHelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/HelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/TestDeclarationBuilderService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceHandler.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckServiceHandlerDescription.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/AutoHandlerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerWithFieldInterceptorTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FiveInstances.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoInstances.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/OneDuplicateInstance.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/NoService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInstances.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestReconfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUnacceptableConfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-test/src/test/resources/exam.properties delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyCons.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/services/MyService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/cons.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/instances.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.1.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v1.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v2.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/VersionConflictTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/DummyImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/DummyHandler.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/EmptyHandler.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Dummy.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/MyService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/User.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/resources/dummy-component.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/resources/dummy-handler.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/main/resources/ignorecase.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/test/java/org/apache/felix/ipojo/runtime/core/DummyHandlerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/test/java/org/apache/felix/ipojo/runtime/core/IgnoreCaseHandlerSelectionTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-handler-test/src/test/java/org/apache/felix/ipojo/runtime/core/Tools.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallbackWithErrorCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/LifecycleControllerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CallbackCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCallback.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorCallback.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestImmediateCallback.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestImmediateCallbackSeveralFactories.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestImmediateCallbackSingletonFactory.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestImmediateLifeCycleController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestParentCallback.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-callback-test/src/test/resources/exam.properties delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableLifecycleControllerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/LifecycleControllerTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurableLifeCycleController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestImmediateLifeCycleController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestLifeCycleController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-lifecycle-controller-test/src/test/resources/exam.properties delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyErroneousComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/MyService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/main/resources/component.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/main/resources/erroneous-component.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBNDManifestLoggerInfo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestErrorHandler.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManifestLoggerInfo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSystemLoggerInfo.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-logger-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSystemLoggerWarning.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AdvancedFooConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/AddLocationTrackingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/AdvancedTrackerAndRankerInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/EnhancingBindingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/FilterRankingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/GradeComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/HidingTrackingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/PropertyTrackingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/ProxyBindingInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/interceptors/TrackerAndRankerInterceptor.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Enhanced.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Setter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestBindingInterceptors.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestCombinationOfInterceptors.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestHidingServices.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestInterceptorsOnSeveralDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestRankingServices.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-interceptor-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestTransformingServices.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CollectionCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooServiceDefaultImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ListCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/SetCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/VectorCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradeComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradedFooServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/exceptions/ExceptionAwareCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/exceptions/NoServiceException.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C3.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/MyFilter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/optional/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceDelegator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceGetAndDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceNoDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceUsingStringService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/Helper.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Call.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata-comparator.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata-filter.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata-policies.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestDelayedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestMethodDelayedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestMethodOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/di/TestOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/exceptions/TestDependenciesWithExceptions.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestDelayedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestDelayedOptionalMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestMethodDelayedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestMethodDelayedOptionalMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestMethodOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestMethodOptionalMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestNullableTransitiveClassloading.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestOptionalMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestOptionalNoNullableDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestProxiedDelayedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestProxiedDelayedOptionalMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-optional-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/optional/TestProxiedOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CollectionCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooServiceDefaultImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ListCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/SetCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/VectorCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradeComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradedFooServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C3.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/MyFilter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/optional/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceDelegator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceGetAndDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceNoDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceUsingStringService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/Helper.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Call.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/resources/metadata-comparator.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/resources/metadata-filter.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/resources/metadata-policies.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/comparator/TestComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestDynamicPriority.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMethodSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticOptionalDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-policies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/policies/TestStaticSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CollectionCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooServiceDefaultImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ListCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/SetCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/VectorCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradeComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradedFooServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C3.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/MyFilter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/optional/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceDelegator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceGetAndDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceNoDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceUsingStringService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/Helper.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Call.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/resources/metadata-comparator.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/resources/metadata-filter.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/resources/metadata-policies.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedCollectionMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedDelayedMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedDelayedSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedListMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedSetMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxiedSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-proxies/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/proxies/TestProxyTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CollectionCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooProviderType2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FooServiceDefaultImpl.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ListCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/SetCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/VectorCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradeComparator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/comparator/GradedFooServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/ContextualFilterConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/Provider1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/Provider2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/NullPointerExceptionBinder.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/FilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/filter/MultipleFilterCheckSubscriber.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/identification/ComponentWithCustomMethods.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/C3.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/inner/MyFilter.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/leak/DefaultHelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/leak/DefaultLeakingService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/optional/MyComponent.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/DynCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MethodMultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/MultipleCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/policies/RankedFooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceDelegator.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceGetAndDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceNoDelegate.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/CheckServiceUsingStringService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/proxy/Helper.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Call.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/HelloService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/LeakingService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/Listener.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/resources/metadata-comparator.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/resources/metadata-filter.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestCollectionMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestDelayedMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestDelayedSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestDependencyArchitecture.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestListMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestMethodDelayedMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestMethodDelayedSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestMethodMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestMethodSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestModifyDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestNonProxiedNotInterfaceDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestSetMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestSimpleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/TestVectorMultipleDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/context/TestContextualFilters.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/context/TestContextualFiltersAndExternalSources.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/error/TestNPEInBindMethod.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/filter/TestFromDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/filter/TestMultipleFilterDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/filter/TestOptionalMultipleFilterDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/filter/TestOptionalSimpleFilterDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/filter/TestSimpleFilterDependencies.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/identification/TestDependencyIdDetection.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/inner/TestInnerProxyMix.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/dependencies/leak/ListenerStyleLeakTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/components/CollectionCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/components/FooProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/components/MultipleCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/components/NullableFooProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/DefaultImplementationTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/DelayTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/DelayedProvider.java delete mode 100755 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/EmptyTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/NullableTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-dependency-timeout-test/src/test/java/org/apache/felix/ipojo/runtime/test/dependencies/timeout/TimeoutTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/pom.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderWithAnonymousClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NullCheckServiceProvider.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/callbacks/CallbacksCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/controller/ControllerCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/controller/DoubleControllerCheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inheritance/a/IA.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inheritance/b/IB.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inheritance/c/C.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inheritance/d/D.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inherited/ProcessImplementation1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inherited/ProcessImplementation2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inherited/ProcessImplementation3.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inherited/ProcessImplementation4.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/inherited/ProcessParentImplementation.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/BarConsumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/Consumer.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/DummyCreationStrategy.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/DummyCreationStrategy2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/DummyServiceFactory.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/FooBarProviderType1.java delete mode 100755 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/strategies/FooProviderType1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/ChildInterface.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/ParentInterface1.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/ParentInterface2.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/ParentParentInterface.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/basics.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/callbacks/callbacks.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/concrete-abstract.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/controller/service-controller.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/inheritance/cons.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/inheritance/inheritance.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/inheritance/provider.xml delete mode 100755 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/main/resources/strategies/metadata-strategies.xml delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCallbacks.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicProps.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicPropsReconfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExposition.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInheritedClasses.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestListeners.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNullCheck.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestOSGiProperties.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertiesInAnonymousClass.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestProvidedServiceArchitecture.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestServiceController.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimplePS.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStaticProps.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStaticPropsReconfiguration.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/inheritence/InheritanceTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/strategies/CustomStrategy2Test.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/strategies/CustomStrategyTest.java delete mode 100644 ipojo/runtime/core-it/ipojo-core-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/strategies/PerInstanceStrategyTest.java delete mode 100644 ipojo/runtime/core-it/pom.xml delete mode 100644 ipojo/runtime/core-it/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/core/changelog.txt delete mode 100644 ipojo/runtime/core/obr.xml delete mode 100644 ipojo/runtime/core/pom.xml delete mode 100644 ipojo/runtime/core/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/core/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/runtime/core/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ComponentInstance.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationException.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConfigurationTracker.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ConstructorInjector.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ContextListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ContextSource.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ErrorHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/EventDispatcher.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/Factory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/FactoryClassloader.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/FactoryStateListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/FieldInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/Handler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManager.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/HandlerManagerFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPOJOServiceFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoContext.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/IPojoFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/InstanceManager.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/InstanceStateListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/MethodInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/MissingHandlerException.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/Nullable.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/Pojo.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/PolicyServiceContext.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/PrimitiveHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/PrimitiveInstanceDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/PrimitiveTypeDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/ServiceContext.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/UnacceptableConfiguration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/Architecture.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/ComponentTypeDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/CustomHandlerInfo.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/HandlerDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/InstanceDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/architecture/PropertyDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Configuration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/configuration/Instance.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/context/ServiceReferenceImpl.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/context/ServiceRegistrationImpl.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/context/ServiceRegistry.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/context/StringMap.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/ComparatorBasedServiceRankingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/DependencyProperties.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/EmptyBasedServiceRankingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/FilterBasedServiceTrackingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/ServiceReferenceManager.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/ServiceReferenceUtils.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/impl/TransformedServiceReferenceImpl.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/DefaultDependencyInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/DefaultServiceRankingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/DefaultServiceTrackingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/DependencyInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/ServiceBindingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/ServiceRankingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/ServiceTrackingInterceptor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/dependency/interceptors/TransformedServiceReference.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/ConfigurationBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/Declaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/DeclarationBuilderService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/DeclarationHandle.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/ExtensionDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/InstanceBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/InstanceDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/Status.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/TypeDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/builder/FactoryBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/builder/FactoryBuilderException.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/AbstractService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/BundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/DefaultJob.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/Extender.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/Lifecycle.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/LifecycleQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/builder/ReflectiveFactoryBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/AbstractDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultExtensionDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultInstanceDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultTypeDeclaration.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/service/DeclarationServiceFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultConfigurationBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultDeclarationBuilderService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultInstanceBuilder.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/linker/DeclarationLinker.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/linker/InstanceBundleContextAware.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/linker/ManagedType.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ChainedBundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ComponentsBundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationAnnotationScanner.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ConfigurationProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ExtensionBundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ForwardingBundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/QueuingActivationProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/processor/ReverseBundleProcessor.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/AbstractQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/ExecutorQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/GroupThreadFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/JobInfoCallable.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/NamingThreadFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/PrefixedThreadFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/QueueNotifier.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/Statistic.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/SynchronousQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxy.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/HeaderPreferenceSelection.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/Preference.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/PreferenceQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/PreferenceSelection.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/enforce/EnforcedQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/internal/queue/pref/enforce/ForwardingQueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/Callback.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/Job.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/JobInfo.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/QueueListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/QueueService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/extender/queue/debug/QueueEventProxy.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/architecture/ArchitectureHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationHandlerDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/configuration/ConfigurationListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/context/BundleContextHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/AggregateDependencyInjectionType.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/Dependency.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyCallback.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyConfigurationChecker.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/DependencyHandlerDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/NullableObject.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ProxyGenerator.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ServiceList.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ServiceSet.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/dependency/ServiceUsage.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallback.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/callback/LifecycleCallbackHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/lifecycle/controller/ControllerHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/CreationStrategy.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedService.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandler.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerDescription.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ConfigurableCreationStrategy.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ErrorPrintingServiceFactoryProxy.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/handlers/providedservice/strategy/ServiceObjectFactory.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/FieldMetadata.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/ManifestMetadataParser.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/MethodMetadata.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/ParseException.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/ParseUtils.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/parser/PojoMetadata.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Callback.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ContextSourceManager.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyMetadataHelper.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModel.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyModelListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/DependencyStateListener.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Fields.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/InstanceConfigurationSource.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/InvocationResult.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Log.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Logger.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Methods.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Property.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Reflection.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/SecurityHelper.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceLocator.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/ServiceReferenceRankingComparator.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/StreamUtils.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/SystemPropertiesSource.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/Tracker.java delete mode 100644 ipojo/runtime/core/src/main/java/org/apache/felix/ipojo/util/TrackerCustomizer.java delete mode 100644 ipojo/runtime/core/src/main/resources/core.xsd delete mode 100644 ipojo/runtime/core/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/IPojoFactoryTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/InstanceManagerTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/configuration/InstanceDSLTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/dependency/impl/DependencyPropertiesTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/dependency/interceptors/TransformedServiceReferenceTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultExtensionDeclarationTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultInstanceDeclarationTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/DefaultTypeDeclarationTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultConfigurationBuilderTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultDeclarationBuilderServiceTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/declaration/service/DefaultInstanceBuilderTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/linker/DeclarationLinkerTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/linker/ManagedTypeTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/processor/ChainedBundleProcessorTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/processor/ExtensionBundleProcessorTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/processor/ReverseBundleProcessorTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/AbstractQueueServiceTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/ExecutorQueueServiceTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/GroupThreadFactoryTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/JobInfoCallableTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/NamingThreadFactoryTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/PrefixedThreadFactoryTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/SynchronousQueueServiceTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/callable/EmptyJob.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/callable/ExceptionCallable.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/callable/SleepingCallable.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/callable/StringCallable.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/debug/ReplayQueueEventProxyTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/pref/HeaderPreferenceSelectionTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/extender/internal/queue/pref/enforce/EnforcedQueueServiceTestCase.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/DependencyIdentifierTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/NullableTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/SmartProxyTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/dependency/TestSpecification.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/providedservice/ComponentTestWithAnotherSuperClass.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/providedservice/ComponentTestWithSuperClass.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/handlers/providedservice/ProvidedServiceHandlerTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/parser/ManipulationMetadataTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/parser/MethodMetadataTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/parser/PojoMetadataTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/test/MockBundle.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/util/ContextSourceManagerTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/util/InstanceConfigurationSourceTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/util/ManifestMetadataParserTest.java delete mode 100644 ipojo/runtime/core/src/test/java/org/apache/felix/ipojo/util/SystemPropertiesSourceTest.java delete mode 100644 ipojo/runtime/core/src/test/resources/manipulation/MANIFEST.MF delete mode 100644 ipojo/runtime/distributions/maven-tutorial/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/assembly/distribution.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.client.annotations/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/HelloClient.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.client.annotations/src/main/java/ipojo/example/hello/client/MyDummyHello.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.felix.annotations/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.impl.annotations/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/annotations/hello.impl.annotations/src/main/java/ipojo/example/hello/impl/HelloImpl.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/hello.service/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/hello.service/src/main/java/ipojo/example/hello/Hello.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.client.xml/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.client.xml/src/main/java/ipojo/example/hello/client/HelloClient.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.client.xml/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.felix.xml/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.impl.xml/pom.xml delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.impl.xml/src/main/java/ipojo/example/hello/impl/HelloImpl.java delete mode 100644 ipojo/runtime/distributions/maven-tutorial/src/main/skeleton/xml/hello.impl.xml/src/main/resources/metadata.xml delete mode 100644 ipojo/runtime/distributions/quickstart/pom.xml delete mode 100644 ipojo/runtime/distributions/quickstart/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/distributions/quickstart/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/distributions/quickstart/src/main/assembly/distribution.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/pom.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker.gui/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker.gui/spell.checker.gui.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker.gui/src/spell/gui/SpellCheckerGui.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker/spell.checker.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.checker/src/spell/checker/SpellCheck.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.english/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.english/spell.english.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.english/src/spell/english/EnglishDictionary.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.services/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.services/spell.services.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.services/src/spell/services/DictionaryService.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/skeleton/spell.services/src/spell/services/SpellChecker.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker.gui/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker.gui/spell.checker.gui.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker.gui/src/spell/gui/SpellCheckerGui.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker/spell.checker.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.checker/src/spell/checker/SpellCheck.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.english/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.english/spell.english.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.english/src/spell/english/EnglishDictionary.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.services/build.xml delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.services/spell.services.bnd delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.services/src/spell/services/DictionaryService.java delete mode 100644 ipojo/runtime/distributions/ten-minutes-tutorial/src/main/solution/spell.services/src/spell/services/SpellChecker.java delete mode 100644 ipojo/runtime/ipojo-gogo-commands/changelog.txt delete mode 100644 ipojo/runtime/ipojo-gogo-commands/obr.xml delete mode 100644 ipojo/runtime/ipojo-gogo-commands/pom.xml delete mode 100644 ipojo/runtime/ipojo-gogo-commands/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/ipojo-gogo-commands/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/runtime/ipojo-gogo-commands/src/main/java/org/apache/felix/ipojo/arch/gogo/Arch.java delete mode 100644 ipojo/runtime/karaf-feature/changelog.txt delete mode 100644 ipojo/runtime/karaf-feature/pom.xml delete mode 100644 ipojo/runtime/karaf-feature/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/karaf-feature/src/main/assembly/assembly.xml delete mode 100644 ipojo/runtime/karaf-feature/src/main/features/features.xml delete mode 100644 ipojo/runtime/pom.xml delete mode 100644 ipojo/runtime/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/runtime/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/webconsole-plugin/changelog.txt delete mode 100644 ipojo/webconsole-plugin/obr.xml delete mode 100644 ipojo/webconsole-plugin/pom.xml delete mode 100644 ipojo/webconsole-plugin/src/main/appended-resources/META-INF/DEPENDENCIES delete mode 100644 ipojo/webconsole-plugin/src/main/appended-resources/META-INF/LICENSE delete mode 100644 ipojo/webconsole-plugin/src/main/appended-resources/META-INF/NOTICE delete mode 100644 ipojo/webconsole-plugin/src/main/java/org/apache/felix/ipojo/webconsole/IPOJOPlugin.java delete mode 100644 ipojo/webconsole-plugin/src/main/java/org/apache/felix/ipojo/webconsole/StateUtils.java delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/factories.html delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/factory.html delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/handlers.html delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/instance.html delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/instances.html delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/factory.js delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/factory_detail.js delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/handler.js delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/instance_detail.js delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/ipojo.css delete mode 100644 ipojo/webconsole-plugin/src/main/resources/res/ui/ipojo.js diff --git a/README.md b/README.md index bc69ae4388..084350bd57 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,6 @@ Several projects provide extra features to an OSGi runtime. - **gogo** `/gogo` - A command line shell, runtime and set of base commands for interacting with and introspecting an OSGi framework. - **health checks** `/healthcheck/*` - An extensible framework to monitor the status of the OSGi container at runtime. (contains **systemready**) - **inventory** `/inventory` - Provides some mechanisms to get the current state of the system and therefore provides an inventory of the system. -- **ipojo** `/ipojo` - A *service component runtime* aiming to simplify OSGi application development. - **jaas support** `/jaas` - Bundle to simplify JAAS usage within OSGi environment. - **logback** `/logback` - A simple integration of the OSGi R7 Log (1.4) service to Logback backend. - **OSGi metrics** `/metrics/osgi` - Collecting and publishing metrics related to OSGi applications diff --git a/ipojo/.gitignore b/ipojo/.gitignore deleted file mode 100644 index 68cde20656..0000000000 --- a/ipojo/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -.project -.settings -.classpath -target \ No newline at end of file diff --git a/ipojo/arch/changelog.txt b/ipojo/arch/changelog.txt deleted file mode 100644 index b180064a95..0000000000 --- a/ipojo/arch/changelog.txt +++ /dev/null @@ -1,26 +0,0 @@ -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - * [FELIX-996] - Arch -factory command always prints out one component factory - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-797] - Composite Architecture contains duplicate instances - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-673] - Provide OBR description to iPOJO bundles - - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/arch/obr.xml b/ipojo/arch/obr.xml deleted file mode 100644 index 8832ddf9ed..0000000000 --- a/ipojo/arch/obr.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - Import Service org.apache.felix.ipojo.architecture.Architecture - Import Service org.apache.felix.ipojo.Factory - Import Service org.apache.felix.ipojo.HandlerFactory - Requires Handler - \ No newline at end of file diff --git a/ipojo/arch/pom.xml b/ipojo/arch/pom.xml deleted file mode 100644 index 49eef09828..0000000000 --- a/ipojo/arch/pom.xml +++ /dev/null @@ -1,118 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../pom/pom.xml - - 4.0.0 - bundle - Apache Felix iPOJO Arch Command - org.apache.felix.ipojo.arch - 1.7.0-SNAPSHOT - - Arch command to collect and print information about iPOJO instances. - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html - - - - - org.apache.felix - org.apache.felix.ipojo - 1.9.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.shell - 1.0.2 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - Apache Felix iPOJO Arch Command - ${project.artifactId} - The Apache Software Foundation - iPOJO Arch command for Felix - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-arch-command.html - - org.apache.felix.ipojo.arch - - - - - org.apache.felix - maven-ipojo-plugin - 1.8.0 - - - - ipojo-bundle - - - true - - - - - - - - - - - ]]> - - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - diff --git a/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/arch/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/arch/src/main/appended-resources/META-INF/NOTICE b/ipojo/arch/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java b/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java deleted file mode 100644 index 4010b7d1bc..0000000000 --- a/ipojo/arch/src/main/java/org/apache/felix/ipojo/arch/ArchCommandImpl.java +++ /dev/null @@ -1,233 +0,0 @@ -/* - * 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.ipojo.arch; - -import java.io.PrintStream; -import java.lang.reflect.Field; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.IPojoFactory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.shell.Command; - -/** - * Implementation of the arch command printing the actual architecture. - * @author Felix Project Team - */ -public class ArchCommandImpl implements Command { - - /** List of arch services. */ - private Architecture[] m_archs; - - /** Factory services. */ - private Factory[] m_factories; - - /** Handler Factories. */ - private HandlerFactory[] m_handlers; - - /** - * Get the command name. - * @return the command name (arch) - * @see org.apache.felix.shell.Command#getName() - */ - public String getName() { - return "arch"; - } - - /** - * Gets help message. - * @return the command usage. - * @see org.apache.felix.shell.Command#getUsage() - */ - public String getUsage() { - return "arch [-factories] [-instances] [-handlers] [-factory factory_name] [-instance instance_name]"; - } - - /** - * Gets a small description. - * @return get a description. - * @see org.apache.felix.shell.Command#getShortDescription() - */ - public String getShortDescription() { - return "Architecture command : display the architecture"; - } - - /** - * Executes the arch command. - * @param line : command line - * @param out : the default output stream - * @param err : the error output stream - * @see org.apache.felix.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream) - */ - public void execute(String line, PrintStream out, PrintStream err) { - String line2 = line.substring("arch".length()).trim(); - - if (line2.equalsIgnoreCase("-instances") || line2.length() == 0) { - printInstances(out); - return; - } - - if (line2.equalsIgnoreCase("-factories")) { - printFactories(out); - return; - } - - if (line2.startsWith("-factory")) { - String name = line2.substring("-factory".length()).trim(); - printFactory(name, out, err); - return; - } - - if (line2.startsWith("-instance")) { - String name = line2.substring("-instance".length()).trim(); - printInstance(name, out, err); - return; - } - - if (line2.startsWith("-handlers")) { - printHandlers(out); - return; - } - - if (line2.startsWith("-stats")) { - printStats(out); - return; - } - - err.println(getUsage()); - } - - /** - * Prints the statistics. - * @param out the out - */ - private void printStats(PrintStream out) { - try { - Field field = IPojoFactory.class.getDeclaredField("INSTANCE_NAME"); - field.setAccessible(true); // The field is not accessible. - List names = (List) field.get(null); - out.println("Number of living instances : " + names.size()); - out.println("Created instances : " + names); - } catch (SecurityException e) { - out.println("Cannot compute stats : " + e.getMessage()); - } catch (IllegalArgumentException e) { - out.println("Cannot compute stats : " + e.getMessage()); - } catch (IllegalAccessException e) { - out.println("Cannot compute stats : " + e.getMessage()); - } catch (NoSuchFieldException e) { - out.println("Cannot compute stats : " + e.getMessage()); - } - - } - - /** - * Prints instance list. - * @param out : default print stream - */ - private void printInstances(PrintStream out) { - for (int i = 0; i < m_archs.length; i++) { - InstanceDescription instance = m_archs[i].getInstanceDescription(); - if (instance.getState() == ComponentInstance.VALID) { - out.println("Instance " + instance.getName() + " -> valid"); - } - if (instance.getState() == ComponentInstance.INVALID) { - out.println("Instance " + instance.getName() + " -> invalid"); - } - if (instance.getState() == ComponentInstance.STOPPED) { - out.println("Instance " + instance.getName() + " -> stopped"); - } - } - } - - /** - * Prints instance description. - * @param name : instance name - * @param out : default print stream - * @param err : error print stream (if the instance is not found) - */ - private void printInstance(String name, PrintStream out, PrintStream err) { - for (int i = 0; i < m_archs.length; i++) { - InstanceDescription instance = m_archs[i].getInstanceDescription(); - if (instance.getName().equalsIgnoreCase(name)) { - out.println(instance.getDescription()); - return; - } - } - err.println("Instance " + name + " not found"); - } - - /** - * Prints factories. - * @param out : output stream - */ - private void printFactories(PrintStream out) { - for (int i = 0; i < m_factories.length; i++) { - if (m_factories[i].getMissingHandlers().size() == 0) { - out.println("Factory " + m_factories[i].getName() + " (VALID)"); - } else { - out.println("Factory " + m_factories[i].getName() + " (INVALID : " + m_factories[i].getMissingHandlers() + ")"); - } - } - } - - /** - * Prints factory description. - * @param name : factory name - * @param out : default print stream - * @param err : error print stream (if the factory is not found) - */ - private void printFactory(String name, PrintStream out, PrintStream err) { - boolean found = false; - for (int i = 0; i < m_factories.length; i++) { - if (m_factories[i].getName().equalsIgnoreCase(name)) { - // Skip a line if already found - if (found) { - out.println(); - } - out.println(m_factories[i].getDescription()); - found = true; - } - } - if (! found) { - err.println("Factory " + name + " not found"); - } - } - - /** - * Prints the list of available handlers (and validity). - * @param out : default print stream - */ - private void printHandlers(PrintStream out) { - for (int i = 0; i < m_handlers.length; i++) { - String name = m_handlers[i].getHandlerName(); - if ("composite".equals(m_handlers[i].getType())) { - name = name + " [composite]"; - } - if (m_handlers[i].getMissingHandlers().size() == 0) { - out.println("Handler " + name + " (VALID)"); - } else { - out.println("Handler " + name + " (INVALID : " + m_handlers[i].getMissingHandlers() + ")"); - } - } - } -} diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml b/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml deleted file mode 100755 index cf0967d31e..0000000000 --- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/pom.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - bundle - - iPOJO Foo Service - - org.apache.felix.ipojo.log.foo - - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.apache.felix.ipojo.foo - - - org.apache.felix.ipojo.foo.impl - - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java deleted file mode 100755 index 1bd0b9ff17..0000000000 --- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/FooService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.foo; - -/** - * A service interface doing mostly nothing. - */ -public interface FooService { - - public void foo(); - -} diff --git a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java b/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java deleted file mode 100755 index 2817fe4d45..0000000000 --- a/ipojo/distributions/handler-tutorial/FooService-And-Impl/src/main/java/org/apache/felix/ipojo/foo/impl/FooServiceImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.foo.impl; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.foo.FooService; - - -@Component -@Provides -@Instantiate(name = "ipojo.foo.provider") -/** - * A very simple implementation of the FooService. - */ -public class FooServiceImpl implements FooService { - - public void foo() { - System.out.println("Foo"); - } - - -} diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml deleted file mode 100755 index bbe35d94f6..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - bundle - iPOJO Log Handler Consumer - org.apache.felix.ipojo.log.consumer - A bundle using the log handler - - - - ${project.groupId} - org.apache.felix.ipojo.log.foo - ${project.version} - provided - - - ${project.groupId} - org.apache.felix.ipojo.log.handler - ${project.version} - provided - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.apache.felix.ipojo.log.handler.example - - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java b/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java deleted file mode 100755 index e6c1e3e50a..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler-Consumer/src/main/java/org/apache/felix/ipojo/log/handler/example/SimpleComponent.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.apache.felix.ipojo.log.handler.example; - - -import org.apache.felix.ipojo.annotations.*; -import org.apache.felix.ipojo.foo.FooService; -import org.apache.felix.ipojo.log.handler.Log; - -@Component(immediate = true) -@Log(level = Log.Level.INFO) // We configure the handler. -@Instantiate(name = "my.simple.consumer") -public class SimpleComponent { - - @Requires - FooService fs; - - @Validate - public void starting() { - System.out.println("Starting..."); - fs.foo(); - } - - @Invalidate - public void stopping() { - System.out.println("Stopping..."); - } -} diff --git a/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml deleted file mode 100644 index c1a58f79cb..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler-In-Felix/pom.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - loghandler-tutorial-felix - Log-Handler-In-Felix - - pom - - - - org.apache.felix - org.apache.felix.log - 1.0.1 - - - - - ${project.groupId} - org.apache.felix.ipojo.log.foo - ${project.version} - - - ${project.groupId} - org.apache.felix.ipojo.log.handler - ${project.version} - - - ${project.groupId} - org.apache.felix.ipojo.log.consumer - ${project.version} - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.7 - - - - unpack-felix - package - - unpack-dependencies - - - org.apache.felix.main.distribution - ${project.build.directory} - - - - - copy-bundles - package - - copy-dependencies - - - - org.apache.felix.ipojo.log.foo, - org.apache.felix.ipojo.log.handler, - org.apache.felix.ipojo.log.consumer, - org.apache.felix.log,org.apache.felix.ipojo, - org.apache.felix.ipojo.arch.gogo - - ${project.build.directory}/felix-framework-${felix.version}/bundle - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml deleted file mode 100755 index fbf2e214f6..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler/pom.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - bundle - iPOJO Log Handler - org.apache.felix.ipojo.log.handler - A handler logging messages in an OSGi Log Service - - - - org.osgi - org.osgi.core - 4.2.0 - provided - - - org.osgi - org.osgi.compendium - 4.2.0 - provided - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.apache.felix.ipojo.log.handler - - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java deleted file mode 100644 index f9aa1db613..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/Log.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.ipojo.log.handler; - -/** - * The annotation used to configure the LogHandler. - */ -public @interface Log { - - public enum Level { - INFO, ERROR, WARNING - } - - /** - * @return the log level - */ - Level level(); -} diff --git a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java b/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java deleted file mode 100755 index 9b5609bde7..0000000000 --- a/ipojo/distributions/handler-tutorial/Log-Handler/src/main/java/org/apache/felix/ipojo/log/handler/LogHandler.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.ipojo.log.handler; - - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.annotations.Handler; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.service.log.LogService; - -import java.util.Dictionary; - -// Declare a handler. -@Handler(name = "Log", namespace = LogHandler.NAMESPACE) -public class LogHandler extends PrimitiveHandler { - - public static final String NAMESPACE = "org.apache.felix.ipojo.log.handler"; - - // Handlers are iPOJO components, so can use service dependencies - @Requires(optional = true, nullable = false) - LogService log; - private InstanceManager instanceManager; - private int logLevel; - - /** - * Parses the component's metadata to retrieve the log level in which we log messages. - * - * @param metadata component's metadata - * @param configuration instance configuration (unused in this example) - * @throws ConfigurationException the configuration is inconsistent - */ - @Override - public void configure(Element metadata, Dictionary configuration) throws ConfigurationException { - // First parse the metadata to check if the log handler logLevel - - // Get all Namespace:log element from the metadata - Element[] log_elements = metadata.getElements("log", NAMESPACE); - - // If an element match, parse the logLevel attribute of the first found element - if (log_elements[0].containsAttribute("level")) { - String l = log_elements[0].getAttribute("level"); - if (l.equalsIgnoreCase("info")) { - logLevel = LogService.LOG_INFO; - } else if (l.equalsIgnoreCase("error")) { - logLevel = LogService.LOG_ERROR; - } else if (l.equalsIgnoreCase("warning")) { - logLevel = LogService.LOG_WARNING; - } - } - - instanceManager = getInstanceManager(); - } - - /** - * The instance is starting. - */ - public void start() { - if (log != null) { - log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is starting"); - } - } - - /** - * The instance is stopping. - */ - public void stop() { - if (log != null) { - log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " is stopping"); - } - } - - /** - * Logging messages when the instance state is changing - * - * @param state the new state - */ - public void stateChanged(int state) { - if (log != null) { - if (state == InstanceManager.VALID) { - System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes valid"); - log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes valid"); - } - if (state == InstanceManager.INVALID) { - System.out.println("The component instance " + instanceManager.getInstanceName() + " becomes invalid"); - log.log(logLevel, "The component instance " + instanceManager.getInstanceName() + " becomes invalid"); - } - } - } -} diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml deleted file mode 100755 index e9094f8d01..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - bundle - iPOJO Property Handler Consumer - org.apache.felix.ipojo.properties.consumer - A bundle using the properties handler - - - - ${project.groupId} - org.apache.felix.ipojo.properties.handler - ${project.version} - - - - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.apache.felix.ipojo.handler.props.example - - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml deleted file mode 100755 index 29f7aa15e4..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/ipojo/metadata.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java b/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java deleted file mode 100755 index e75aa2df43..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-Consumer/src/main/java/org/apache/felix/ipojo/handler/properties/example/PropertiesTester.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.handler.properties.example; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Invalidate; -import org.apache.felix.ipojo.annotations.Validate; -import org.apache.felix.ipojo.handler.properties.Properties; - -import java.text.DateFormat; -import java.util.Date; - -@Component(immediate = true, name = "PropertiesTester") -@Properties(file = "props/my-properties.properties") -@Instantiate -public class PropertiesTester { - - // These two fields will be injected. - private String property1; - private String property2; - - /** - * Starting method. - * This method will be called when the instance starts. - */ - @Validate - public void start() { - System.out.println("PropertiesTester is starting ..."); - // Read the injected properties. - System.out.println("Property 1 : " + property1); - System.out.println("Property 2 : " + property2); - - // Update the properties. - updateProperties(); - } - - /** - * Stopping method. - * This method will be called when the instance stops. - */ - @Invalidate - public void stop() { - System.out.println("PropertiesTester is stopping ..."); - System.out.println("Property 1 : " + property1); - System.out.println("Property 2 : " + property2); - } - - /** - * This method just updates managed properties. - * It appends the current date to the actual property value. - */ - private void updateProperties() { - System.out.println("Update properties"); - Date date = new Date(); - DateFormat df = DateFormat.getDateTimeInstance(); - // The properties will be updated in the property file - property1 = property1 + " - " + df.format(date); - property2 = property2 + " - " + df.format(date); - } - -} diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml deleted file mode 100644 index a646b6bb58..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/pom.xml +++ /dev/null @@ -1,120 +0,0 @@ - - - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - Property-Handler-In-Felix - 1.9.0-SNAPSHOT - - pom - - - - - ${project.groupId} - org.apache.felix.ipojo.properties.handler - ${project.version} - - - ${project.groupId} - org.apache.felix.ipojo.properties.consumer - ${project.version} - - - - - - - org.apache.maven.plugins - maven-dependency-plugin - 2.7 - - - - unpack-felix - package - - unpack-dependencies - - - org.apache.felix.main.distribution - ${project.build.directory} - - - - - copy-bundles - package - - copy-dependencies - - - - org.apache.felix.ipojo.properties.handler, - org.apache.felix.ipojo.properties.consumer, - org.apache.felix.ipojo, - org.apache.felix.ipojo.arch.gogo - - ${project.build.directory}/felix-framework-${felix.version}/bundle - - - - - - - - - maven-resources-plugin - 2.6 - - - copy-resources - package - - copy-resources - - - - ${project.build.directory}/felix-framework-${felix.version}/props - - - - src/main/resources/props - - - - - - - - - \ No newline at end of file diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties deleted file mode 100644 index 8ebd943ecc..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/my-properties.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# 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. -# - -property1:"aaa" -property2:"bbb" \ No newline at end of file diff --git a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties b/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties deleted file mode 100644 index 195278e50b..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler-In-Felix/src/main/resources/props/properties-i1.properties +++ /dev/null @@ -1,21 +0,0 @@ -# -# 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. -# - -property1:"ccc" -property2:"ddd" \ No newline at end of file diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml b/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml deleted file mode 100755 index 4261fcbb86..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler/pom.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - 4.0.0 - - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - - bundle - iPOJO Properties Handler - org.apache.felix.ipojo.properties.handler - A handler loading a property file - - - - - org.apache.felix - maven-bundle-plugin - true - - - - org.apache.felix.ipojo.handler.properties - - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - - diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java deleted file mode 100755 index 8a0f49b091..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/Properties.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.handler.properties; - -/** - * The Properties annotation. - * This annotation may be used in POJO class to used the Property handler. - * @author Felix Project Team - */ -public @interface Properties { - - /** - * Returns the property file used by the handler. - */ - String file(); - -} diff --git a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java b/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java deleted file mode 100755 index 08efa3cdb4..0000000000 --- a/ipojo/distributions/handler-tutorial/Property-Handler/src/main/java/org/apache/felix/ipojo/handler/properties/PropertiesHandler.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.ipojo.handler.properties; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.annotations.Handler; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.FieldMetadata; -import org.apache.felix.ipojo.parser.PojoMetadata; - -/** - * This handler load a properties file containing property value. - * The handler injects this values inside fields. When stopped the handler stores updated value inside the file. The - * properties file contains
field-name : field-value
(field-value are strings) - * - * Instances can override file locations by setting the {@literal properties.file} property. - * - * @author Felix Project Team - */ -@Handler(name="properties", namespace = PropertiesHandler.NAMESPACE) -public class PropertiesHandler extends PrimitiveHandler { - - /** - * The Handler namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.handler.properties"; - - /** - * The loaded properties. - */ - private Properties m_properties = new Properties(); - - /** - * The properties file location, configured in the component's metadata. - */ - private String m_file; - - /** - * This method is the first to be invoked. - * This method aims to configure the handler. It receives the component type metadata and the instance - * configuration. The method parses given metadata and registers fields to inject. - * - * Step 3 : when the instance configuration contains the properties.file property, it overrides the properties file location. - * - * @param metadata : component type metadata - * @param configuration : instance description - * @throws ConfigurationException : the configuration of the handler has failed. - */ - @SuppressWarnings("unchecked") - public void configure(Element metadata, Dictionary configuration) throws ConfigurationException { - // Parse metadata to get - - // Get all elements to configure the handler - Element[] elem = metadata.getElements("properties", NAMESPACE); - - switch (elem.length) { - case 0: - // No matching element in metadata, throw a configuration error. - // It actually happen only if you force the handler to be plugged. - throw new ConfigurationException("No properties found"); - case 1: - // One 'properties' found, get attributes. - m_file = elem[0].getAttribute("file"); - if (m_file == null) { - // if file is null, throw a configuration error. - throw new ConfigurationException("Malformed properties element : file attribute must be set"); - } - break; - default: - // To simplify we handle only one properties element. - throw new ConfigurationException("Only one properties element is supported"); - } - - // Look if the instance overrides file location : - String instanceFile = (String) configuration.get("properties.file"); - if (instanceFile != null) { - m_file = instanceFile; - } - - // Load properties - try { - loadProperties(); - } catch (IOException e) { - throw new ConfigurationException("Error when reading the " + m_file + " file : " + e.getMessage()); - } - - // Register fields - // By convention, properties file entry are field name, so look for each property to get field list. - - //First get Pojo Metadata metadata : - PojoMetadata pojoMeta = getPojoMetadata(); - Enumeration e = m_properties.keys(); - while (e.hasMoreElements()) { - String field = (String) e.nextElement(); - FieldMetadata fm = pojoMeta.getField(field); - - if (fm == null) { // The field does not exist - throw new ConfigurationException("The field " + field + " is declared in the properties file but does not exist in the pojo"); - } - - // Then check that the field is a String field - if (!fm.getFieldType().equals(String.class.getName())) { - throw new ConfigurationException("The field " + field + " exists in the pojo, but is not a String"); - } - - // All checks are ok, register the interceptor. - getInstanceManager().register(fm, this); - } - - // Finally register the field to listen - } - - /** - * This method is called when the instance start (after the configure method). We just print stored properties. - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - // The properties are already loaded (in the configure method), just print values. - m_properties.list(System.out); - } - - /** - * This method is called when the instance stops. We save the properties to not lost the instance state and clear the stored properties. - * @see org.apache.felix.ipojo.Handler#stop() - */ - public void stop() { - try { - saveProperties(); - } catch (IOException e) { - error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger - } - m_properties = null; - } - - /** - * This method is called at each time the pojo 'get' a listened field. The method return the stored value. - * @param pojo : pojo object getting the field - * @param field : field name. - * @param o : previous value. - * @return the stored value. - */ - public Object onGet(Object pojo, String field, Object o) { - // When the pojo requires a value for a managed field, this method is invoked. - // So, we have just to return the stored value. - return m_properties.get(field); - } - - /** - * This method is called at each time the pojo 'set' a listened field. This method updates the local properties. - * @param pojo : pojo object setting the field - * @param field : field name - * @param newvalue : new value - */ - public void onSet(Object pojo, String field, Object newvalue) { - // When the pojo set a value to a managed field, this method is invoked. - // So, we update the stored value. - m_properties.put(field, newvalue); - } - - /** - * Step 2 : state properties when the instance becomes invalid. - * @param newState : the instance state - * @see org.apache.felix.ipojo.Handler#stateChanged(int) - */ - public void stateChanged(int newState) { - // This method is invoked each times that the instance state changed. - - // If the new state is invalid, save the properties. - if (newState == ComponentInstance.INVALID) { - // Reload properties - try { - saveProperties(); - } catch (IOException e) { - error("Cannot read the file : " + m_file, e); // Log an error message by using the iPOJO logger - } - } - } - - /** - * Step 5 : dynamic reconfiguration. This method is call when the instance is reconfigured externally. The given property contains property value. - * @param dict : new properties - * @see org.apache.felix.ipojo.Handler#reconfigure(java.util.Dictionary) - */ - @SuppressWarnings("unchecked") - public synchronized void reconfigure(Dictionary dict) { - // For each property, look if a new value is contained in the new configuration. - Enumeration e = m_properties.keys(); - while (e.hasMoreElements()) { - String field = (String) e.nextElement(); - String value = (String) dict.get(field); - // If the dictionary contains a value, update the stored value. - if (value != null) { - m_properties.put(field, value); - } - } - } - - /** - * Returns handler description. - * @return the handler description. - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public HandlerDescription getDescription() { - return new Description(this); - } - - /** - * Helper method just loading the properties. - * @throws IOException : the file cannot be read. - */ - private void loadProperties() throws IOException { - // Load the properties file from file system - File file = new File(m_file); - InputStream is = new FileInputStream(file); - m_properties.load(is); - } - - /** - * Helper method writing properties. - * @throws IOException : the file cannot be written. - */ - private void saveProperties() throws IOException { - // Store the file, modified the last modification date. - File file = new File(m_file); - OutputStream os = new FileOutputStream(file); - m_properties.store(os, ""); - } - - /** - * Step 3 : The handler will participate to the instance architecture. - * This class describing the handler. - */ - private class Description extends HandlerDescription { - - /** - * Instantiates a new description. - * @param h the h - */ - public Description(PrimitiveHandler h) { - super(h); - } - - /** - * This method must return the Element describing the handler. The description of this handler contains the list of properties with attached - * value. - * @return the description of the handler. - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - @SuppressWarnings("unchecked") - public Element getHandlerInfo() { - Element elem = super.getHandlerInfo(); // This method must be called to get the root description element. - Enumeration e = m_properties.keys(); - while (e.hasMoreElements()) { - String field = (String) e.nextElement(); - Element prop = new Element("property", ""); // Create an element for the actual property. - // Add two attribute (the field and the value). - prop.addAttribute(new Attribute("field", field)); - prop.addAttribute(new Attribute("value", (String) m_properties.get(field))); - elem.addElement(prop); // Attach the current element to the root element. - } - return elem; - } - - } -} diff --git a/ipojo/distributions/handler-tutorial/pom.xml b/ipojo/distributions/handler-tutorial/pom.xml deleted file mode 100644 index 6454332f8e..0000000000 --- a/ipojo/distributions/handler-tutorial/pom.xml +++ /dev/null @@ -1,139 +0,0 @@ - - - - - 4.0.0 - - org.apache.felix - ipojo-handler-tutorial - 1.10.2-SNAPSHOT - - pom - - - Build the handlers form the tutorial and distributions to test them - - - - - org.apache.felix - org.apache.felix.main.distribution - zip - - - org.apache.felix - org.apache.felix.ipojo - - - org.apache.felix - org.apache.felix.ipojo.gogo - - - org.apache.felix - org.apache.felix.ipojo.annotations - - - - - - FooService-And-Impl - Log-Handler - Log-Handler-Consumer - Log-Handler-In-Felix - - - Property-Handler - Property-Handler-Consumer - Property-Handler-In-Felix - - - - 4.2.1 - - - - - - org.apache.felix - org.apache.felix.ipojo - 1.10.1 - - - org.apache.felix - org.apache.felix.ipojo.gogo - 1.10.1 - - - org.apache.felix - org.apache.felix.main.distribution - 4.2.1 - zip - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.10.1 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - - - org.apache.felix - maven-ipojo-plugin - 1.8.6 - - - maven-assembly-plugin - 2.4 - - - - - - - maven-assembly-plugin - - - project - - true - - - - - single - - package - - - - - - \ No newline at end of file diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml b/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml deleted file mode 100644 index b578c5b7bc..0000000000 --- a/ipojo/distributions/ipojo-webconsole-quicktart/pom.xml +++ /dev/null @@ -1,148 +0,0 @@ - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.distributions - 1.10.2-SNAPSHOT - - - ipojo-webconsole-quicktart - - pom - - - Build a distribution of Felix including iPOJO, and a working web console - - - - - org.apache.felix - org.apache.felix.main.distribution - zip - - - org.apache.felix - org.apache.felix.ipojo - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - - - org.apache.felix - org.apache.felix.ipojo.gogo - - - org.apache.felix - org.apache.felix.gogo.runtime - - - - - org.apache.felix - org.apache.felix.ipojo.webconsole - 1.7.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.webconsole - 4.9.10 - - - org.apache.felix - org.apache.felix.webconsole.plugins.packageadmin - 1.0.0 - - - org.apache.felix - org.apache.felix.webconsole.plugins.memoryusage - 1.0.2 - - - org.apache.felix - org.apache.felix.http.jetty - 2.2.0 - - - javax.servlet - com.springsource.javax.servlet - 2.4.0 - - - org.osgi - org.osgi.compendium - 4.2.0 - - - commons-io - commons-io - 2.14.0 - - - commons-fileupload - commons-fileupload - 1.6.0 - - - - - - - ow2.releases - http://repository.ow2.org/nexus/content/groups/public/ - - - - com.springsource.repository.libraries.external - SpringSource Enterprise Bundle Repository - External Library Releases - http://repository.springsource.com/maven/bundles/external - - - - - - - maven-assembly-plugin - - - src/main/assembly/distribution.xml - - true - - - - - single - - package - - - - - - diff --git a/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml b/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml deleted file mode 100644 index 20e8bf1a83..0000000000 --- a/ipojo/distributions/ipojo-webconsole-quicktart/src/main/assembly/distribution.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - - distribution - - - zip - tar.gz - - - - - - - *:org.apache.felix.main.distribution:* - - true - . - - - **/doc/** - - - - - - - *:org.apache.felix.*:jar - javax.servlet:com.springsource.javax.servlet:* - org.osgi:org.osgi.compendium:* - org.json:org.ow2.chameleon.commons.json:* - commons-io:commons-io:* - commons-fileupload:*:* - - false - ./felix-framework-${felix.version}/bundle - - - - \ No newline at end of file diff --git a/ipojo/distributions/pom.xml b/ipojo/distributions/pom.xml deleted file mode 100644 index d331399346..0000000000 --- a/ipojo/distributions/pom.xml +++ /dev/null @@ -1,92 +0,0 @@ - - - - - 4.0.0 - - org.apache.felix - org.apache.felix.ipojo.distributions - 1.10.2-SNAPSHOT - - pom - - - This project build distributions for the web site, it does not intend to be released, just built. - - - - ipojo-webconsole-quicktart - handler-tutorial - - - - 4.2.1 - - - - - - org.apache.felix - org.apache.felix.ipojo - 1.10.1 - - - org.apache.felix - org.apache.felix.ipojo.gogo - 1.10.1 - - - org.apache.felix - org.apache.felix.main.distribution - 4.2.1 - zip - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.10.1 - - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - - - org.apache.felix - maven-ipojo-plugin - 1.10.0 - - - maven-assembly-plugin - 2.4 - - - - - - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/changelog.txt b/ipojo/handler/eventadmin/changelog.txt deleted file mode 100644 index dec38256c1..0000000000 --- a/ipojo/handler/eventadmin/changelog.txt +++ /dev/null @@ -1,32 +0,0 @@ -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler - -** Improvement - * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions - * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision - * [FELIX-2711] - The event admin handler should provides a Handler Description - -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Bug - * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - - Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-794] - Event Admin handler reject correctly formed topics - -** Improvement - * [FELIX-795] - Improve metadata and manipulator performance - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -Version 1.0.0 -------------- - * Initial release diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml deleted file mode 100644 index 7fb30add40..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/pom.xml +++ /dev/null @@ -1,378 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../../pom/pom.xml - - - 4.0.0 - pom - Apache Felix iPOJO Event Admin Handler - Integration Test - org.apache.felix.ipojo.handler.eventadmin-it - 1.9.0-SNAPSHOT - - - 3.0.0 - 1.5.1 - - - - - - org.apache.felix - org.apache.felix.ipojo.handler.eventadmin - ${project.version} - - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo - 1.10.2-SNAPSHOT - test - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.2-SNAPSHOT - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - junit - junit - 4.13.1 - test - - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - - - - - - - test - - true - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - regular - - run - - - - felix - - ${project.build.directory}/regular - - - - - - - - - - test-all - - false - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - equinox-native - - run - - - - equinox - - ${project.build.directory}/equinox-native - - - - - felix-native - - run - - - - felix - - ${project.build.directory}/felix-native - - - - - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - 5.2.0 - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - 3.8.1.v20120830-144521 - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - - diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml deleted file mode 100644 index c5ef57b80a..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.handler.eventadmin-it - 1.9.0-SNAPSHOT - ../../../pom.xml - - - - ipojo-event-admin-integration-test - ${project.artifactId} - - - - org.osgi - org.osgi.compendium - 4.2.0 - - - - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java deleted file mode 100644 index d6ea1efff0..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/AsyncEventProviderImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Random; - -/** - * Implementation of an event vendor that directly uses the Event Admin service - * to post (asynchronously) raw events. - * - * @author Felix Project Team - */ -public class AsyncEventProviderImpl implements DonutProvider { - - /** - * The donut current serial number. - */ - private long m_serial = 0L; - /** - * The name of the donut vendor. - */ - private String m_name; - /** - * A random generator. - */ - private Random m_random; - /** - * The Event Admin service reference. - */ - private EventAdmin m_ea; - - /** - * Construct a new donut provider. The initial serial number is randomly - * generated. - */ - public AsyncEventProviderImpl() { - m_random = new Random(System.currentTimeMillis()); - } - - /** - * Sell a donut with a random flavour. - * - * @return the sold donut - */ - public Donut sellDonut() { - Dictionary rawEvent = new Hashtable(); - Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random - .nextInt(Donut.FLAVOURS.length)]); - rawEvent.put("food", donut); - m_ea.postEvent(new Event("food/donuts", rawEvent)); - return donut; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java deleted file mode 100644 index 5c0e4f3f84..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/Donut.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -/** - * Donut representation. - * - * @author Felix Project Team - */ -public class Donut { - - /** - * All possible donut flavours. - */ - public static final String[] FLAVOURS = { "unflavoured", "icing sugar", - "chocolate", "toffee", "strawberry", "apple" }; - - /** - * The vendor's unique donut identifier. - */ - private final long m_id; - - /** - * The name of this donut's vendor. - */ - private final String m_vendorName; - - /** - * The m_flavour of this donut. - */ - private final String m_flavour; - - /** - * Create a new donut. - * - * @param id - * the vendor's unique donut identifier - * @param vendorName - * the name of this donut's vendor - * @param flavour - * the m_flavour of this donut - */ - public Donut(long id, String vendorName, String flavour) { - this.m_id = id; - this.m_vendorName = vendorName; - this.m_flavour = flavour; - } - - /** - * Get the vendor's unique identifier of this donut. - * - * @return the id - */ - public long getId() { - return m_id; - } - - /** - * Get the vendor name of this donut. - * - * @return the name - */ - public String getVendorName() { - return m_vendorName; - } - - /** - * Get the flavour of this donut. - * - * @return the flavour - */ - public String getFlavour() { - return m_flavour; - } - - /** - * Return the string representation of this donut. - * - * @return this donut as a String - */ - public String toString() { - return m_id + " " + m_flavour + " (" + m_vendorName + ")"; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java deleted file mode 100644 index c13d87bea5..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumer.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; - -/** - * Specification of a donut consumer. - * - * @author Felix Project Team - */ -public interface DonutConsumer { - - /** - * Donut receiver callback. This method is called when a donut is received - * on the listened topic. - * - * @param donut - * the received donut - */ - void receiveDonut(Donut donut); - - /** - * Event donut receiver callback. This method is called when an event is - * received on the listened topic. - * - * @param event - * the received event - */ - void receiveEvent(Event event); - - /** - * Clear the eaten donuts list. (Useful before tests) - */ - void clearDonuts(); - - /** - * Get the first received donut and remove it from the eaten donut list. - * - * @return the first received donut or null if no donut is available - */ - Donut getDonut(); - - /** - * Get the whole list of eaten donuts. - * - * @return the array containing all eaten donuts - */ - Donut[] getAllDonuts(); - - /** - * Get the first donut if available or wait for an incoming donut. The - * returned donut is removed from the eaten donut list. - * - * @return the first available donut. - */ - Donut waitForDonut(); - - /** - * Return the size of the eaten donut list. - * - * @return the size of the eaten donut list - */ - int getNumberOfDonuts(); -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java deleted file mode 100644 index 956b6db1cc..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutConsumerImpl.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; - -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of a donut consumer. - * - * @author Felix Project Team - * @see Homer Simpson - */ -public class DonutConsumerImpl implements DonutConsumer { - - - /** - * The time that is normally necessary to cause a blacklist from the event - * admin service. - */ - public static final long BLACK_LIST_TIME = 5000L; - /** - * The name of the donut consumer. - */ - private String m_name; - /** - * The list of eaten donuts. - */ - private List m_donuts = new ArrayList(); - /** - * Is this consumer a slow eater ? - */ - private boolean m_isSlow; - - /** - * Utility method that causes the current thread to sleep. - * - * @param millis the number of milliseconds to wait - */ - public static void sleep(long millis) { - long past = System.currentTimeMillis(); - long future = past + millis; - long now = past; - while (now < future) { - try { - Thread.sleep(future - now); - } catch (Exception e) { - } - now = System.currentTimeMillis(); - } - } - - /** - * Process incoming donuts. This method is called by the receiveDonut - * callback. - * - * @param donut the received donut - */ - private void doReceiveDonut(Donut donut) { - synchronized (m_donuts) { - m_donuts.add(donut); - m_donuts.notify(); - } - } - - /** - * Donut receiver callback. This method is called when a donut is received - * on the listened topic. - * - * @param donut the received donut - */ - public void receiveDonut(Donut donut) { - final Donut myDonut = donut; - if (m_isSlow) { - new Thread(new Runnable() { - public void run() { - sleep(BLACK_LIST_TIME); - doReceiveDonut(myDonut); - } - }, m_name + " eating " + donut).start(); - } else { - doReceiveDonut(donut); - } - } - - /** - * Event donut receiver callback. This method is called when an event is - * received on the listened topic. - * - * @param event the received event - */ - public void receiveEvent(Event event) { - Object thing = event.getProperty("food"); - if (Donut.class.isInstance(thing)) { - receiveDonut((Donut) thing); - } else { - // Nothing. - } - } - - /** - * Clear the eaten donuts list. (Useful before tests) - */ - public void clearDonuts() { - synchronized (m_donuts) { - m_donuts.clear(); - } - } - - /** - * Get the first received donut and remove it from the eaten donut list. - * - * @return the first received donut or null if no donut is available - */ - public Donut getDonut() { - Donut donut = null; - synchronized (m_donuts) { - if (!m_donuts.isEmpty()) { - donut = (Donut) m_donuts.remove(0); - } - } - return donut; - } - - /** - * Get the whole list of eaten donuts. - * - * @return the array containing all eaten donuts - */ - public Donut[] getAllDonuts() { - Donut[] donuts = new Donut[0]; - synchronized (m_donuts) { - donuts = (Donut[]) m_donuts.toArray(donuts); - m_donuts.clear(); - } - return donuts; - } - - /** - * Get the first donut if available or wait for an incoming donut. The - * returned donut is removed from the eaten donut list. - * - * @return the first available donut. - */ - public Donut waitForDonut() { - Donut donut = null; - synchronized (m_donuts) { - while (donut == null) { - if (m_donuts.isEmpty()) { - try { - m_donuts.wait(); - } catch (InterruptedException e) { - // Thanks Checkstyle to forbid empty catch statements - // ;-( - } - } else { - donut = (Donut) m_donuts.remove(0); - } - } - } - return donut; - } - - /** - * Return the size of the eaten donut list. - * - * @return the size of the eaten donut list - */ - public int getNumberOfDonuts() { - int length; - synchronized (m_donuts) { - length = m_donuts.size(); - } - return length; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java deleted file mode 100644 index 612b72adfa..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutEventProviderImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.apache.felix.ipojo.handlers.event.publisher.Publisher; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Random; - -/** - * Implementation of a donut vendor that send raw events instead of sending - * Donut objects. - * - * @author Felix Project Team - */ -public class DonutEventProviderImpl implements DonutProvider { - - /** - * The donut current serial number. - */ - private long m_serial = 0L; - /** - * The name of the donut vendor. - */ - private String m_name; - /** - * A random generator. - */ - private Random m_random; - /** - * The event publisher of the donut vendor. - */ - private Publisher m_publisher; - - /** - * Construct a new donut provider. The initial serial number is randomly - * generated. - */ - public DonutEventProviderImpl() { - m_random = new Random(System.currentTimeMillis()); - } - - /** - * Sell a donut with a random flavour. - * - * @return the sold donut - */ - public Donut sellDonut() { - Dictionary rawEvent = new Hashtable(); - String flavour = Donut.FLAVOURS[m_random.nextInt(Donut.FLAVOURS.length)]; - Donut donut = new Donut(m_serial++, m_name, flavour); - rawEvent.put("food", donut); - rawEvent.put("flavour", flavour); - m_publisher.send(rawEvent); - return donut; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java deleted file mode 100644 index a098ee7004..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProvider.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -/** - * Specification of a donut vendor. - * - * @author Felix Project Team - * - */ -public interface DonutProvider { - - /** - * Sell a donut with a random flavour. - * - * @return the sold donut - */ - Donut sellDonut(); -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java deleted file mode 100644 index 2f708bac04..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/DonutProviderImpl.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.apache.felix.ipojo.handlers.event.publisher.Publisher; - -import java.util.Random; - -/** - * The standard implementation of a donut vendor. - * - * @author Felix Project Team - * - */ -public class DonutProviderImpl implements DonutProvider { - - - - /** - * The donut current serial number. - */ - private long m_serial = 0L; - - /** - * The name of the donut vendor. - */ - private String m_name; - - /** - * A random generator. - */ - private Random m_random; - - /** - * The donut publisher of the vendor. - */ - private Publisher m_publisher; - - /** - * Construct a new donut provider. The initial serial number is randomly - * generated. - */ - public DonutProviderImpl() { - m_random = new Random(System.currentTimeMillis()); - } - - /** - * Sell a donut with a random flavour. - * - * @return the sold donut - */ - public Donut sellDonut() { - Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random - .nextInt(Donut.FLAVOURS.length)]); - m_publisher.sendData(donut); - System.err.println("[" + this.getClass().getSimpleName() + ":" - + m_name + "] Selling donut " + donut); - return donut; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java deleted file mode 100644 index 4b6ba7f281..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventConsumerImpl.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of a donut consumer. - * - * @author Felix Project Team - * @see Homer Simpson - */ -public class EventConsumerImpl implements DonutConsumer, EventHandler { - - /** - * The name of the donut consumer. - */ - private String m_name; - /** - * The list of eaten donuts. - */ - private List m_donuts = new ArrayList(); - /** - * Is this consumer a slow eater ? - */ - private boolean m_isSlow; - - /** - * Utility method that causes the current thread to sleep. - * - * @param millis the number of milliseconds to wait - */ - public static void sleep(long millis) { - long past = System.currentTimeMillis(); - long future = past + millis; - long now = past; - while (now < future) { - try { - Thread.sleep(future - now); - } catch (Exception e) { - } - now = System.currentTimeMillis(); - } - } - - /** - * Process incoming donuts. This method is called by the receiveDonut - * callback. - * - * @param donut the received donut - */ - private void doReceiveDonut(Donut donut) { - synchronized (m_donuts) { - m_donuts.add(donut); - m_donuts.notify(); - } - } - - /** - * Donut receiver callback. This method is called when a donut is received - * on the listened topic. - * - * @param donut the received donut - */ - public void receiveDonut(Donut donut) { - final Donut myDonut = donut; - if (m_isSlow) { - new Thread(new Runnable() { - public void run() { - sleep(DonutConsumerImpl.BLACK_LIST_TIME); - doReceiveDonut(myDonut); - } - }, m_name + " eating " + donut).start(); - } else { - doReceiveDonut(donut); - } - } - - /** - * Event donut receiver callback. This method is called when an event is - * received on the listened topic. - * - * @param event the received event - */ - public void receiveEvent(Event event) { - Object thing = event.getProperty("food"); - if (Donut.class.isInstance(thing)) { - receiveDonut((Donut) thing); - } else { - // Nothing to do. - } - } - - /** - * Event receiver callback. This method is called by the event admin service - * when a event is received. - * - * @param event the received event - */ - public void handleEvent(Event event) { - receiveEvent(event); - } - - /** - * Clear the eaten donuts list. (Useful before tests) - */ - public void clearDonuts() { - synchronized (m_donuts) { - m_donuts.clear(); - } - } - - /** - * Get the first received donut and remove it from the eaten donut list. - * - * @return the first received donut or null if no donut is available - */ - public Donut getDonut() { - Donut donut = null; - synchronized (m_donuts) { - if (!m_donuts.isEmpty()) { - donut = (Donut) m_donuts.remove(0); - } - } - return donut; - } - - /** - * Get the whole list of eaten donuts. - * - * @return the array containing all eaten donuts - */ - public Donut[] getAllDonuts() { - Donut[] donuts = new Donut[0]; - synchronized (m_donuts) { - donuts = (Donut[]) m_donuts.toArray(donuts); - m_donuts.clear(); - } - return donuts; - } - - /** - * Get the first donut if available or wait for an incoming donut. The - * returned donut is removed from the eaten donut list. - * - * @return the first available donut. - */ - public Donut waitForDonut() { - Donut donut = null; - synchronized (m_donuts) { - while (donut == null) { - if (m_donuts.isEmpty()) { - try { - m_donuts.wait(); - } catch (InterruptedException e) { - // Thanks Checkstyle to forbid empty catch statements - // ;-( - } - } else { - donut = (Donut) m_donuts.remove(0); - } - } - } - return donut; - } - - /** - * Return the size of the eaten donut list. - * - * @return the size of the eaten donut list - */ - public int getNumberOfDonuts() { - int length; - synchronized (m_donuts) { - length = m_donuts.size(); - } - return length; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java deleted file mode 100644 index b61b530183..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTracker.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; - -/** - * Specification of an event tracker. - * - * @author Felix Project Team - */ -public interface EventTracker { - - /** - * Clear the received events list. (Useful before tests) - */ - void clearEvents(); - - /** - * Get the first received event and remove it from the events list. - * - * @return the first received event or null if no event is available - */ - Event getEvent(); - - /** - * Get the whole list of received events. - * - * @return the array containing all received events - */ - Event[] getAllEvents(); - - /** - * Get the first event if available or wait for an incoming event. The - * returned event is removed from the eaten event list. - * - * @return the first available event. - */ - Event waitForEvent(); - - /** - * Return the size of the events list. - * - * @return the size of the events list - */ - int getNumberOfEvents(); -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java deleted file mode 100644 index 64f08b48ed..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/EventTrackerImpl.java +++ /dev/null @@ -1,152 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - -import java.util.ArrayList; -import java.util.List; - -/** - * Implementation of an event tracker. - * - * @author Felix Project Team - */ -public class EventTrackerImpl implements EventTracker, EventHandler { - - /** - * The name of the event tracker. - */ - private String m_name; - /** - * The list of received events - */ - private List m_events = new ArrayList(); - - /** - * Return the string representation of a given event. - * - * @return the string representation of a given event - */ - public static String eventToString(Event e) { - StringBuilder buf = new StringBuilder(); - buf.append("[" + e.getTopic() + "] {"); - - String[] properties = e.getPropertyNames(); - int n = properties.length - 1; - for (int i = 0; i <= n; i++) { - String name = properties[i]; - buf.append(name + "=" + e.getProperty(name)); - if (i != n) - buf.append(", "); - } - buf.append("}"); - return buf.toString(); - } - - /** - * Event receiver callback. This method is called by the event admin service - * when a event is received. - * - * @param event the received event - */ - public void handleEvent(Event event) { - synchronized (m_events) { - m_events.add(event); - m_events.notify(); - } - } - - /** - * Clear the received events list. (Useful before tests) - */ - public void clearEvents() { - synchronized (m_events) { - m_events.clear(); - } - } - - /** - * Get the first received event and remove it from the events list. - * - * @return the first received event or null if no event is available - */ - public Event getEvent() { - Event event = null; - synchronized (m_events) { - if (!m_events.isEmpty()) { - event = (Event) m_events.remove(0); - } - } - return event; - } - - /** - * Get the whole list of received events. - * - * @return the array containing all received events - */ - public Event[] getAllEvents() { - Event[] events = new Event[0]; - synchronized (m_events) { - events = (Event[]) m_events.toArray(events); - m_events.clear(); - } - return events; - } - - /** - * Get the first event if available or wait for an incoming event. The - * returned event is removed from the eaten event list. - * - * @return the first available event. - */ - public Event waitForEvent() { - Event event = null; - synchronized (m_events) { - while (event == null) { - if (m_events.isEmpty()) { - try { - m_events.wait(); - } catch (InterruptedException e) { - // Thanks Checkstyle to forbid empty catch statements - // ;-( - } - } else { - event = (Event) m_events.remove(0); - } - } - } - return event; - } - - /** - * Return the size of the events list. - * - * @return the size of the events list - */ - public int getNumberOfEvents() { - int length; - synchronized (m_events) { - length = m_events.size(); - } - return length; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java deleted file mode 100644 index bf519aef94..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/java/org/apache/felix/ipojo/handler/eventadmin/test/donut/SyncEventProviderImpl.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test.donut; - -import org.osgi.service.event.Event; -import org.osgi.service.event.EventAdmin; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Random; - -/** - * Implementation of an event vendor that directly uses the Event Admin service - * to send (synchronously) raw events. - * - * @author Felix Project Team - */ -public class SyncEventProviderImpl implements DonutProvider { - - /** - * The donut current serial number. - */ - private long m_serial = 0L; - /** - * The name of the donut vendor. - */ - private String m_name; - /** - * A random generator. - */ - private Random m_random; - /** - * The Event Admin service reference. - */ - private EventAdmin m_ea; - - /** - * Construct a new donut provider. The initial serial number is randomly - * generated. - */ - public SyncEventProviderImpl() { - m_random = new Random(System.currentTimeMillis()); - } - - /** - * Sell a donut with a random flavour. - * - * @return the sold donut - */ - public Donut sellDonut() { - Dictionary rawEvent = new Hashtable(); - Donut donut = new Donut(m_serial++, m_name, Donut.FLAVOURS[m_random - .nextInt(Donut.FLAVOURS.length)]); - rawEvent.put("food", donut); - m_ea.sendEvent(new Event("food/donuts", rawEvent)); - return donut; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml deleted file mode 100644 index fb8639e850..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/main/resources/metadata.xml +++ /dev/null @@ -1,199 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java deleted file mode 100644 index cb93526359..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/Common.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.TrueFileFilter; -import org.junit.After; -import org.junit.Before; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.options.CompositeOption; -import org.ops4j.pax.exam.options.DefaultCompositeOption; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; -import org.slf4j.LoggerFactory; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.List; - -import static junit.framework.Assert.fail; -import static org.ops4j.pax.exam.CoreOptions.*; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - @Override - protected Option[] getCustomOptions() { - return new Option[]{ - eventadmin() - }; - } - - public CompositeOption eventadmin() { - return new DefaultCompositeOption( - mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.3.0"), - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin").versionAsInProject()); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.handler.eventadmin.test.donut"); - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java deleted file mode 100644 index d5eb9914ae..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/EahTestUtils.java +++ /dev/null @@ -1,226 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut; -import org.osgi.framework.BundleContext; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; - -/** - * Useful variables used for the tests of the Event Admin Handler. - * - * @author Felix Project Team - */ -public class EahTestUtils { - - /** - * Enable debug messages ? - */ - public static final boolean TRACE = false; - /** - * The number of tests to execute. - */ - public static final int NUMBER_OF_TESTS = 50; - /** - * The time that is normally necessary to cause a blacklist from the event - * admin service. - */ - public static final long BLACK_LIST_TIME = 5000L; - /** - * The long amount of time. - */ - public static final long A_LONG_TIME = 1000L; - /** - * The bundle context. - */ - private BundleContext m_context; - /** - * The iPOJO Helper. - */ - private IPOJOHelper m_ipojoHelper; - - /** - * Construct a new Event Admin Handler Tests utility instance. - */ - public EahTestUtils(BundleContext context, IPOJOHelper ipojoHelper) { - m_ipojoHelper = ipojoHelper; - m_context = context; - } - - /** - * Utility method that causes the current thread to sleep. - * - * @param millis the number of milliseconds to wait - */ - public static void sleep(long millis) { - long past = System.currentTimeMillis(); - long future = past + millis; - long now = past; - if (TRACE) { - System.err.println("Sleeping for " + millis + "ms"); - } - while (now < future) { - try { - Thread.sleep(future - now); - } catch (Exception e) { - } - now = System.currentTimeMillis(); - } - } - - /** - * Return the index of the given donut flavour in the flavour array. - * - * @return the index of the given flavour or -1 if not found - */ - public static int flavourIndex(String flavour) { - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - if (Donut.FLAVOURS[i].equals(flavour)) - return i; - } - return -1; - } - - /** - * Return the (asynchronous) donut provider factory. - * - * @return the (asynchronous) donut provider factory - */ - public Factory getDonutProviderFactory() { - return m_ipojoHelper.getFactory("donut-provider"); - } - - /** - * Return the (asynchronous) donut provider using publishes factory. - * - * @return the (asynchronous) donut provider using publishes factory - */ - public Factory getDonutProviderUsingPublishesFactory() { - return m_ipojoHelper.getFactory("donut-provider-publishes"); - } - - /** - * Return the synchronous donut provider factory. - * - * @return the synchronous donut provider factory - */ - public Factory getSynchronousDonutProviderFactory() { - return m_ipojoHelper.getFactory( - "synchronous-donut-provider"); - } - - /** - * Return the synchronous donut provider factory using - * dataKey - * - * @return the synchronous donut provider factory - */ - public Factory getSynchronousDonutProvider2Factory() { - return m_ipojoHelper.getFactory( - "synchronous-donut-provider-2"); - } - - /** - * Return the (asynchronous) donut event provider factory. - * - * @return the (asynchronous) donut event provider factory - */ - public Factory getDonutEventProviderFactory() { - return m_ipojoHelper.getFactory( - "donut-event-provider"); - } - - /** - * Return the synchronous donut event provider factory. - * - * @return the synchronous donut event provider factory - */ - public Factory getSynchronousDonutEventProviderFactory() { - return m_ipojoHelper.getFactory( - "synchronous-donut-event-provider"); - } - - /** - * Return the event provider factory. - * - * @return the event provider factory - */ - public Factory getEventProviderFactory() { - return m_ipojoHelper.getFactory("event-provider"); - } - - /** - * Return the synchronous event provider factory. - * - * @return the synchronous event provider factory - */ - public Factory getSynchronousEventProviderFactory() { - return m_ipojoHelper.getFactory( - "synchronous-event-provider"); - } - - /** - * Return the donut consumer factory. - * - * @return the donut consumer factory - */ - public Factory getDonutConsumerFactory() { - return m_ipojoHelper.getFactory("donut-consumer"); - } - - /** - * Return the donut consumer factory using dataKey - * and dataType. - * - * @return the donut consumer factory - */ - public Factory getDonutConsumer2Factory() { - return m_ipojoHelper.getFactory("donut-consumer-2"); - } - - /** - * Return the donut event consumer factory. - * - * @return the donut event consumer factory - */ - public Factory getDonutEventConsumerFactory() { - return m_ipojoHelper.getFactory( - "donut-event-consumer"); - } - - /** - * Return the event consumer factory. - * - * @return the event consumer factory - */ - public Factory getEventConsumerFactory() { - return m_ipojoHelper.getFactory("event-consumer"); - } - - /** - * Return the event tracker. - * - * @return the event consumer factory - */ - public Factory getEventTrackerFactory() { - return m_ipojoHelper.getFactory("event-tracker"); - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java deleted file mode 100644 index c000435a0f..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestBadConfigurations.java +++ /dev/null @@ -1,958 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Dictionary; -import java.util.Hashtable; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.fail; - -/** - * Test the good behaviour of the EventAdminHandler. - * - * @author Felix Project Team - */ -public class TestBadConfigurations extends Common { - - /** - * The namespace of the Event admin handler. - */ - private static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event"; - /** - * The utility class instance. - */ - public EahTestUtils m_utils; - /** - * The available components. - */ - private Element[] m_components; - /** - * The description of a component that uses an event publisher. - */ - private Element m_provider; - /** - * The event publisher description. - */ - private Element m_publisher; - /** - * The name attribute of the event publisher. - */ - private Attribute m_publisherName; - /** - * The field attribute of the event publisher. - */ - private Attribute m_publisherField; - /** - * The topics attribute of the event publisher. - */ - private Attribute m_publisherTopics; - /** - * The data-key attribute of the event publisher. - */ - private Attribute m_publisherDataKey; - /** - * The synchronous attribute of the event publisher. - */ - private Attribute m_publisherSynchronous; - /** - * The description of a component that uses an event subscriber. - */ - private Element m_consumer; - /** - * The event subscriber description. - */ - private Element m_subscriber; - /** - * The name attribute of the event subscriber. - */ - private Attribute m_subscriberName; - /** - * The callback attribute of the event subscriber. - */ - private Attribute m_subscriberCallback; - /** - * The topics attribute of the event subscriber. - */ - private Attribute m_subscriberTopics; - /** - * The data-key attribute of the event subscriber. - */ - private Attribute m_subscriberDataKey; - /** - * The data-type attribute of the event subscriber. - */ - private Attribute m_subscriberDataType; - - private Element getManipulationForComponent(String compName) { - for (int i = 0; i < m_components.length; i++) { - if (m_components[i].containsAttribute("name") - && m_components[i].getAttribute("name").equals(compName)) { - return m_components[i].getElements("manipulation")[0]; - } - } - return null; - } - - /** - * Initialization before test cases. - *

- * Create all the instances - */ - @Before - public void setUp() { - m_utils = new EahTestUtils(bc, ipojoHelper); - /** - * Get the list of available components. - */ - try { - String header = (String) getTestBundle().getHeaders().get( - "iPOJO-Components"); - m_components = ManifestMetadataParser.parseHeaderMetadata(header) - .getElements("component"); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - /** - * Initialize the standard publishing component (based on the - * asynchronous donut provider). - */ - m_provider = new Element("component", ""); - m_provider.addAttribute(new Attribute("className", - "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProviderImpl")); - m_provider.addAttribute(new Attribute("name", - "standard donut provider for bad tests")); - - // The provided service of the publisher - Element providesDonutProvider = new Element("provides", ""); - providesDonutProvider.addAttribute(new Attribute("interface", - "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider")); - Element providesDonutProviderProperty = new Element("property", ""); - providesDonutProviderProperty - .addAttribute(new Attribute("name", "name")); - providesDonutProviderProperty.addAttribute(new Attribute("field", - "m_name")); - providesDonutProviderProperty.addAttribute(new Attribute("value", - "Unknown donut vendor")); - providesDonutProvider.addElement(providesDonutProviderProperty); - m_provider.addElement(providesDonutProvider); - - // The event publisher, corresponding to the following description : - // - m_publisher = new Element("publisher", NAMESPACE); - m_publisherName = new Attribute("name", "donut-publisher"); - m_publisherField = new Attribute("field", "m_publisher"); - m_publisherTopics = new Attribute("topics", "food/donuts"); - m_publisherDataKey = new Attribute("data-key", "food"); - m_publisherSynchronous = new Attribute("synchronous", "false"); - m_publisher.addAttribute(m_publisherName); - m_publisher.addAttribute(m_publisherField); - m_publisher.addAttribute(m_publisherTopics); - m_publisher.addAttribute(m_publisherDataKey); - m_publisher.addAttribute(m_publisherSynchronous); - m_provider.addElement(m_publisher); - - m_provider.addElement(getManipulationForComponent("donut-provider")); - - /** - * Initialize the standard subscribing component (based on the donut - * consumer). - */ - m_consumer = new Element("component", ""); - m_consumer.addAttribute(new Attribute("className", - "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumerImpl")); - m_consumer.addAttribute(new Attribute("name", - "standard donut consumer for bad tests")); - - // The provided service of the publisher - Element providesDonutConsumer = new Element("provides", ""); - providesDonutConsumer.addAttribute(new Attribute("interface", - "org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer")); - Element providesDonutConsumerNameProperty = new Element("property", ""); - providesDonutConsumerNameProperty.addAttribute(new Attribute("name", - "name")); - providesDonutConsumerNameProperty.addAttribute(new Attribute("field", - "m_name")); - providesDonutConsumerNameProperty.addAttribute(new Attribute("value", - "Unknown donut consumer")); - providesDonutConsumer.addElement(providesDonutConsumerNameProperty); - Element providesDonutConsumerSlowProperty = new Element("property", ""); - providesDonutConsumerSlowProperty.addAttribute(new Attribute("name", - "slow")); - providesDonutConsumerSlowProperty.addAttribute(new Attribute("field", - "m_isSlow")); - providesDonutConsumerSlowProperty.addAttribute(new Attribute("value", - "false")); - providesDonutConsumer.addElement(providesDonutConsumerSlowProperty); - m_consumer.addElement(providesDonutConsumer); - - // The event publisher, corresponding to the following description : - // - m_subscriber = new Element("subscriber", NAMESPACE); - m_subscriberName = new Attribute("name", "donut-subscriber"); - m_subscriberCallback = new Attribute("callback", "receiveDonut"); - m_subscriberTopics = new Attribute("topics", "food/donuts"); - m_subscriberDataKey = new Attribute("data-key", "food"); - m_subscriberDataType = new Attribute("data-type", - "org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut"); - m_subscriber.addAttribute(m_subscriberName); - m_subscriber.addAttribute(m_subscriberCallback); - m_subscriber.addAttribute(m_subscriberTopics); - m_subscriber.addAttribute(m_subscriberDataKey); - m_subscriber.addAttribute(m_subscriberDataType); - m_consumer.addElement(m_subscriber); - - m_consumer.addElement(getManipulationForComponent("donut-consumer")); - } - - /** - * Test the base configuration is correct to be sure the bad tests will fail - * because of they are really bad, and not because of an other application - * error. - *

- * This test simply create a provider and a consumer instance, send one - * event and check it is received. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testGoodConfig() - throws ConfigurationException, UnacceptableConfiguration, - MissingHandlerException { - /** - * Create the provider and the consumer instances. - */ - Dictionary properties = new Hashtable(); - - // Provider - ComponentFactory providerFactory = new ComponentFactory(bc, - m_provider); - providerFactory.start(); - properties.put("instance.name", "Emperor of donuts"); - ComponentInstance providerInstance = providerFactory - .createComponentInstance(properties); - ServiceReference providerService = ipojoHelper - .getServiceReferenceByName(DonutProvider.class - .getName(), providerInstance.getInstanceName()); - DonutProvider provider = (DonutProvider) bc - .getService(providerService); - - // The consumer - properties = new Hashtable(); - ComponentFactory consumerFactory = new ComponentFactory(bc, - m_consumer); - consumerFactory.start(); - properties.put("instance.name", "Homer Simpson"); - properties.put("slow", "false"); - ComponentInstance consumerInstance = consumerFactory - .createComponentInstance(properties); - ServiceReference consumerService = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), consumerInstance.getInstanceName()); - DonutConsumer consumer = (DonutConsumer) bc - .getService(consumerService); - - /** - * Test the normal behaviour of the instances. - */ - consumer.clearDonuts(); - Donut sentDonut = provider.sellDonut(); - Donut receivedDonut = consumer.waitForDonut(); - assertEquals("The received donut must be the same as the sent one.", - sentDonut, receivedDonut); - - /** - * Destroy component's instances. - */ - bc.ungetService(providerService); - providerInstance.dispose(); - bc.ungetService(consumerService); - consumerInstance.dispose(); - providerFactory.stop(); - consumerFactory.stop(); - } - - /** - * Try to create a publisher with no name. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithoutName() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher - m_publisher.removeAttribute(m_publisherName); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when no name is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.addAttribute(m_publisherName); - } - } - - /** - * Try to create a publisher with no field. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithoutField() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher - m_publisher.removeAttribute(m_publisherField); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when no field is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.addAttribute(m_publisherField); - } - } - - /** - * Try to create a publisher with an unexisting field. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithUnexistingField() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher and replace with an - // unexisting field name - m_publisher.removeAttribute(m_publisherField); - Attribute unexistingField = new Attribute("field", "m_unexistingField"); - m_publisher.addAttribute(unexistingField); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when an unexisting field is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.removeAttribute(unexistingField); - m_publisher.addAttribute(m_publisherField); - } - } - - /** - * Try to create a publisher with a bad typed field. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithBadTypedField() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher and replace with an - // bad typed field name - m_publisher.removeAttribute(m_publisherField); - Attribute badTypedField = new Attribute("field", "m_name"); - m_publisher.addAttribute(badTypedField); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when an bad typed field is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.removeAttribute(badTypedField); - m_publisher.addAttribute(m_publisherField); - } - } - - /** - * Try to create a publisher instance without topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithoutTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the publisher - m_publisher.removeAttribute(m_publisherTopics); - ComponentFactory fact = new ComponentFactory(bc, m_provider); - fact.start(); - - // Try to create an instance without specified topics - Dictionary conf = new Hashtable(); - conf.put("instance.name", "provider without topics"); - - ComponentInstance instance; - try { - instance = fact.createComponentInstance(conf); - // Should not be executed - instance.dispose(); - fail("The factory must not create instance without specified topics."); - } catch (ConfigurationException e) { - // OK - } finally { - fact.stop(); - // Restore the original state of the publisher - m_publisher.addAttribute(m_publisherTopics); - } - } - - /** - * Try to create a publisher with malformed topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithMalformedTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the publisher and replace with a - // malformed one - m_publisher.removeAttribute(m_publisherTopics); - Attribute malformedTopics = new Attribute("topics", - "| |\\| \\/ /-\\ |_ | |)"); - m_publisher.addAttribute(malformedTopics); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when invalid topics are specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.removeAttribute(malformedTopics); - m_publisher.addAttribute(m_publisherTopics); - } - } - - /** - * Try to create a publisher with a pattern topic (ending with '*') instead of a fixed topic. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithPatternTopic() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the publisher and replace with a - // malformed one - m_publisher.removeAttribute(m_publisherTopics); - Attribute malformedTopics = new Attribute("topics", - "a/pattern/topic/*"); - m_publisher.addAttribute(malformedTopics); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_provider); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when invalid topics are specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_publisher.removeAttribute(malformedTopics); - m_publisher.addAttribute(m_publisherTopics); - } - } - - /** - * Try to create a publisher with malformed instance topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testPublisherWithMalformedInstanceTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the publisher and replace with a - // malformed one - m_publisher.removeAttribute(m_publisherTopics); - ComponentFactory fact = new ComponentFactory(bc, m_provider); - fact.start(); - - // Try to create an instance with malformed specified topics - Dictionary conf = new Hashtable(); - conf.put("instance.name", "provider with malformed topics"); - Dictionary topics = new Hashtable(); - topics.put("donut-publisher", "| |\\| \\/ /-\\ |_ | |)"); - conf.put("event.topics", topics); - - ComponentInstance instance; - try { - instance = fact.createComponentInstance(conf); - // Should not be executed - instance.dispose(); - fail("The factory must not create instance with invalid specified topics."); - } catch (ConfigurationException e) { - // OK - } finally { - fact.stop(); - // Restore the original state of the publisher - m_publisher.addAttribute(m_publisherTopics); - } - } - - /** - * Try to create a subscriber with no name. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithoutName() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher - m_subscriber.removeAttribute(m_subscriberName); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when no name is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_subscriber.addAttribute(m_subscriberName); - } - } - - /** - * Try to create a subscriber with no callback. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithoutCallback() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the name attribute of the publisher - m_subscriber.removeAttribute(m_subscriberCallback); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when no callback is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the publisher - m_subscriber.addAttribute(m_subscriberCallback); - } - } - - /** - * Try to create a subscriber instance without topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithoutTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the subscriber - m_subscriber.removeAttribute(m_subscriberTopics); - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - fact.start(); - - // Try to create an instance without specified topics - Dictionary conf = new Hashtable(); - conf.put("instance.name", "consumer without topics"); - conf.put("slow", "false"); - - ComponentInstance instance; - try { - instance = fact.createComponentInstance(conf); - // Should not be executed - instance.dispose(); - fail("The factory must not create instance without specified topics."); - } catch (ConfigurationException e) { - // OK - } finally { - fact.stop(); - // Restore the original state of the subscriber - m_subscriber.addAttribute(m_subscriberTopics); - } - } - - /** - * Try to create a subscriber with malformed topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithMalformedTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the subscriber and replace with a - // malformed one - m_subscriber.removeAttribute(m_subscriberTopics); - Attribute malformedTopics = new Attribute("topics", - "| |\\| \\/ /-\\ |_ | |)"); - m_subscriber.addAttribute(malformedTopics); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when invalid topics are specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the subscriber - m_subscriber.removeAttribute(malformedTopics); - m_subscriber.addAttribute(m_subscriberTopics); - } - } - - /** - * Try to create a subscriber with malformed instance topics. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithMalformedInstanceTopics() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the topics attribute of the subscriber and replace with a - // malformed one - m_subscriber.removeAttribute(m_subscriberTopics); - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - fact.start(); - - // Try to create an instance with malformed specified topics - Dictionary conf = new Hashtable(); - conf.put("instance.name", "consumer with malformed topics"); - Dictionary topics = new Hashtable(); - topics.put("donut-subscriber", "| |\\| \\/ /-\\ |_ | |)"); - conf.put("event.topics", topics); - - ComponentInstance instance; - try { - instance = fact.createComponentInstance(conf); - // Should not be executed - instance.dispose(); - fail("The factory must not create instance with invalid specified topics."); - } catch (ConfigurationException e) { - // OK - } finally { - fact.stop(); - // Restore the original state of the subscriber - m_subscriber.addAttribute(m_subscriberTopics); - } - } - - /** - * Try to create a subscriber with unknown data type. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithUnknownDataType() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the data-type attribute of the subscriber and replace with a - // malformed one - m_subscriber.removeAttribute(m_subscriberDataType); - Attribute unknownType = new Attribute("data-type", "org.unknown.Clazz"); - m_subscriber.addAttribute(unknownType); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when unknown data type is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the subscriber - m_subscriber.removeAttribute(unknownType); - m_subscriber.addAttribute(m_subscriberDataType); - } - } - - /** - * Try to create a subscriber with a data type that does not match with the - * callback parameter type. - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - */ - @Test - public void testSubscriberWithUnappropriatedDataType() - throws ConfigurationException, MissingHandlerException, - UnacceptableConfiguration { - - // Remove the data-type attribute of the subscriber and replace with a - // malformed one - m_subscriber.removeAttribute(m_subscriberDataType); - Attribute unknownType = new Attribute("data-type", "java.lang.String"); - m_subscriber.addAttribute(unknownType); - - // Create and try to start the factory - ComponentFactory fact = new ComponentFactory(bc, m_consumer); - try { - fact.start(); - // Should not be executed - fact.stop(); - fail("The factory must not start when unappropriated data type is specified."); - } catch (IllegalStateException e) { - // OK - } finally { - // Restore the original state of the subscriber - m_subscriber.removeAttribute(unknownType); - m_subscriber.addAttribute(m_subscriberDataType); - } - } - - // DEBUG - public void dumpElement(String message, Element root) { - System.err.println(message + "\n" + dumpElement(0, root)); - } - - // DEBUG - private String dumpElement(int level, Element element) { - StringBuilder sb = new StringBuilder(); - // Enter tag - for (int i = 0; i < level; i++) { - sb.append(" "); - } - sb.append('<'); - sb.append(element.getName()); - Attribute[] attributes = element.getAttributes(); - for (int i = 0; i < attributes.length; i++) { - Attribute attribute = attributes[i]; - sb.append(' '); - sb.append(attribute.getName()); - sb.append('='); - sb.append(attribute.getValue()); - } - sb.append(">\n"); - // Children - Element[] elements = element.getElements(); - for (int i = 0; i < elements.length; i++) { - sb.append(dumpElement(level + 1, elements[i])); - } - // Exit tag - for (int i = 0; i < level; i++) { - sb.append(" "); - } - sb.append("\n"); - return sb.toString(); - } - - /** - * Creates a subscriber listening on a pattern topic (ending with '*'). - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened. - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened. - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened. - */ - @Test - public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - Dictionary properties = new Hashtable(); - Dictionary topics = new Hashtable(); - - // Create the donut consumer instance, listening on a pattern topic - properties.put("instance.name", "subscriber with pattern topic"); - topics.put("donut-subscriber", "a/pattern/topic/*rf"); - properties.put("event.topics", topics); - ComponentInstance instance = null; - try { - instance = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - - // Should not been executed - instance.dispose(); - fail("An invalid topic scope was accepted)"); - - } catch (ConfigurationException e) { - // Nothing to do - } - - properties = new Hashtable(); - topics = new Hashtable(); - - // Create the donut consumer instance, listening on a pattern topic - properties.put("instance.name", "subscriber with pattern topic"); - topics.put("donut-subscriber", "a/pattern/*topic/rf"); - properties.put("event.topics", topics); - - try { - instance = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - instance.dispose(); - fail("An invalid topic scope was accepted (2)"); - } catch (ConfigurationException e) { - // Nothing to do - } - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java deleted file mode 100644 index f9fb155b17..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandler.java +++ /dev/null @@ -1,714 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.event.Event; - -import java.util.*; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Test the good behaviour of the EventAdminHandler. - * - * @author Felix Project Team - */ -public class TestEventAdminHandler extends Common { - - /** - * The number of providers to test. - */ - private static final int NUMBER_OF_PROVIDERS = 6; - /** - * The number of providers using the event admin handler to test. - */ - private static final int NUMBER_OF_EAH_PROVIDERS = 4; - /** - * The number of consumers to test. - */ - private static final int NUMBER_OF_CONSUMERS = 6; - /** - * The number of synchronous providers to test. - */ - private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3; - /** - * The number of slow consumers to test. - */ - private static final int NUMBER_OF_QUICK_CONSUMERS = 3; - /** - * The list of topics to test. - */ - private static final String[] TOPICS_LIST = {"foo", "bar", "nut", - "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"}; - /** - * The utility class instance. - */ - public EahTestUtils m_utils; - /** - * The providers' instances. - */ - private ComponentInstance[] m_providersInstances; - /** - * The providers' service references. - */ - private ServiceReference[] m_providersServices; - /** - * The providers' services. - */ - private DonutProvider[] m_providers; - /** - * The synchronous providers' services. - */ - private DonutProvider[] m_synchronousProviders; - /** - * The instances of providers that uses the event admin handler. - */ - private ComponentInstance[] m_eahProvidersInstances; - /** - * The services of the providers that uses the event admin handler. - */ - private DonutProvider[] m_eahProviders; - /** - * The synchronous donut event provider service. - */ - private DonutProvider m_synchronousDonutEventProvider; - /** - * The consumers' instances. - */ - private ComponentInstance[] m_consumersInstances; - /** - * The consumers' service references. - */ - private ServiceReference[] m_consumersServices; - /** - * The consumers' services. - */ - private DonutConsumer[] m_consumers; - /** - * The slow consumers' services. - */ - private DonutConsumer[] m_quickConsumers; - /** - * The event tracker' instances. - */ - private ComponentInstance m_eventTrackerInstance; - /** - * The event tracker' service references. - */ - private ServiceReference m_eventTrackerService; - /** - * The event tracker service. - */ - private EventTracker m_eventTracker; - /** - * The filtered consumers' instances. - */ - private ComponentInstance[] m_filteredConsumersInstances; - /** - * The filtered consumers' service references. - */ - private ServiceReference[] m_filteredConsumersServices; - /** - * The filtered consumers' services. - */ - private DonutConsumer[] m_filteredConsumers; - /** - * The providers' instances with specified topics. - */ - private ComponentInstance[] m_topicsProvidersInstances; - /** - * The providers' service references with specified topics. - */ - private ServiceReference[] m_topicsProvidersServices; - /** - * The providers' service with specified topics. - */ - private DonutProvider[] m_topicsProviders; - /** - * The provider that send donuts on the "foo" topic. - */ - private DonutProvider m_fooProvider; - /** - * The provider that send donuts on the "bar" topic. - */ - private DonutProvider m_barProvider; - /** - * The provider that send donuts on the "nut" topic. - */ - private DonutProvider m_nutProvider; - /** - * The provider that send donuts on the "foo,bar" topics. - */ - private DonutProvider m_fooBarProvider; - /** - * The provider that send donuts on the "bar,nut" topics. - */ - private DonutProvider m_barNutProvider; - /** - * The provider that send donuts on the "foo,nut" topics. - */ - private DonutProvider m_fooNutProvider; - /** - * The provider that send donuts on the "foo,bar,nut" topics. - */ - private DonutProvider m_fooBarNutProvider; - /** - * The consumers' instances with specified topics. - */ - private ComponentInstance[] m_topicsConsumersInstances; - /** - * The consumers' service references with specified topics. - */ - private ServiceReference[] m_topicsConsumersServices; - /** - * The consumers' service references with specified topics. - */ - private DonutConsumer[] m_topicsConsumers; - /** - * The consumer that receive donuts on the "foo" topic. - */ - private DonutConsumer m_fooConsumer; - /** - * The consumer that receive donuts on the "bar" topic. - */ - private DonutConsumer m_barConsumer; - /** - * The consumer that receive donuts on the "nut" topic. - */ - private DonutConsumer m_nutConsumer; - /** - * The consumer that receive donuts on the "foo,bar" topics. - */ - private DonutConsumer m_fooBarConsumer; - /** - * The consumer that receive donuts on the "bar,nut" topics. - */ - private DonutConsumer m_barNutConsumer; - /** - * The consumer that receive donuts on the "foo,nut" topics. - */ - private DonutConsumer m_fooNutConsumer; - /** - * The consumer that receive donuts on the "foo,bar,nut" topics. - */ - private DonutConsumer m_fooBarNutConsumer; - - /** - * Initialization before test cases. - *

- * Create all the instances - * - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - */ - @Before - public void setUp() - throws UnacceptableConfiguration, MissingHandlerException, - ConfigurationException { - - m_utils = new EahTestUtils(bc, ipojoHelper); - Dictionary properties = new Hashtable(); - - // All the providers - m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS]; - m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS]; - m_providers = new DonutProvider[NUMBER_OF_PROVIDERS]; - m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS]; - m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS]; - m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS]; - m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsProviders = new DonutProvider[TOPICS_LIST.length]; - - // Create the (asynchronous) donut provider - properties.put("instance.name", "asynchronous donut provider"); - m_providersInstances[0] = m_utils.getDonutProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous donut provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut provider"); - m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory() - .createComponentInstance(properties); - - // Create the (asynchronous) donut event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous donut event provider"); - m_providersInstances[2] = m_utils.getDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous donut event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut event provider"); - m_providersInstances[3] = m_utils - .getSynchronousDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the (asynchronous) event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous event provider"); - m_providersInstances[4] = m_utils.getEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous event provider"); - m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - m_providersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutProvider.class.getName(), - m_providersInstances[i].getInstanceName()); - m_providers[i] = (DonutProvider) bc - .getService(m_providersServices[i]); - } - m_synchronousProviders[0] = m_providers[1]; - m_synchronousProviders[1] = m_providers[3]; - m_synchronousProviders[2] = m_providers[5]; - m_eahProviders[0] = m_providers[0]; - m_eahProviders[1] = m_providers[1]; - m_eahProviders[2] = m_providers[2]; - m_eahProviders[3] = m_providers[3]; - m_eahProvidersInstances[0] = m_providersInstances[0]; - m_eahProvidersInstances[1] = m_providersInstances[1]; - m_eahProvidersInstances[2] = m_providersInstances[2]; - m_eahProvidersInstances[3] = m_providersInstances[3]; - m_synchronousDonutEventProvider = m_providers[3]; - - // All the consumers - m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS]; - m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS]; - m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS]; - m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS]; - m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length]; - m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length]; - m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length]; - m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length]; - - // Create the (quick) donut consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut consumer"); - m_consumersInstances[0] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - - // Create the (quick) donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut event consumer"); - m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the (quick) event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick event consumer"); - m_consumersInstances[2] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow donut consumer - properties = new Hashtable(); - properties.put("slow", Boolean.TRUE); - properties.put("instance.name", "slow donut consumer"); - m_consumersInstances[3] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - - // Create the slow donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow donut event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[5] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutConsumer.class.getName(), - m_consumersInstances[i].getInstanceName()); - m_consumers[i] = (DonutConsumer) bc - .getService(m_consumersServices[i]); - } - m_quickConsumers[0] = m_consumers[0]; - m_quickConsumers[1] = m_consumers[1]; - m_quickConsumers[2] = m_consumers[2]; - - // Create the event tracker - properties = new Hashtable(); - properties.put("instance.name", "event tracker"); - m_eventTrackerInstance = m_utils.getEventTrackerFactory() - .createComponentInstance(properties); - m_eventTrackerService = ipojoHelper.getServiceReferenceByName( - EventTracker.class.getName(), m_eventTrackerInstance - .getInstanceName()); - m_eventTracker = (EventTracker) bc - .getService(m_eventTrackerService); - - // Create the filtered consumer - Dictionary filter = new Hashtable(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - String flavour = Donut.FLAVOURS[i]; - properties = new Hashtable(); - filter.put("donut-event-subscriber", "(flavour=" + flavour + ")"); - properties.put("instance.name", flavour + " donut consumer"); - properties.put("event.filter", filter); - m_filteredConsumersInstances[i] = m_utils - .getDonutEventConsumerFactory().createComponentInstance( - properties); - m_filteredConsumersServices[i] = ipojoHelper - .getServiceReferenceByName( - DonutConsumer.class - .getName(), m_filteredConsumersInstances[i] - .getInstanceName()); - m_filteredConsumers[i] = (DonutConsumer) bc - .getService(m_filteredConsumersServices[i]); - } - - // Create the providers and consumers selling and receiving donuts on - // specific topics - Dictionary topics = new Hashtable(); - for (int i = 0; i < TOPICS_LIST.length; i++) { - String topicsString = TOPICS_LIST[i]; - properties = new Hashtable(); - // Create provider - topics.put("donut-publisher", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut provider"); - m_topicsProvidersInstances[i] = m_utils - .getSynchronousDonutProviderFactory() - .createComponentInstance(properties); - m_topicsProvidersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutProvider.class - .getName(), m_topicsProvidersInstances[i] - .getInstanceName()); - m_topicsProviders[i] = (DonutProvider) bc - .getService(m_topicsProvidersServices[i]); - - // Create consumer - properties = new Hashtable(); - topics.put("donut-subscriber", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut consumer"); - - m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - m_topicsConsumersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), m_topicsConsumersInstances[i] - .getInstanceName()); - m_topicsConsumers[i] = (DonutConsumer) bc - .getService(m_topicsConsumersServices[i]); - topics.remove("donut-subscriber"); - } - - m_fooProvider = m_topicsProviders[0]; - m_barProvider = m_topicsProviders[1]; - m_nutProvider = m_topicsProviders[2]; - m_fooBarProvider = m_topicsProviders[3]; - m_barNutProvider = m_topicsProviders[4]; - m_fooNutProvider = m_topicsProviders[5]; - m_fooBarNutProvider = m_topicsProviders[6]; - m_fooConsumer = m_topicsConsumers[0]; - m_barConsumer = m_topicsConsumers[1]; - m_nutConsumer = m_topicsConsumers[2]; - m_fooBarConsumer = m_topicsConsumers[3]; - m_barNutConsumer = m_topicsConsumers[4]; - m_fooNutConsumer = m_topicsConsumers[5]; - m_fooBarNutConsumer = m_topicsConsumers[6]; - - } - - /** - * Creates a subscriber listening on a pattern topic (ending with '*'). - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened. - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened. - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened. - */ - @Test - public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - Dictionary properties = new Hashtable(); - Dictionary topics = new Hashtable(); - - // Create the donut consumer instance, listening on a pattern topic - properties.put("instance.name", "subscriber with pattern topic"); - topics.put("donut-subscriber", "a/pattern/topic/*"); - properties.put("event.topics", topics); - - ComponentInstance instance = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - instance.dispose(); - } - - /** - * Test the event handler reliability by sending events with all kinds of - * publisher and check they are received by all kinds of subscriber. - */ - @Test - public void testReliability() { - - // Flush donut list for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumers[i].clearDonuts(); - } - - // Send a lot of donut with each provider - List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS - * EahTestUtils.NUMBER_OF_TESTS); - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - sentDonuts.add(m_providers[i].sellDonut()); - } - } - - // Wait a respectable amount of time - EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME - + EahTestUtils.A_LONG_TIME); - - // Collect all received donuts for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts()); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts.", - sentDonuts.size(), receivedDonuts.size()); - assertTrue("The receiver must have eaten all sent donuts.", - receivedDonuts.containsAll(sentDonuts)); - } - } - - /** - * Test the synchronism of event sending for the component. - *

- * This test consists to send synchronously a big amount of donuts and to - * check immediately if it has been received (by all quick consumers). - */ - @Test - public void testSynchronism() { - - // Flush donut list for quick consumers - for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) { - m_quickConsumers[i].clearDonuts(); - } - - // Send a lot of donuts and check they are immediately received. - Donut sentDonut; - Donut receivedDonut; - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) { - sentDonut = m_synchronousProviders[j].sellDonut(); - for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) { - receivedDonut = m_quickConsumers[k].getDonut(); - assertEquals( - "The donut must have been received immediately and be the be the same as the sent one.", - sentDonut, receivedDonut); - } - } - } - } - - /** - * Test that the received events contains the instance name of the sender. - */ - @Test - public void testInstanceName() { - - // Flush event list of the event tracker - m_eventTracker.clearEvents(); - - // Send donuts and check the sender instance name - Event receivedEvent; - for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) { - m_eahProviders[i].sellDonut(); - receivedEvent = m_eventTracker.waitForEvent(); - assertEquals( - "The instance name property of the received message must be the same as the sender instance name.", - m_eahProvidersInstances[i].getInstanceName(), receivedEvent - .getProperty("publisher.instance.name")); - } - } - - /** - * Test the event filtering. - *

- * This test send donuts with different flavours. Each filtered consumer - * must receive only a certain kind of donut. Of course, all donuts must - * have been received too. - */ - @Test - public void testFilters() { - - // The sent donuts, sorted by flavour - List[] sentDonuts = new List[Donut.FLAVOURS.length]; - - // Flush donut list for each filtered consumer - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - m_filteredConsumers[i].clearDonuts(); - sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS - / Donut.FLAVOURS.length); - } - - // Send donuts - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - Donut donut = m_synchronousDonutEventProvider.sellDonut(); - sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())] - .add(donut); - } - - // Check the received donuts - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts(); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts with the matching flavour.", - sentDonuts[i].size(), receivedDonuts.length); - assertTrue( - "The receiver must have eaten all sent donuts matching the wanted flavour.", - Arrays.asList(receivedDonuts).containsAll(sentDonuts[i])); - } - - } - - /** - * Test the event topic. - *

- * This test send donuts on several topics. Each consumer (who listens to - * one or several topics) must receive donuts sent on his specifics topics. - */ - @Test - public void testTopics() { - - // The sent donuts, sorted by topic - int foos = 0; - int bars = 0; - int nuts = 0; - - // Flush consumers - m_fooConsumer.clearDonuts(); - m_barConsumer.clearDonuts(); - m_nutConsumer.clearDonuts(); - m_fooBarConsumer.clearDonuts(); - m_barNutConsumer.clearDonuts(); - m_fooNutConsumer.clearDonuts(); - m_fooBarNutConsumer.clearDonuts(); - - // Send donuts - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - m_fooProvider.sellDonut(); - foos++; - - m_barProvider.sellDonut(); - bars++; - - m_nutProvider.sellDonut(); - nuts++; - - m_fooBarProvider.sellDonut(); - foos++; - bars++; - - m_barNutProvider.sellDonut(); - bars++; - nuts++; - - m_fooNutProvider.sellDonut(); - foos++; - nuts++; - - m_fooBarNutProvider.sellDonut(); - foos++; - bars++; - nuts++; - } - - // Check received donuts - assertEquals("The number of received donuts must be correct.", foos, - m_fooConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars, - m_barConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", nuts, - m_nutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars, m_fooBarConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars - + nuts, m_barNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + nuts, m_fooNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length); - - } - - /** - * Finalization after test cases. - *

- * Release all services references and destroy instances. - */ - @After - public void tearDown() { - int index; - for (index = 0; index < NUMBER_OF_PROVIDERS; index++) { - bc.ungetService(m_providersServices[index]); - m_providersInstances[index].dispose(); - } - for (index = 0; index < NUMBER_OF_CONSUMERS; index++) { - bc.ungetService(m_consumersServices[index]); - m_consumersInstances[index].dispose(); - } - bc.ungetService(m_eventTrackerService); - m_eventTrackerInstance.dispose(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - bc.ungetService(m_filteredConsumersServices[i]); - m_filteredConsumersInstances[i].dispose(); - } - for (int i = 0; i < TOPICS_LIST.length; i++) { - bc.ungetService(m_topicsProvidersServices[i]); - m_topicsProvidersInstances[i].dispose(); - bc.ungetService(m_topicsConsumersServices[i]); - m_topicsConsumersInstances[i].dispose(); - } - - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java deleted file mode 100644 index ba28e47e36..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestEventAdminHandlerWithNewAttributes.java +++ /dev/null @@ -1,715 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.event.Event; - -import java.util.*; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Test the good behaviour of the EventAdminHandler. - * - * @author Felix Project Team - */ -public class TestEventAdminHandlerWithNewAttributes extends Common { - - /** - * The number of providers to test. - */ - private static final int NUMBER_OF_PROVIDERS = 6; - /** - * The number of providers using the event admin handler to test. - */ - private static final int NUMBER_OF_EAH_PROVIDERS = 4; - /** - * The number of consumers to test. - */ - private static final int NUMBER_OF_CONSUMERS = 6; - /** - * The number of synchronous providers to test. - */ - private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3; - /** - * The number of slow consumers to test. - */ - private static final int NUMBER_OF_QUICK_CONSUMERS = 3; - /** - * The list of topics to test. - */ - private static final String[] TOPICS_LIST = {"foo", "bar", "nut", - "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"}; - /** - * The utility class instance. - */ - public EahTestUtils m_utils; - /** - * The providers' instances. - */ - private ComponentInstance[] m_providersInstances; - /** - * The providers' service references. - */ - private ServiceReference[] m_providersServices; - /** - * The providers' services. - */ - private DonutProvider[] m_providers; - /** - * The synchronous providers' services. - */ - private DonutProvider[] m_synchronousProviders; - /** - * The instances of providers that uses the event admin handler. - */ - private ComponentInstance[] m_eahProvidersInstances; - /** - * The services of the providers that uses the event admin handler. - */ - private DonutProvider[] m_eahProviders; - /** - * The synchronous donut event provider service. - */ - private DonutProvider m_synchronousDonutEventProvider; - /** - * The consumers' instances. - */ - private ComponentInstance[] m_consumersInstances; - /** - * The consumers' service references. - */ - private ServiceReference[] m_consumersServices; - /** - * The consumers' services. - */ - private DonutConsumer[] m_consumers; - /** - * The slow consumers' services. - */ - private DonutConsumer[] m_quickConsumers; - /** - * The event tracker' instances. - */ - private ComponentInstance m_eventTrackerInstance; - /** - * The event tracker' service references. - */ - private ServiceReference m_eventTrackerService; - /** - * The event tracker service. - */ - private EventTracker m_eventTracker; - /** - * The filtered consumers' instances. - */ - private ComponentInstance[] m_filteredConsumersInstances; - /** - * The filtered consumers' service references. - */ - private ServiceReference[] m_filteredConsumersServices; - /** - * The filtered consumers' services. - */ - private DonutConsumer[] m_filteredConsumers; - /** - * The providers' instances with specified topics. - */ - private ComponentInstance[] m_topicsProvidersInstances; - /** - * The providers' service references with specified topics. - */ - private ServiceReference[] m_topicsProvidersServices; - /** - * The providers' service with specified topics. - */ - private DonutProvider[] m_topicsProviders; - /** - * The provider that send donuts on the "foo" topic. - */ - private DonutProvider m_fooProvider; - /** - * The provider that send donuts on the "bar" topic. - */ - private DonutProvider m_barProvider; - /** - * The provider that send donuts on the "nut" topic. - */ - private DonutProvider m_nutProvider; - /** - * The provider that send donuts on the "foo,bar" topics. - */ - private DonutProvider m_fooBarProvider; - /** - * The provider that send donuts on the "bar,nut" topics. - */ - private DonutProvider m_barNutProvider; - /** - * The provider that send donuts on the "foo,nut" topics. - */ - private DonutProvider m_fooNutProvider; - /** - * The provider that send donuts on the "foo,bar,nut" topics. - */ - private DonutProvider m_fooBarNutProvider; - /** - * The consumers' instances with specified topics. - */ - private ComponentInstance[] m_topicsConsumersInstances; - /** - * The consumers' service references with specified topics. - */ - private ServiceReference[] m_topicsConsumersServices; - /** - * The consumers' service references with specified topics. - */ - private DonutConsumer[] m_topicsConsumers; - /** - * The consumer that receive donuts on the "foo" topic. - */ - private DonutConsumer m_fooConsumer; - /** - * The consumer that receive donuts on the "bar" topic. - */ - private DonutConsumer m_barConsumer; - /** - * The consumer that receive donuts on the "nut" topic. - */ - private DonutConsumer m_nutConsumer; - /** - * The consumer that receive donuts on the "foo,bar" topics. - */ - private DonutConsumer m_fooBarConsumer; - /** - * The consumer that receive donuts on the "bar,nut" topics. - */ - private DonutConsumer m_barNutConsumer; - /** - * The consumer that receive donuts on the "foo,nut" topics. - */ - private DonutConsumer m_fooNutConsumer; - /** - * The consumer that receive donuts on the "foo,bar,nut" topics. - */ - private DonutConsumer m_fooBarNutConsumer; - - /** - * Initialization before test cases. - *

- * Create all the instances - * - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - */ - @Before - public void setUp() - throws UnacceptableConfiguration, MissingHandlerException, - ConfigurationException { - - m_utils = new EahTestUtils(bc, ipojoHelper); - Dictionary properties = new Hashtable(); - - // All the providers - m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS]; - m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS]; - m_providers = new DonutProvider[NUMBER_OF_PROVIDERS]; - m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS]; - m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS]; - m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS]; - m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsProviders = new DonutProvider[TOPICS_LIST.length]; - - // Create the (asynchronous) donut provider - properties.put("instance.name", "asynchronous donut provider"); - m_providersInstances[0] = m_utils.getDonutProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous donut provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut provider"); - m_providersInstances[1] = m_utils.getSynchronousDonutProvider2Factory() - .createComponentInstance(properties); - - // Create the (asynchronous) donut event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous donut event provider"); - m_providersInstances[2] = m_utils.getDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous donut event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut event provider"); - m_providersInstances[3] = m_utils - .getSynchronousDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the (asynchronous) event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous event provider"); - m_providersInstances[4] = m_utils.getEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous event provider"); - m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - m_providersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutProvider.class.getName(), - m_providersInstances[i].getInstanceName()); - m_providers[i] = (DonutProvider) bc - .getService(m_providersServices[i]); - } - m_synchronousProviders[0] = m_providers[1]; - m_synchronousProviders[1] = m_providers[3]; - m_synchronousProviders[2] = m_providers[5]; - m_eahProviders[0] = m_providers[0]; - m_eahProviders[1] = m_providers[1]; - m_eahProviders[2] = m_providers[2]; - m_eahProviders[3] = m_providers[3]; - m_eahProvidersInstances[0] = m_providersInstances[0]; - m_eahProvidersInstances[1] = m_providersInstances[1]; - m_eahProvidersInstances[2] = m_providersInstances[2]; - m_eahProvidersInstances[3] = m_providersInstances[3]; - m_synchronousDonutEventProvider = m_providers[3]; - - // All the consumers - m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS]; - m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS]; - m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS]; - m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS]; - - m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length]; - m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length]; - m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length]; - m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length]; - - // Create the (quick) donut consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut consumer"); - m_consumersInstances[0] = m_utils.getDonutConsumer2Factory() - .createComponentInstance(properties); - - // Create the (quick) donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut event consumer"); - m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the (quick) event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick event consumer"); - m_consumersInstances[2] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow donut consumer - properties = new Hashtable(); - properties.put("slow", Boolean.TRUE); - properties.put("instance.name", "slow donut consumer"); - m_consumersInstances[3] = m_utils.getDonutConsumer2Factory() - .createComponentInstance(properties); - - // Create the slow donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow donut event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[5] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutConsumer.class.getName(), - m_consumersInstances[i].getInstanceName()); - m_consumers[i] = (DonutConsumer) bc - .getService(m_consumersServices[i]); - } - m_quickConsumers[0] = m_consumers[0]; - m_quickConsumers[1] = m_consumers[1]; - m_quickConsumers[2] = m_consumers[2]; - - // Create the event tracker - properties = new Hashtable(); - properties.put("instance.name", "event tracker"); - m_eventTrackerInstance = m_utils.getEventTrackerFactory() - .createComponentInstance(properties); - m_eventTrackerService = ipojoHelper.getServiceReferenceByName( - EventTracker.class.getName(), m_eventTrackerInstance - .getInstanceName()); - m_eventTracker = (EventTracker) bc - .getService(m_eventTrackerService); - - // Create the filtered consumer - Dictionary filter = new Hashtable(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - String flavour = Donut.FLAVOURS[i]; - properties = new Hashtable(); - filter.put("donut-event-subscriber", "(flavour=" + flavour + ")"); - properties.put("instance.name", flavour + " donut consumer"); - properties.put("event.filter", filter); - m_filteredConsumersInstances[i] = m_utils - .getDonutEventConsumerFactory().createComponentInstance( - properties); - m_filteredConsumersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), m_filteredConsumersInstances[i] - .getInstanceName()); - m_filteredConsumers[i] = (DonutConsumer) bc - .getService(m_filteredConsumersServices[i]); - } - - // Create the providers and consumers selling and receiving donuts on - // specific topics - Dictionary topics = new Hashtable(); - for (int i = 0; i < TOPICS_LIST.length; i++) { - String topicsString = TOPICS_LIST[i]; - properties = new Hashtable(); - // Create provider - topics.put("donut-publisher", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut provider"); - m_topicsProvidersInstances[i] = m_utils - .getSynchronousDonutProviderFactory() - .createComponentInstance(properties); - m_topicsProvidersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutProvider.class - .getName(), m_topicsProvidersInstances[i] - .getInstanceName()); - m_topicsProviders[i] = (DonutProvider) bc - .getService(m_topicsProvidersServices[i]); - - // Create consumer - properties = new Hashtable(); - topics.put("donut-subscriber", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut consumer"); - - m_topicsConsumersInstances[i] = m_utils.getDonutConsumer2Factory() - .createComponentInstance(properties); - m_topicsConsumersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), m_topicsConsumersInstances[i] - .getInstanceName()); - m_topicsConsumers[i] = (DonutConsumer) bc - .getService(m_topicsConsumersServices[i]); - topics.remove("donut-subscriber"); - } - - m_fooProvider = m_topicsProviders[0]; - m_barProvider = m_topicsProviders[1]; - m_nutProvider = m_topicsProviders[2]; - m_fooBarProvider = m_topicsProviders[3]; - m_barNutProvider = m_topicsProviders[4]; - m_fooNutProvider = m_topicsProviders[5]; - m_fooBarNutProvider = m_topicsProviders[6]; - m_fooConsumer = m_topicsConsumers[0]; - m_barConsumer = m_topicsConsumers[1]; - m_nutConsumer = m_topicsConsumers[2]; - m_fooBarConsumer = m_topicsConsumers[3]; - m_barNutConsumer = m_topicsConsumers[4]; - m_fooNutConsumer = m_topicsConsumers[5]; - m_fooBarNutConsumer = m_topicsConsumers[6]; - - } - - /** - * Creates a subscriber listening on a pattern topic (ending with '*'). - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened. - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened. - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened. - */ - @Test - public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - Dictionary properties = new Hashtable(); - Dictionary topics = new Hashtable(); - - // Create the donut consumer instance, listening on a pattern topic - properties.put("instance.name", "subscriber with pattern topic"); - topics.put("donut-subscriber", "a/pattern/topic/*"); - properties.put("event.topics", topics); - - ComponentInstance instance = m_utils.getDonutConsumer2Factory() - .createComponentInstance(properties); - instance.dispose(); - } - - /** - * Test the event handler reliability by sending events with all kinds of - * publisher and check they are received by all kinds of subscriber. - */ - @Test - public void testReliability() { - - // Flush donut list for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumers[i].clearDonuts(); - } - - // Send a lot of donut with each provider - List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS - * EahTestUtils.NUMBER_OF_TESTS); - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - sentDonuts.add(m_providers[i].sellDonut()); - } - } - - // Wait a respectable amount of time - EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME - + EahTestUtils.A_LONG_TIME); - - // Collect all received donuts for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts()); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts.", - sentDonuts.size(), receivedDonuts.size()); - assertTrue("The receiver must have eaten all sent donuts.", - receivedDonuts.containsAll(sentDonuts)); - } - } - - /** - * Test the synchronism of event sending for the component. - *

- * This test consists to send synchronously a big amount of donuts and to - * check immediately if it has been received (by all quick consumers). - */ - @Test - public void testSynchronism() { - - // Flush donut list for quick consumers - for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) { - m_quickConsumers[i].clearDonuts(); - } - - // Send a lot of donuts and check they are immediately received. - Donut sentDonut; - Donut receivedDonut; - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) { - sentDonut = m_synchronousProviders[j].sellDonut(); - for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) { - receivedDonut = m_quickConsumers[k].getDonut(); - assertEquals( - "The donut must have been received immediately and be the be the same as the sent one.", - sentDonut, receivedDonut); - } - } - } - } - - /** - * Test that the received events contains the instance name of the sender. - */ - @Test - public void testInstanceName() { - - // Flush event list of the event tracker - m_eventTracker.clearEvents(); - - // Send donuts and check the sender instance name - Event receivedEvent; - for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) { - m_eahProviders[i].sellDonut(); - receivedEvent = m_eventTracker.waitForEvent(); - assertEquals( - "The instance name property of the received message must be the same as the sender instance name.", - m_eahProvidersInstances[i].getInstanceName(), receivedEvent - .getProperty("publisher.instance.name")); - } - } - - /** - * Test the event filtering. - *

- * This test send donuts with different flavours. Each filtered consumer - * must receive only a certain kind of donut. Of course, all donuts must - * have been received too. - */ - @Test - public void testFilters() { - - // The sent donuts, sorted by flavour - List[] sentDonuts = new List[Donut.FLAVOURS.length]; - - // Flush donut list for each filtered consumer - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - m_filteredConsumers[i].clearDonuts(); - sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS - / Donut.FLAVOURS.length); - } - - // Send donuts - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - Donut donut = m_synchronousDonutEventProvider.sellDonut(); - sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())] - .add(donut); - } - - // Check the received donuts - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts(); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts with the matching flavour.", - sentDonuts[i].size(), receivedDonuts.length); - assertTrue( - "The receiver must have eaten all sent donuts matching the wanted flavour.", - Arrays.asList(receivedDonuts).containsAll(sentDonuts[i])); - } - - } - - /** - * Test the event topic. - *

- * This test send donuts on several topics. Each consumer (who listens to - * one or several topics) must receive donuts sent on his specifics topics. - */ - @Test - public void testTopics() { - - // The sent donuts, sorted by topic - int foos = 0; - int bars = 0; - int nuts = 0; - - // Flush consumers - m_fooConsumer.clearDonuts(); - m_barConsumer.clearDonuts(); - m_nutConsumer.clearDonuts(); - m_fooBarConsumer.clearDonuts(); - m_barNutConsumer.clearDonuts(); - m_fooNutConsumer.clearDonuts(); - m_fooBarNutConsumer.clearDonuts(); - - // Send donuts - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - m_fooProvider.sellDonut(); - foos++; - - m_barProvider.sellDonut(); - bars++; - - m_nutProvider.sellDonut(); - nuts++; - - m_fooBarProvider.sellDonut(); - foos++; - bars++; - - m_barNutProvider.sellDonut(); - bars++; - nuts++; - - m_fooNutProvider.sellDonut(); - foos++; - nuts++; - - m_fooBarNutProvider.sellDonut(); - foos++; - bars++; - nuts++; - } - - // Check received donuts - assertEquals("The number of received donuts must be correct.", foos, - m_fooConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars, - m_barConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", nuts, - m_nutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars, m_fooBarConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars - + nuts, m_barNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + nuts, m_fooNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length); - - } - - /** - * Finalization after test cases. - *

- * Release all services references and destroy instances. - */ - @After - public void tearDown() { - int index; - for (index = 0; index < NUMBER_OF_PROVIDERS; index++) { - bc.ungetService(m_providersServices[index]); - m_providersInstances[index].dispose(); - } - for (index = 0; index < NUMBER_OF_CONSUMERS; index++) { - bc.ungetService(m_consumersServices[index]); - m_consumersInstances[index].dispose(); - } - bc.ungetService(m_eventTrackerService); - m_eventTrackerInstance.dispose(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - bc.ungetService(m_filteredConsumersServices[i]); - m_filteredConsumersInstances[i].dispose(); - } - for (int i = 0; i < TOPICS_LIST.length; i++) { - bc.ungetService(m_topicsProvidersServices[i]); - m_topicsProvidersInstances[i].dispose(); - bc.ungetService(m_topicsConsumersServices[i]); - m_topicsConsumersInstances[i].dispose(); - } - - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java b/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java deleted file mode 100644 index 2bb7a1e858..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler-it/src/it/event-admin-it/src/test/java/org/apache/felix/ipojo/handler/eventadmin/test/TestPublisher.java +++ /dev/null @@ -1,714 +0,0 @@ -/* - * 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.ipojo.handler.eventadmin.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.Donut; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutConsumer; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.DonutProvider; -import org.apache.felix.ipojo.handler.eventadmin.test.donut.EventTracker; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.event.Event; - -import java.util.*; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertTrue; - -/** - * Test the good behaviour of the EventAdminHandler. - * - * @author Felix Project Team - */ -public class TestPublisher extends Common { - - /** - * The number of providers to test. - */ - private static final int NUMBER_OF_PROVIDERS = 6; - /** - * The number of providers using the event admin handler to test. - */ - private static final int NUMBER_OF_EAH_PROVIDERS = 4; - /** - * The number of consumers to test. - */ - private static final int NUMBER_OF_CONSUMERS = 6; - /** - * The number of synchronous providers to test. - */ - private static final int NUMBER_OF_SYNCHRONOUS_PROVIDERS = 3; - /** - * The number of slow consumers to test. - */ - private static final int NUMBER_OF_QUICK_CONSUMERS = 3; - /** - * The list of topics to test. - */ - private static final String[] TOPICS_LIST = {"foo", "bar", "nut", - "foo,bar", "bar,nut", "foo,nut", "foo,bar,nut"}; - /** - * The utility class instance. - */ - public EahTestUtils m_utils; - /** - * The providers' instances. - */ - private ComponentInstance[] m_providersInstances; - /** - * The providers' service references. - */ - private ServiceReference[] m_providersServices; - /** - * The providers' services. - */ - private DonutProvider[] m_providers; - /** - * The synchronous providers' services. - */ - private DonutProvider[] m_synchronousProviders; - /** - * The instances of providers that uses the event admin handler. - */ - private ComponentInstance[] m_eahProvidersInstances; - /** - * The services of the providers that uses the event admin handler. - */ - private DonutProvider[] m_eahProviders; - /** - * The synchronous donut event provider service. - */ - private DonutProvider m_synchronousDonutEventProvider; - /** - * The consumers' instances. - */ - private ComponentInstance[] m_consumersInstances; - /** - * The consumers' service references. - */ - private ServiceReference[] m_consumersServices; - /** - * The consumers' services. - */ - private DonutConsumer[] m_consumers; - /** - * The slow consumers' services. - */ - private DonutConsumer[] m_quickConsumers; - /** - * The event tracker' instances. - */ - private ComponentInstance m_eventTrackerInstance; - /** - * The event tracker' service references. - */ - private ServiceReference m_eventTrackerService; - /** - * The event tracker service. - */ - private EventTracker m_eventTracker; - /** - * The filtered consumers' instances. - */ - private ComponentInstance[] m_filteredConsumersInstances; - /** - * The filtered consumers' service references. - */ - private ServiceReference[] m_filteredConsumersServices; - /** - * The filtered consumers' services. - */ - private DonutConsumer[] m_filteredConsumers; - /** - * The providers' instances with specified topics. - */ - private ComponentInstance[] m_topicsProvidersInstances; - /** - * The providers' service references with specified topics. - */ - private ServiceReference[] m_topicsProvidersServices; - /** - * The providers' service with specified topics. - */ - private DonutProvider[] m_topicsProviders; - /** - * The provider that send donuts on the "foo" topic. - */ - private DonutProvider m_fooProvider; - /** - * The provider that send donuts on the "bar" topic. - */ - private DonutProvider m_barProvider; - /** - * The provider that send donuts on the "nut" topic. - */ - private DonutProvider m_nutProvider; - /** - * The provider that send donuts on the "foo,bar" topics. - */ - private DonutProvider m_fooBarProvider; - /** - * The provider that send donuts on the "bar,nut" topics. - */ - private DonutProvider m_barNutProvider; - /** - * The provider that send donuts on the "foo,nut" topics. - */ - private DonutProvider m_fooNutProvider; - /** - * The provider that send donuts on the "foo,bar,nut" topics. - */ - private DonutProvider m_fooBarNutProvider; - /** - * The consumers' instances with specified topics. - */ - private ComponentInstance[] m_topicsConsumersInstances; - /** - * The consumers' service references with specified topics. - */ - private ServiceReference[] m_topicsConsumersServices; - /** - * The consumers' service references with specified topics. - */ - private DonutConsumer[] m_topicsConsumers; - /** - * The consumer that receive donuts on the "foo" topic. - */ - private DonutConsumer m_fooConsumer; - /** - * The consumer that receive donuts on the "bar" topic. - */ - private DonutConsumer m_barConsumer; - /** - * The consumer that receive donuts on the "nut" topic. - */ - private DonutConsumer m_nutConsumer; - /** - * The consumer that receive donuts on the "foo,bar" topics. - */ - private DonutConsumer m_fooBarConsumer; - /** - * The consumer that receive donuts on the "bar,nut" topics. - */ - private DonutConsumer m_barNutConsumer; - /** - * The consumer that receive donuts on the "foo,nut" topics. - */ - private DonutConsumer m_fooNutConsumer; - /** - * The consumer that receive donuts on the "foo,bar,nut" topics. - */ - private DonutConsumer m_fooBarNutConsumer; - - /** - * Initialization before test cases. - *

- * Create all the instances - * - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened - */ - @Before - public void setUp() - throws UnacceptableConfiguration, MissingHandlerException, - ConfigurationException { - - m_utils = new EahTestUtils(bc, ipojoHelper); - Dictionary properties = new Hashtable(); - - // All the providers - m_providersInstances = new ComponentInstance[NUMBER_OF_PROVIDERS]; - m_providersServices = new ServiceReference[NUMBER_OF_PROVIDERS]; - m_providers = new DonutProvider[NUMBER_OF_PROVIDERS]; - m_synchronousProviders = new DonutProvider[NUMBER_OF_SYNCHRONOUS_PROVIDERS]; - m_eahProviders = new DonutProvider[NUMBER_OF_EAH_PROVIDERS]; - m_eahProvidersInstances = new ComponentInstance[NUMBER_OF_EAH_PROVIDERS]; - m_topicsProvidersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsProvidersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsProviders = new DonutProvider[TOPICS_LIST.length]; - - // Create the (asynchronous) donut provider - properties.put("instance.name", "asynchronous donut provider"); - m_providersInstances[0] = m_utils.getDonutProviderUsingPublishesFactory() - .createComponentInstance(properties); - - // Create the synchronous donut provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut provider"); - m_providersInstances[1] = m_utils.getSynchronousDonutProviderFactory() - .createComponentInstance(properties); - - // Create the (asynchronous) donut event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous donut event provider"); - m_providersInstances[2] = m_utils.getDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous donut event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous donut event provider"); - m_providersInstances[3] = m_utils - .getSynchronousDonutEventProviderFactory() - .createComponentInstance(properties); - - // Create the (asynchronous) event provider - properties = new Hashtable(); - properties.put("instance.name", "asynchronous event provider"); - m_providersInstances[4] = m_utils.getEventProviderFactory() - .createComponentInstance(properties); - - // Create the synchronous event provider - properties = new Hashtable(); - properties.put("instance.name", "synchronous event provider"); - m_providersInstances[5] = m_utils.getSynchronousEventProviderFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - m_providersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutProvider.class.getName(), - m_providersInstances[i].getInstanceName()); - m_providers[i] = (DonutProvider) bc - .getService(m_providersServices[i]); - } - m_synchronousProviders[0] = m_providers[1]; - m_synchronousProviders[1] = m_providers[3]; - m_synchronousProviders[2] = m_providers[5]; - m_eahProviders[0] = m_providers[0]; - m_eahProviders[1] = m_providers[1]; - m_eahProviders[2] = m_providers[2]; - m_eahProviders[3] = m_providers[3]; - m_eahProvidersInstances[0] = m_providersInstances[0]; - m_eahProvidersInstances[1] = m_providersInstances[1]; - m_eahProvidersInstances[2] = m_providersInstances[2]; - m_eahProvidersInstances[3] = m_providersInstances[3]; - m_synchronousDonutEventProvider = m_providers[3]; - - // All the consumers - m_consumersInstances = new ComponentInstance[NUMBER_OF_CONSUMERS]; - m_consumersServices = new ServiceReference[NUMBER_OF_CONSUMERS]; - m_consumers = new DonutConsumer[NUMBER_OF_CONSUMERS]; - m_quickConsumers = new DonutConsumer[NUMBER_OF_QUICK_CONSUMERS]; - m_filteredConsumersInstances = new ComponentInstance[Donut.FLAVOURS.length]; - m_filteredConsumersServices = new ServiceReference[Donut.FLAVOURS.length]; - m_filteredConsumers = new DonutConsumer[Donut.FLAVOURS.length]; - m_topicsConsumersInstances = new ComponentInstance[TOPICS_LIST.length]; - m_topicsConsumersServices = new ServiceReference[TOPICS_LIST.length]; - m_topicsConsumers = new DonutConsumer[TOPICS_LIST.length]; - - // Create the (quick) donut consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut consumer"); - m_consumersInstances[0] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - - // Create the (quick) donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick donut event consumer"); - m_consumersInstances[1] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the (quick) event consumer - properties = new Hashtable(); - properties.put("instance.name", "quick event consumer"); - m_consumersInstances[2] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow donut consumer - properties = new Hashtable(); - properties.put("slow", Boolean.TRUE); - properties.put("instance.name", "slow donut consumer"); - m_consumersInstances[3] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - - // Create the slow donut event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow donut event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[4] = m_utils.getDonutEventConsumerFactory() - .createComponentInstance(properties); - - // Create the slow event consumer - properties = new Hashtable(); - properties.put("instance.name", "slow event consumer"); - properties.put("slow", Boolean.TRUE); - m_consumersInstances[5] = m_utils.getEventConsumerFactory() - .createComponentInstance(properties); - - // Get all the services references - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumersServices[i] = ipojoHelper.getServiceReferenceByName( - DonutConsumer.class.getName(), - m_consumersInstances[i].getInstanceName()); - m_consumers[i] = (DonutConsumer) bc - .getService(m_consumersServices[i]); - } - m_quickConsumers[0] = m_consumers[0]; - m_quickConsumers[1] = m_consumers[1]; - m_quickConsumers[2] = m_consumers[2]; - - // Create the event tracker - properties = new Hashtable(); - properties.put("instance.name", "event tracker"); - m_eventTrackerInstance = m_utils.getEventTrackerFactory() - .createComponentInstance(properties); - m_eventTrackerService = ipojoHelper.getServiceReferenceByName( - EventTracker.class.getName(), m_eventTrackerInstance - .getInstanceName()); - m_eventTracker = (EventTracker) bc - .getService(m_eventTrackerService); - - // Create the filtered consumer - Dictionary filter = new Hashtable(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - String flavour = Donut.FLAVOURS[i]; - properties = new Hashtable(); - filter.put("donut-event-subscriber", "(flavour=" + flavour + ")"); - properties.put("instance.name", flavour + " donut consumer"); - properties.put("event.filter", filter); - m_filteredConsumersInstances[i] = m_utils - .getDonutEventConsumerFactory().createComponentInstance( - properties); - m_filteredConsumersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), m_filteredConsumersInstances[i] - .getInstanceName()); - m_filteredConsumers[i] = (DonutConsumer) bc - .getService(m_filteredConsumersServices[i]); - } - - // Create the providers and consumers selling and receiving donuts on - // specific topics - Dictionary topics = new Hashtable(); - for (int i = 0; i < TOPICS_LIST.length; i++) { - String topicsString = TOPICS_LIST[i]; - properties = new Hashtable(); - // Create provider - topics.put("donut-publisher", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut provider"); - m_topicsProvidersInstances[i] = m_utils - .getSynchronousDonutProviderFactory() - .createComponentInstance(properties); - m_topicsProvidersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutProvider.class - .getName(), m_topicsProvidersInstances[i] - .getInstanceName()); - m_topicsProviders[i] = (DonutProvider) bc - .getService(m_topicsProvidersServices[i]); - - // Create consumer - properties = new Hashtable(); - topics.put("donut-subscriber", topicsString); - properties.put("event.topics", topics); - properties.put("instance.name", topicsString + " donut consumer"); - - m_topicsConsumersInstances[i] = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - m_topicsConsumersServices[i] = ipojoHelper - .getServiceReferenceByName(DonutConsumer.class - .getName(), m_topicsConsumersInstances[i] - .getInstanceName()); - m_topicsConsumers[i] = (DonutConsumer) bc - .getService(m_topicsConsumersServices[i]); - topics.remove("donut-subscriber"); - } - - m_fooProvider = m_topicsProviders[0]; - m_barProvider = m_topicsProviders[1]; - m_nutProvider = m_topicsProviders[2]; - m_fooBarProvider = m_topicsProviders[3]; - m_barNutProvider = m_topicsProviders[4]; - m_fooNutProvider = m_topicsProviders[5]; - m_fooBarNutProvider = m_topicsProviders[6]; - m_fooConsumer = m_topicsConsumers[0]; - m_barConsumer = m_topicsConsumers[1]; - m_nutConsumer = m_topicsConsumers[2]; - m_fooBarConsumer = m_topicsConsumers[3]; - m_barNutConsumer = m_topicsConsumers[4]; - m_fooNutConsumer = m_topicsConsumers[5]; - m_fooBarNutConsumer = m_topicsConsumers[6]; - - } - - /** - * Creates a subscriber listening on a pattern topic (ending with '*'). - * - * @throws org.apache.felix.ipojo.ConfigurationException - * something bad happened. - * @throws org.apache.felix.ipojo.MissingHandlerException - * something bad happened. - * @throws org.apache.felix.ipojo.UnacceptableConfiguration - * something bad happened. - */ - @Test - public void testSubscriberWithPatternTopic() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - Dictionary properties = new Hashtable(); - Dictionary topics = new Hashtable(); - - // Create the donut consumer instance, listening on a pattern topic - properties.put("instance.name", "subscriber with pattern topic"); - topics.put("donut-subscriber", "a/pattern/topic/*"); - properties.put("event.topics", topics); - - ComponentInstance instance = m_utils.getDonutConsumerFactory() - .createComponentInstance(properties); - instance.dispose(); - } - - /** - * Test the event handler reliability by sending events with all kinds of - * publisher and check they are received by all kinds of subscriber. - */ - @Test - public void testReliability() { - - // Flush donut list for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - m_consumers[i].clearDonuts(); - } - - // Send a lot of donut with each provider - List sentDonuts = new ArrayList(NUMBER_OF_PROVIDERS - * EahTestUtils.NUMBER_OF_TESTS); - for (int i = 0; i < NUMBER_OF_PROVIDERS; i++) { - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - sentDonuts.add(m_providers[i].sellDonut()); - } - } - - // Wait a respectable amount of time - EahTestUtils.sleep(EahTestUtils.BLACK_LIST_TIME - + EahTestUtils.A_LONG_TIME); - - // Collect all received donuts for each consumer - for (int i = 0; i < NUMBER_OF_CONSUMERS; i++) { - List receivedDonuts = Arrays.asList(m_consumers[i].getAllDonuts()); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts.", - sentDonuts.size(), receivedDonuts.size()); - assertTrue("The receiver must have eaten all sent donuts.", - receivedDonuts.containsAll(sentDonuts)); - } - } - - /** - * Test the synchronism of event sending for the component. - *

- * This test consists to send synchronously a big amount of donuts and to - * check immediately if it has been received (by all quick consumers). - */ - @Test - public void testSynchronism() { - - // Flush donut list for quick consumers - for (int i = 0; i < NUMBER_OF_QUICK_CONSUMERS; i++) { - m_quickConsumers[i].clearDonuts(); - } - - // Send a lot of donuts and check they are immediately received. - Donut sentDonut; - Donut receivedDonut; - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - for (int j = 0; j < NUMBER_OF_SYNCHRONOUS_PROVIDERS; j++) { - sentDonut = m_synchronousProviders[j].sellDonut(); - for (int k = 0; k < NUMBER_OF_QUICK_CONSUMERS; k++) { - receivedDonut = m_quickConsumers[k].getDonut(); - assertEquals( - "The donut must have been received immediately and be the be the same as the sent one.", - sentDonut, receivedDonut); - } - } - } - } - - /** - * Test that the received events contains the instance name of the sender. - */ - @Test - public void testInstanceName() { - - // Flush event list of the event tracker - m_eventTracker.clearEvents(); - - // Send donuts and check the sender instance name - Event receivedEvent; - for (int i = 0; i < NUMBER_OF_EAH_PROVIDERS; i++) { - m_eahProviders[i].sellDonut(); - receivedEvent = m_eventTracker.waitForEvent(); - assertEquals( - "The instance name property of the received message must be the same as the sender instance name.", - m_eahProvidersInstances[i].getInstanceName(), receivedEvent - .getProperty("publisher.instance.name")); - } - } - - /** - * Test the event filtering. - *

- * This test send donuts with different flavours. Each filtered consumer - * must receive only a certain kind of donut. Of course, all donuts must - * have been received too. - */ - @Test - public void testFilters() { - - // The sent donuts, sorted by flavour - List[] sentDonuts = new List[Donut.FLAVOURS.length]; - - // Flush donut list for each filtered consumer - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - m_filteredConsumers[i].clearDonuts(); - sentDonuts[i] = new ArrayList(EahTestUtils.NUMBER_OF_TESTS - / Donut.FLAVOURS.length); - } - - // Send donuts - for (int j = 0; j < EahTestUtils.NUMBER_OF_TESTS; j++) { - Donut donut = m_synchronousDonutEventProvider.sellDonut(); - sentDonuts[EahTestUtils.flavourIndex(donut.getFlavour())] - .add(donut); - } - - // Check the received donuts - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - Donut[] receivedDonuts = m_filteredConsumers[i].getAllDonuts(); - assertEquals( - "The number of received donuts must be the same as the number of sent donuts with the matching flavour.", - sentDonuts[i].size(), receivedDonuts.length); - assertTrue( - "The receiver must have eaten all sent donuts matching the wanted flavour.", - Arrays.asList(receivedDonuts).containsAll(sentDonuts[i])); - } - - } - - /** - * Test the event topic. - *

- * This test send donuts on several topics. Each consumer (who listens to - * one or several topics) must receive donuts sent on his specifics topics. - */ - @Test - public void testTopics() { - - // The sent donuts, sorted by topic - int foos = 0; - int bars = 0; - int nuts = 0; - - // Flush consumers - m_fooConsumer.clearDonuts(); - m_barConsumer.clearDonuts(); - m_nutConsumer.clearDonuts(); - m_fooBarConsumer.clearDonuts(); - m_barNutConsumer.clearDonuts(); - m_fooNutConsumer.clearDonuts(); - m_fooBarNutConsumer.clearDonuts(); - - // Send donuts - for (int i = 0; i < EahTestUtils.NUMBER_OF_TESTS; i++) { - m_fooProvider.sellDonut(); - foos++; - - m_barProvider.sellDonut(); - bars++; - - m_nutProvider.sellDonut(); - nuts++; - - m_fooBarProvider.sellDonut(); - foos++; - bars++; - - m_barNutProvider.sellDonut(); - bars++; - nuts++; - - m_fooNutProvider.sellDonut(); - foos++; - nuts++; - - m_fooBarNutProvider.sellDonut(); - foos++; - bars++; - nuts++; - } - - // Check received donuts - assertEquals("The number of received donuts must be correct.", foos, - m_fooConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars, - m_barConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", nuts, - m_nutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars, m_fooBarConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", bars - + nuts, m_barNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + nuts, m_fooNutConsumer.getAllDonuts().length); - assertEquals("The number of received donuts must be correct.", foos - + bars + nuts, m_fooBarNutConsumer.getAllDonuts().length); - - } - - /** - * Finalization after test cases. - *

- * Release all services references and destroy instances. - */ - @After - public void tearDown() { - int index; - for (index = 0; index < NUMBER_OF_PROVIDERS; index++) { - bc.ungetService(m_providersServices[index]); - m_providersInstances[index].dispose(); - } - for (index = 0; index < NUMBER_OF_CONSUMERS; index++) { - bc.ungetService(m_consumersServices[index]); - m_consumersInstances[index].dispose(); - } - bc.ungetService(m_eventTrackerService); - m_eventTrackerInstance.dispose(); - for (int i = 0; i < Donut.FLAVOURS.length; i++) { - bc.ungetService(m_filteredConsumersServices[i]); - m_filteredConsumersInstances[i].dispose(); - } - for (int i = 0; i < TOPICS_LIST.length; i++) { - bc.ungetService(m_topicsProvidersServices[i]); - m_topicsProvidersInstances[i].dispose(); - bc.ungetService(m_topicsConsumersServices[i]); - m_topicsConsumersInstances[i].dispose(); - } - - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt b/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt deleted file mode 100644 index dec38256c1..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/changelog.txt +++ /dev/null @@ -1,32 +0,0 @@ -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2718] - EventHandler are invoked one by one when using the @Subscribe handler - -** Improvement - * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions - * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision - * [FELIX-2711] - The event admin handler should provides a Handler Description - -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Bug - * [FELIX-1938] - Bad error message when an Event Subscriber does not set the data type and data key - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - - Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-794] - Event Admin handler reject correctly formed topics - -** Improvement - * [FELIX-795] - Improve metadata and manipulator performance - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -Version 1.0.0 -------------- - * Initial release diff --git a/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml b/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml deleted file mode 100644 index 69b340bf5d..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/metadata.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/eventadmin-handler/obr.xml b/ipojo/handler/eventadmin/eventadmin-handler/obr.xml deleted file mode 100644 index 4e53bb3885..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/obr.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - -

-

-

- - -

-

-

- - Import Event Admin service - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/eventadmin-handler/pom.xml b/ipojo/handler/eventadmin/eventadmin-handler/pom.xml deleted file mode 100644 index 873e87d59b..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../../pom/pom.xml - - 4.0.0 - bundle - Apache Felix iPOJO Event Admin Handler - org.apache.felix.ipojo.handler.eventadmin - 1.9.0-SNAPSHOT - - - iPOJO extension to easily interact with the OSGi Event Admin. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html - - - - - org.apache.felix - org.apache.felix.ipojo - 1.10.0 - - - org.osgi - org.osgi.core - 4.2.0 - - - org.osgi - org.osgi.compendium - 4.2.0 - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - org.apache.felix.ipojo.handlers.event*;version="1.2.0" - ${project.name} - ${project.artifactId} - iPOJO Event Admin Handlers - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/event-admin-handlers.html - - The Apache Software Foundation - - - - - org.apache.felix - maven-ipojo-plugin - 1.10.0 - - - - ipojo-bundle - - - metadata.xml - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/eventadmin-handler/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java deleted file mode 100644 index c46dacfb8d..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/EventUtil.java +++ /dev/null @@ -1,173 +0,0 @@ -/* - * 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.ipojo.handlers.event; - -import org.apache.felix.ipojo.parser.ParseUtils; - -/** - * Utility methods. - * - * @author Felix Project Team - */ -public class EventUtil { - - /** - * The separator between topics. - */ - public static final String TOPIC_SEPARATOR = ","; - - /** - * The separator between topics. - */ - public static final String TOPIC_TOKEN_SEPARATOR = "/"; - - /** - * The topic token alphabet. - */ - private static final String TOKEN_ALPHABET = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_-"; - - /** - * Tests that the given topic match with the given topic pattern. - * - * @param topic the topic to test - * @param topicPattern the topic pattern - * @return true if it matches. - */ - public static final boolean matches(String topic, String topicPattern) { - if (topicPattern.equals("*")) { - return true; - } - int star; - if ((star = topicPattern.indexOf("*")) > 0) { - return topic.startsWith(topicPattern.substring(0, star - 1)); - } else { - return topic.equals(topicPattern); - } - } - - /** - * Tests that the given topic match with the given topic patterns. - * - * @param topic the topic to test - * @param topicPatterns the topic patterns - * @return true if it matches. - */ - public static final boolean matches(String topic, String[] topicPatterns) { - int n = topicPatterns.length; - for (int i = 0; i < n; i++) { - if (matches(topic, topicPatterns[i])) { - return true; - } - } - return false; - } - - /** - * Check the given topic scope is valid. - * - * topicScope ::= "*" | ( topic "/*" ? ) - * - * @param topicScope the topic scope to check. - * - * @return {@code true} if the given topic scope is valid, {@code false} - * otherwise. - */ - public static final boolean isValidTopicScope(String topicScope) { - if (topicScope.equals("*")) { - // Wildcard character only accepted. - return true; - } - - // Remove trailing "/*" if present, to check the topic radix. - String topicWithoutWildcard; - if (topicScope.endsWith("/*")) { - topicWithoutWildcard = topicScope.substring(0, - topicScope.length() - 2); - } else { - topicWithoutWildcard = topicScope; - } - - // Validate the topic radix. - return isValidTopic(topicWithoutWildcard); - } - - /** - * Check the given topic is valid. - * - * topic ::= token ( �/� token ) * - * - * @param topic the topic to check. - * - * @return {@code true} if the given topic is valid, {@code false} - * otherwise. - */ - public static final boolean isValidTopic(String topic) { - if (topic.startsWith(TOPIC_TOKEN_SEPARATOR) - || topic.endsWith(TOPIC_TOKEN_SEPARATOR)) { - // A topic cannot start nor end with '/'. - return false; - } - - String[] tokens = ParseUtils.split(topic, TOPIC_TOKEN_SEPARATOR); - if (tokens.length < 1) { - // A topic must contain at least one token. - return false; - } - - // Check each token is valid. - for (int i = 0; i < tokens.length; i++) { - String token = tokens[i]; - if (!isValidToken(token)) { - return false; - } - } - - // The topic is valid. - return true; - } - - /** - * Check the given token is valid. - * - * token ::= ( alphanum | "_" | "-" )+ - * - * @param token the token to check. - * - * @return {@code true} if the given topic token is valid, {@code false} - * otherwise. - */ - private static boolean isValidToken(String token) { - int length = token.length(); - if (length < 1) { - // Token must contain at least one character. - return false; - } - - for (int i = 0; i < length; i++) { - // Each character in the token must belong to the token alphabet. - if (TOKEN_ALPHABET.indexOf(token.charAt(i)) == -1) { - return false; - } - } - - // The token is valid. - return true; - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java deleted file mode 100644 index 162972641d..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandler.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -import java.util.Dictionary; -import java.util.HashSet; -import java.util.Hashtable; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.FieldMetadata; -import org.osgi.service.event.EventAdmin; - -/** - * Event Publisher Handler. - * - * @author Felix Project Team - */ -public class EventAdminPublisherHandler extends PrimitiveHandler { - - /** - * The handler Namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event"; - - /** - * The names of instance configuration properties. - */ - public static final String TOPICS_PROPERTY = "event.topics"; - - /** - * The prefix for logged messages. - */ - private static final String LOG_PREFIX = "EVENT ADMIN PUBLISHER HANDLER : "; - - /** - * The instance manager. - */ - private InstanceManager m_manager; - - /** - * The current EventAdmin service. - */ - private EventAdmin m_ea; - - /** - * The publishers accessible by their fields. - */ - private Map m_publishersByField = new Hashtable(); - - /** - * The handler description - */ - private EventAdminPublisherHandlerDescription m_description; - - /** - * Initializes the component type. - * - * @param cd the component type description to populate - * @param metadata the component type metadata - * @throws ConfigurationException if the given metadata is incorrect. - * @see org.apache.felix.ipojo.Handler#initializeComponentFactory( - * org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element) - */ - public void initializeComponentFactory(ComponentTypeDescription cd, - Element metadata) - throws ConfigurationException { - - // Update the current component description - Dictionary dict = new Properties(); - PropertyDescription pd = new PropertyDescription(TOPICS_PROPERTY, - Dictionary.class.getName(), dict.toString()); - cd.addProperty(pd); - - // Get Metadata publishers - Element[] publishers = metadata.getElements("publisher", NAMESPACE); - - // if publisher is null, look for 'publishes' elements - if (publishers == null || publishers.length == 0) { - publishers = metadata.getElements("publishes", NAMESPACE); - } - - if (publishers != null) { - - // Maps used to check name and field are unique - Set nameSet = new HashSet(); - Set fieldSet = new HashSet(); - - // Check all publishers are well formed - for (int i = 0; i < publishers.length; i++) { - - // Check the publisher configuration is correct by creating an - // unused publisher metadata - EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata( - publishers[i]); - String name = publisherMetadata.getName(); - info(LOG_PREFIX + "Checking publisher " + name); - - // Check field existence and type - String field = publisherMetadata.getField(); - FieldMetadata fieldMetadata = getPojoMetadata() - .getField(publisherMetadata.getField(), - Publisher.class.getName()); - if (fieldMetadata == null) { - throw new ConfigurationException( - "Field not found in the component : " - + Publisher.class.getName() + " " + field); - } - - // Check name and field are unique - if (nameSet.contains(name)) { - throw new ConfigurationException( - "A publisher with the same name already exists : " - + name); - } else if (fieldSet.contains(field)) { - throw new ConfigurationException("The field " + field - + " is already associated to a publisher"); - } - nameSet.add(name); - fieldSet.add(field); - } - } else { - info(LOG_PREFIX + "No publisher to check"); - } - } - - /** - * Constructor. - * - * @param metadata the component type metadata - * @param conf the instance configuration - * @throws ConfigurationException if one event publication is not correct - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary conf) - throws ConfigurationException { - - // Store the component manager - m_manager = getInstanceManager(); - - // Get the topics instance configuration - Dictionary instanceTopics = (Dictionary) conf.get(TOPICS_PROPERTY); - - // Get Metadata publishers - Element[] publishers = metadata.getElements("publisher", NAMESPACE); - - // if publisher is null, look for 'publishes' elements - if (publishers == null || publishers.length == 0) { - publishers = metadata.getElements("publishes", NAMESPACE); - } - - if (publishers != null) { - // then check publishers are well formed and fill the publishers' - // map - for (int i = 0; i < publishers.length; i++) { - - // Extract the publisher configuration - EventAdminPublisherMetadata publisherMetadata = new EventAdminPublisherMetadata( - publishers[i]); - String name = publisherMetadata.getName(); - info(LOG_PREFIX + "Configuring publisher " + name); - - // Get the topic instance configuration if redefined - String topicsString = (instanceTopics != null) ? (String) instanceTopics - .get(name) - : null; - if (topicsString != null) { - publisherMetadata.setTopics(topicsString); - } - - // Check the publisher is correctly configured - publisherMetadata.check(); - - // Create the associated Publisher and insert it in the - // publisher map - Publisher publisher = new PublisherImpl(this, publisherMetadata - .getTopics(), publisherMetadata.isSynchronous(), - publisherMetadata.getDataKey(), m_manager - .getInstanceName()); - m_publishersByField - .put(publisherMetadata.getField(), publisher); - - // Register the callback that return the publisher - // reference when the specified field is read by the - // POJO. - FieldMetadata fieldMetadata = getPojoMetadata() - .getField(publisherMetadata.getField(), - Publisher.class.getName()); - m_manager.register(fieldMetadata, this); - - } - } else { - info(LOG_PREFIX + "No publisher to configure"); - } - - setValidity(true); - - debug(LOG_PREFIX+ "Setup description...."); - m_description = new EventAdminPublisherHandlerDescription(this, m_publishersByField.values()); // Initialize the description. - - } - - /** - * Starts the handler instance. - * - * This method does nothing. - */ - public void start() { - } - - /** - * Stops the handler instance. - * - * This method does nothing. - */ - public void stop() { - } - - /** - * Field interceptor callback. This method is called when the component - * attempt to one of its Publisher field. - * - * @param pojo the accessed field - * @param fieldName the name of the accessed field - * @param value the value of the field (useless here) - * - * @return the Publisher associated with the accessed field's name - */ - public Object onGet(Object pojo, String fieldName, Object value) { - // Retrieve the publisher associated to the given field name - Publisher pub = (Publisher) m_publishersByField.get(fieldName); - if (pub == null) { - error(LOG_PREFIX + "No publisher associated to the field " - + fieldName); - } - return pub; - } - - /** - * This method is called by managed publishers to obtain the current - * EventAdmin service. - * - * @return the current EventAdmin service. - */ - public EventAdmin getEventAdminService() { - return m_ea; - } - - /** - * Gets the handler description - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public HandlerDescription getDescription() { - return m_description; - } - - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java deleted file mode 100644 index 3069766396..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherHandlerDescription.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Handler Description for Event Admin Publisher. - * - * @author Felix Project Team - */ -public class EventAdminPublisherHandlerDescription extends HandlerDescription { - - /** - * The list of publishers. - */ - List/**/ m_publishersDescriptions; - - // FIXME : Add listener interface for - // : onServiceArrival, onServiceDeparture, onServiceBound, onServiceUnbound - // : methods. - - /** - * Creates the {@link EventAdminPublisherHandlerDescription}. - * @param handler the handler - * @param publishers the list of publishers - */ - public EventAdminPublisherHandlerDescription(Handler handler, Collection/**/ publishers) { - super(handler); - - m_publishersDescriptions = new ArrayList/**/(); - if (publishers != null) { - Iterator iterator = publishers.iterator(); - while (iterator.hasNext()){ - Publisher p = (Publisher) iterator.next(); - m_publishersDescriptions.add(new PublisherDescription(p)); - } - } - - } - - /** - * Gets the publisher descriptions. - * @return the descriptions. - */ - public PublisherDescription[] getPublisherDescriptions() { - return (PublisherDescription[]) - m_publishersDescriptions.toArray(new PublisherDescription[m_publishersDescriptions.size()]); - } - - /** - * Gets the handler description. - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - public Element getHandlerInfo() { - Element root = super.getHandlerInfo(); - for (int i = 0; i < m_publishersDescriptions.size(); i++) { - PublisherDescription p = (PublisherDescription) m_publishersDescriptions.get(i); - Element publisher = new Element("Publisher", ""); - publisher.addAttribute(new Attribute("name", p.getName())); - publisher.addAttribute(new Attribute("synchronous", String.valueOf(p.isSynchronous()))); - publisher.addAttribute(new Attribute("data_key", p.getDataKey())); - Element topics = new Element("Topics", ""); - if (p.getTopics() != null) { - for (int j = 0; j < p.getTopics().length; j++) { - String topic = p.getTopics()[j]; - Element e_topic = new Element("topic",""); - topics.addElement(e_topic); - e_topic.addAttribute(new Attribute("name",topic)); - } - } - publisher.addElement(topics); - root.addElement(publisher); - } - return root; - } - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java deleted file mode 100644 index 224117efcb..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/EventAdminPublisherMetadata.java +++ /dev/null @@ -1,242 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.handlers.event.EventUtil; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ParseUtils; - -/** - * Represent a publisher. - * - * @author Felix Project Team - */ -class EventAdminPublisherMetadata { - - // Names of metadata attributes - - /** - * The name attribute in the component metadata. - */ - public static final String NAME_ATTRIBUTE = "name"; - - /** - * The field attribute in the component metadata. - */ - public static final String FIELD_ATTRIBUTE = "field"; - - /** - * The topics attribute in the component metadata. - */ - public static final String TOPICS_ATTRIBUTE = "topics"; - - /** - * The synchronous attribute in the component metadata. - */ - public static final String SYNCHRONOUS_ATTRIBUTE = "synchronous"; - - /** - * The data key attribute in the component metadata. - */ - public static final String DATA_KEY_ATTRIBUTE = "data-key"; - - // Default values - - /** - * The data key attribute's default value. - */ - public static final String DEFAULT_DATA_KEY_VALUE = "user.data"; - - /** - * The synchronous attribute's default value. - */ - public static final boolean DEFAULT_SYNCHRONOUS_VALUE = false; - - /** - * The name which acts as an identifier. - */ - private final String m_name; - - /** - * The name of the field representing the publisher in the component. - */ - private final String m_field; - - /** - * Topics to which events are sent. - */ - private String[] m_topics; - - /** - * Events sending mode. - */ - private final boolean m_synchronous; - - /** - * The key where user data are stored in the event dictionary. - */ - private final String m_dataKey; - - /** - * Constructs a publisher from its metadata description. - * - * @param publisher the publisher metadata description. - * @throws ConfigurationException if the configuration of the component or - * the instance is invalid. - */ - public EventAdminPublisherMetadata(Element publisher) - throws ConfigurationException { - - /** - * Setup required attributes - */ - - // NAME_ATTRIBUTE - if (publisher.containsAttribute(NAME_ATTRIBUTE)) { - m_name = publisher.getAttribute(NAME_ATTRIBUTE); - } else { - throw new ConfigurationException( - "Missing required attribute in component configuration : " - + NAME_ATTRIBUTE); - } - - // FIELD_ATTRIBUTE - if (publisher.containsAttribute(FIELD_ATTRIBUTE)) { - m_field = publisher.getAttribute(FIELD_ATTRIBUTE); - } else { - throw new ConfigurationException( - "Missing required attribute in component configuration : " - + FIELD_ATTRIBUTE); - } - - // TOPICS_ATTRIBUTE - if (publisher.containsAttribute(TOPICS_ATTRIBUTE)) { - setTopics(publisher.getAttribute(TOPICS_ATTRIBUTE)); - } else { - m_topics = null; - // Nothing to do if TOPICS_ATTRIBUTE is not present as it can be - // overridden in the instance configuration. - } - - /** - * Setup optional attributes - */ - - // SYNCHRONOUS_ATTRIBUTE - if (publisher.containsAttribute(SYNCHRONOUS_ATTRIBUTE)) { - m_synchronous = "true".equalsIgnoreCase(publisher - .getAttribute(SYNCHRONOUS_ATTRIBUTE)); - } else { - m_synchronous = DEFAULT_SYNCHRONOUS_VALUE; - } - - // DATA_KEY_ATTRIBUTE - if (publisher.containsAttribute(DATA_KEY_ATTRIBUTE)) { - m_dataKey = publisher.getAttribute(DATA_KEY_ATTRIBUTE); - } else if (publisher.containsAttribute("data_key")) { - // XML Case - m_dataKey = publisher.getAttribute("data_key"); - } else if (publisher.containsAttribute("dataKey")) { - // Annotation case. - m_dataKey = publisher.getAttribute("dataKey"); - } else { - m_dataKey = DEFAULT_DATA_KEY_VALUE; - } - } - - /** - * Sets the topics attribute of the publisher. - * - * @param topicsString the comma separated list of the topics on which - * events are sent - * @throws ConfigurationException the specified topic string is malformed - */ - public void setTopics(String topicsString) throws ConfigurationException { - String[] newTopics = ParseUtils.split(topicsString, - EventUtil.TOPIC_SEPARATOR); - // Check each topic is valid - for (int i = 0; i < newTopics.length; i++) { - String topic = newTopics[i]; - if (!EventUtil.isValidTopic(topic)) { - throw new ConfigurationException("Invalid topic : \"" + topic - + "\"."); - } - } - m_topics = newTopics; - } - - /** - * Checks that the required instance configurable attributes are all set. - * - * @throws ConfigurationException if a required attribute is missing - */ - public void check() throws ConfigurationException { - if (m_topics == null || m_topics.length == 0) { - throw new ConfigurationException( - "Missing required attribute in component or instance configuration : " - + TOPICS_ATTRIBUTE); - } - } - - /** - * Gets the name attribute of the publisher. - * - * @return the name - */ - public String getName() { - return m_name; - } - - /** - * Gets the field attribute of the publisher. - * - * @return the field - */ - public String getField() { - return m_field; - } - - /** - * Gets the topics attribute of the publisher. - * - * @return the topics - */ - public String[] getTopics() { - return m_topics; - } - - /** - * Gets the synchronous attribute of the publisher. - * - * @return the synchronous mode - */ - public boolean isSynchronous() { - return m_synchronous; - } - - /** - * Gets the dataKey attribute of the publisher. - * - * @return the data key - */ - public String getDataKey() { - return m_dataKey; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java deleted file mode 100644 index 7b25196536..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/Publisher.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -import java.util.Dictionary; - -/** - * An Publisher is the interface between the EventAdminPublisherHandler and a - * component instance. The POJO can send event through the handler by calling a - * {@code send} method. - * - * @author Felix Project Team - */ -public interface Publisher { - - /** - * Sends an event with the specified content. - * - * @param content the content of the event - */ - void send(Dictionary content); - - /** - * Sends a data event. - * - * @param o the data to send - */ - void sendData(Object o); - - /** - * Gets the published topics. - * @return the list of topics. - */ - String[] getTopics(); - - /** - * Checks is the publisher send data synchronously. - * @return true if the publisher is synchronous. - */ - boolean isSynchronous(); - - /** - * Gets the data key if used. - * @return the data key or null - */ - String getDataKey(); - - /** - * Gets the publisher name if any. - * @return the publisher name - */ - String getName(); - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java deleted file mode 100644 index c25f37b2d6..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherDescription.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -/** - * Publisher Description. - * - * @author Felix Project Team - */ -public class PublisherDescription { - - /** - * The described publisher - */ - private Publisher m_publisher; - - /** - * Creates a {@link PublisherDescription} based - * on the given {@link Publisher} - * @param p the publisher - */ - public PublisherDescription(Publisher p) { - m_publisher = p; - } - - - /** - * Gets the topic list. - * @return the list of published topics - */ - public String[] getTopics() { - return m_publisher.getTopics(); - } - - /** - * Checks if the publisher is synchronous. - * @return true if the publisher is synchronous - */ - public boolean isSynchronous() { - return m_publisher.isSynchronous(); - } - - /** - * Gets the data key if used. - * @return the data key - */ - public String getDataKey() { - return m_publisher.getDataKey(); - } - - /** - * Gets the publisher name if any. - * @return the publisher name - */ - public String getName() { - return m_publisher.getName(); - } - - -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java deleted file mode 100644 index 1cdcc894d4..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/publisher/PublisherImpl.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.ipojo.handlers.event.publisher; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.osgi.service.event.Event; - -/** - * The PublisherImpl class is the implementation of the Publisher object used by - * components to send events. - * - * @author Felix Project Team - */ -public class PublisherImpl implements Publisher { - - /** - * The key where the component instance name is stored. - */ - public static final String INSTANCE_NAME_PROPERTY = "publisher.instance.name"; - - /** - * The managing handler. - */ - private EventAdminPublisherHandler m_handler; - - /** - * The topics of sent events. - */ - private final String[] m_topics; - - /** - * The sending mode of events. - */ - private final boolean m_synchronous; - - /** - * The key, in the content of the event, where user data are stored. - */ - private final String m_dataKey; - - /** - * The name of the component instance using this publisher. - */ - private final String m_instanceName; - - /** - * Constructs an Publisher with given parameters. - * - * @param handler the handler that will manage this publisher - * @param topics the topics on which events are sent - * @param synchronous the sending mode of events - * @param dataKey The key, in the content of the event, where user data are - * stored (may be {@code null}) - * @param instanceName the name of the instance creating this publisher. - */ - public PublisherImpl(EventAdminPublisherHandler handler, String[] topics, - boolean synchronous, String dataKey, String instanceName) { - - // Initialize the publisher's fields - m_handler = handler; - m_topics = topics; - m_synchronous = synchronous; - m_dataKey = dataKey; - m_instanceName = instanceName; - } - - /** - * Sends an event with the specified content. - * - * @param content the content of the event - */ - public void send(Dictionary content) { - // Add instance information in the event - content.put(INSTANCE_NAME_PROPERTY, m_instanceName); - // We sent the event on each topic - for (int i = 0; i < m_topics.length; i++) { - // Create an event with the given topic and content - Event e = new Event(m_topics[i], content); - // Send the event, depending on the sending mode - if (!m_synchronous) { - m_handler.getEventAdminService().postEvent(e); // Asynchronous - } else { - m_handler.getEventAdminService().sendEvent(e); // Synchronous - } - } - } - - /** - * Sends a data event. - * - * @param object the data to send - */ - public void sendData(Object object) { - // Construct the content of the event with the given object - Dictionary content = new Hashtable(); - content.put(m_dataKey, object); - send(content); - } - - /** - * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getTopics() - */ - public String[] getTopics() { - return m_topics; - } - - /** - * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#isSynchronous() - */ - public boolean isSynchronous() { - return m_synchronous; - } - - /** - * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getDataKey() - */ - public String getDataKey() { - return m_dataKey; - } - - /** - * @see org.apache.felix.ipojo.handlers.event.publisher.Publisher#getName() - */ - public String getName() { - return m_instanceName; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java deleted file mode 100644 index edbd7a3466..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandler.java +++ /dev/null @@ -1,421 +0,0 @@ -/* - * 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.ipojo.handlers.event.subscriber; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.handlers.event.EventUtil; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.parser.PojoMetadata; -import org.apache.felix.ipojo.util.Callback; -import org.osgi.framework.Filter; -import org.osgi.service.event.Event; -import org.osgi.service.event.EventHandler; - -import java.lang.reflect.InvocationTargetException; -import java.util.*; - -/** - * Event Subscriber Handler. - * - * @author Felix Project Team - */ -public class EventAdminSubscriberHandler extends PrimitiveHandler implements - EventHandler { - - /** - * The handler namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.handlers.event"; - - // Names of instance configuration properties. - - /** - * The event's topics instance configuration property. - */ - public static final String TOPICS_PROPERTY = "event.topics"; - - /** - * The event's filter instance configuration property. - */ - public static final String FILTER_PROPERTY = "event.filter"; - - /** - * The prefix for logged messages. - */ - private static final String LOG_PREFIX = "EVENT ADMIN SUBSCRIBER HANDLER : "; - - /** - * The instance manager. - */ - private InstanceManager m_manager; - - /** - * The list of subscriber accessible by name. - */ - private final Map m_subscribersByName = new HashMap(); - - /** - * The list of callbacks accessible by subscribers' names. - */ - private final Map m_callbacksByName = new Hashtable(); - - /** - * The iPOJO properties representing all the topics. - * Immutable. - */ - private String[] m_topics; - - /** - * Listening to received events ? - */ - private boolean m_isListening; - - /** - * The handler description - */ - private EventAdminSubscriberHandlerDescription m_description; - - /** - * Initializes the component type. - * - * @param cd component type description to populate. - * @param metadata component type metadata. - * @throws ConfigurationException if the metadata are incorrect. - * @see org.apache.felix.ipojo.Handler#initializeComponentFactory( - * org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element) - */ - public void initializeComponentFactory(ComponentTypeDescription cd, - Element metadata) - throws ConfigurationException { - - // Update the current component description - Dictionary dict = new Properties(); - cd.addProperty(new PropertyDescription(TOPICS_PROPERTY, - Dictionary.class.getName(), dict.toString())); - dict = new Properties(); - cd.addProperty(new PropertyDescription(FILTER_PROPERTY, - Dictionary.class.getName(), dict.toString())); - - // Get Metadata subscribers - Element[] subscribers = metadata.getElements("subscriber", NAMESPACE); - if (subscribers != null) { - - // Maps used to check name and field are unique - Set nameSet = new HashSet(); - Set callbackSet = new HashSet(); - - // Check all subscribers are well formed - for (int i = 0; i < subscribers.length; i++) { - - // Check the subscriber configuration is correct by creating an - // unused subscriber metadata - EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata( - getFactory().getBundleContext(), subscribers[i]); - - String name = subscriberMetadata.getName(); - info(LOG_PREFIX + "Checking subscriber " + name); - - // Determine the event callback prototype - PojoMetadata pojoMetadata = getPojoMetadata(); - String callbackType; - if (subscriberMetadata.getDataKey() == null) { - callbackType = Event.class.getName(); - } else { - callbackType = subscriberMetadata.getDataType().getName(); - } - - // Check the event callback method is present - MethodMetadata methodMetadata = pojoMetadata.getMethod( - subscriberMetadata.getCallback(), - new String[] { callbackType }); - String callbackSignature = subscriberMetadata.getCallback() - + "(" + callbackType + ")"; - if (methodMetadata == null) { - throw new ConfigurationException( - "Cannot find callback method " + callbackSignature); - } - - // Warn if the same callback is used by several subscribers - if (callbackSet.contains(callbackSignature)) { - warn("The callback method is already used by another subscriber : " - + callbackSignature); - } else { - callbackSet.add(callbackSignature); - } - - // Check name is unique - if (nameSet.contains(name)) { - throw new ConfigurationException( - "A subscriber with the same name already exists : " - + name); - } - nameSet.add(name); - } - - m_description = new EventAdminSubscriberHandlerDescription(this, - subscribers); - - } else { - info(LOG_PREFIX + "No subscriber to check"); - } - } - - /** - * Constructor. - * - * @param metadata the omponent type metadata - * @param conf the instance configuration - * @throws ConfigurationException if one event subscription is not correct - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary conf) - throws ConfigurationException { - - // Store the component manager - m_manager = getInstanceManager(); - - // Get the topics and filter instance configuration - Dictionary instanceTopics = (Dictionary) conf.get(TOPICS_PROPERTY); - Dictionary instanceFilter = (Dictionary) conf.get(FILTER_PROPERTY); - - // Get Metadata subscribers - Element[] subscribers = metadata.getElements("subscriber", NAMESPACE); - - // The topics to listen - Set topics = new TreeSet(); - - if (subscribers != null) { - - // Configure all subscribers - for (int i = 0; i < subscribers.length; i++) { - - // Extract the subscriber configuration - EventAdminSubscriberMetadata subscriberMetadata = new EventAdminSubscriberMetadata( - m_manager.getContext(), subscribers[i]); - String name = subscriberMetadata.getName(); - info(LOG_PREFIX + "Configuring subscriber " + name); - - // Get the topics instance configuration if redefined - String topicsString = (instanceTopics != null) ? (String) instanceTopics.get(name) : null; - if (topicsString != null) { - subscriberMetadata.setTopics(topicsString); - } - - // Get the filter instance configuration if redefined - String filterString = (instanceFilter != null) ? (String) instanceFilter.get(name) : null; - if (filterString != null) { - subscriberMetadata.setFilter(filterString); - } - - // Check the publisher is correctly configured - subscriberMetadata.check(); - - // Add this subscriber's topics to the global list - String[] subscriberTopics = subscriberMetadata.getTopics(); - for (int j = 0; j < subscriberTopics.length; j++) { - topics.add(subscriberTopics[j]); - } - - // Determine the event callback prototype - PojoMetadata pojoMetadata = getPojoMetadata(); - String callbackType; - if (subscriberMetadata.getDataKey() == null) { - callbackType = Event.class.getName(); - } else { - callbackType = subscriberMetadata.getDataType().getName(); - } - - // Create the specified callback and register it - MethodMetadata methodMetadata = pojoMetadata.getMethod( - subscriberMetadata.getCallback(), - new String[] { callbackType }); - Callback callback = new Callback(methodMetadata, m_manager); - m_callbacksByName.put(name, callback); - - // Add the subscriber list gloal map - m_subscribersByName.put(name, subscriberMetadata); - } - - // Construct the global topic list - m_topics = new String[topics.size()]; - int i = 0; - for (Iterator iterator = topics.iterator(); iterator.hasNext();) { - String tmp = (String) iterator.next(); - m_topics[i++] = tmp; - } - - m_description = new EventAdminSubscriberHandlerDescription(this, - subscribers); - - } else { - info(LOG_PREFIX + "No subscriber to configure"); - } - } - - /** - * Handler start method. - * - * @see org.apache.felix.ipojo.Handler#start() - */ - public synchronized void start() { - m_isListening = true; - } - - /** - * Handler stop method. - * - * @see org.apache.felix.ipojo.Handler#stop() - */ - public synchronized void stop() { - m_isListening = false; - } - - /** - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public HandlerDescription getDescription() { - return m_description; - } - - /*************************************************************************** - * OSGi EventHandler callback - **************************************************************************/ - - /** - * Receives an event. The event is dispatch to attached subscribers. - * - * @param event the received event. - * @see org.osgi.service.event.EventHandler#handleEvent(org.osgi.service.event.Event) - */ - public void handleEvent(final Event event) { - EventAdminSubscriberMetadata subscriberMetadata = null; - // Retrieve the event's topic - String topic = event.getTopic(); - - // For each subscribers - Collection subscribers = m_subscribersByName.values(); - for (Iterator i = subscribers.iterator(); i.hasNext();) { - subscriberMetadata = (EventAdminSubscriberMetadata) i.next(); - - // Stack confinement - boolean isListening = false; - - Object callbackParam = null; - Callback callback = null; - - synchronized (this) { - isListening = m_isListening; - } - - // Check if the subscriber's topic and filter match - Filter filter = subscriberMetadata.getFilter(); - - if (EventUtil.matches(topic, subscriberMetadata.getTopics()) - && (filter == null || event.matches(filter))) { - - String name = subscriberMetadata.getName(); - callback = (Callback) m_callbacksByName.get(name); - - try { - // Depending on the subscriber type... - callbackParam = getCallbackParameter(event, - subscriberMetadata); - } catch (ClassCastException e) { - // Ignore the data event if type doesn't match - warn(LOG_PREFIX + "Ignoring data event : Bad data type", e); - } catch (NoSuchFieldException e) { - // Ignore events without data field for data events - // subscriber - warn(LOG_PREFIX + "Ignoring data event : No data", e); - } - } - - - // Run the callback (final check to avoid - // NullPointerExceptions) - if (isListening && callback != null && callbackParam != null) { - try { - callback.call(new Object[] { callbackParam }); - } catch (InvocationTargetException e) { - error(LOG_PREFIX - + "The callback has thrown an exception", - e.getTargetException()); - } catch (Exception e) { - error(LOG_PREFIX - + "Unexpected exception when calling callback", - e); - } - } - - } - } - - /** - * Computes the callback parameter. - * @param event the event - * @param subscriberMetadata the subscribe metadata - * @param dataKey the data key - * @return the parameter of the callback - * @throws ClassCastException the data class does not match the found value. - * @throws NoSuchFieldException the datakey is not present in the event. - */ - private Object getCallbackParameter(final Event event, - final EventAdminSubscriberMetadata subscriberMetadata - ) throws ClassCastException,NoSuchFieldException { - String dataKey = subscriberMetadata.getDataKey(); - if (dataKey == null) { - // Generic event subscriber : pass the event to the - // registered callback - return event; - } else { - // Check for a data key in the event - boolean dataKeyPresent = false; - String[] properties = event.getPropertyNames(); - for (int j = 0; j < properties.length && !dataKeyPresent; j++) { - if (dataKey.equals(properties[j])) { - dataKeyPresent = true; - } - } - - if (dataKeyPresent) { - // Data event : check type compatibility and - // pass the given object to the registered - // callback - Object data = event.getProperty(dataKey); - Class dataType = subscriberMetadata.getDataType(); - Class dataClazz = data.getClass(); - if (dataType.isAssignableFrom(dataClazz)) { - return data; - } else { - throw new ClassCastException("Cannot convert " + dataClazz.getName() + " to " - + dataType.getName()); - } - } else { - throw new java.lang.NoSuchFieldException(dataKey); - } - - } - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java deleted file mode 100644 index 1f9e41f34f..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberHandlerDescription.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.handlers.event.subscriber; - -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Event Admin Subscriber Handler Description. - * - * @author Felix Project Team - */ -public class EventAdminSubscriberHandlerDescription extends HandlerDescription { - - /** - * List of subscribers. - */ - private Element[] m_subscribersDescriptions; - - /** - * Creates a {@link EventAdminSubscriberHandlerDescription} - * @param handler the handler - * @param subscribers the subscribers - */ - public EventAdminSubscriberHandlerDescription(Handler handler, Element[] subscribers) { - super(handler); - m_subscribersDescriptions = subscribers; - } - - /** - * Gets the handler info. - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - public Element getHandlerInfo() { - Element root = super.getHandlerInfo(); - if (m_subscribersDescriptions != null) { - for (int i = 0; i < m_subscribersDescriptions.length; i++) { - Element description = m_subscribersDescriptions[i]; - root.addElement(description); - } - } - return root; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java b/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java deleted file mode 100644 index 3d9f0a5e12..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/java/org/apache/felix/ipojo/handlers/event/subscriber/EventAdminSubscriberMetadata.java +++ /dev/null @@ -1,305 +0,0 @@ -/* - * 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.ipojo.handlers.event.subscriber; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.handlers.event.EventUtil; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; - -/** - * Represent an subscriber. - * - * @author Felix Project Team - */ -class EventAdminSubscriberMetadata { - - // Names of metadata attributes - - /** - * The name attribute in the component metadata. - */ - public static final String NAME_ATTRIBUTE = "name"; - - /** - * The callback attribute in the component metadata. - */ - public static final String CALLBACK_ATTRIBUTE = "callback"; - - /** - * The topics attribute in the component metadata. - */ - public static final String TOPICS_ATTRIBUTE = "topics"; - - /** - * The data key attribute in the component metadata. - */ - public static final String DATA_KEY_ATTRIBUTE = "data-key"; - - /** - * The data type attribute in the component metadata. - */ - public static final String DATA_TYPE_ATTRIBUTE = "data-type"; - - /** - * The filter attribute in the component metadata. - */ - public static final String FILTER_ATTRIBUTE = "filter"; - - // Default values - - /** - * The data type atttribute's default value. - */ - public static final Class DEFAULT_DATA_TYPE_VALUE = java.lang.Object.class; - - /** - * The name which acts as an identifier. - */ - private final String m_name; - - /** - * Name of the callback method. - */ - private final String m_callback; - - /** - * Listened topics. - */ - private String[] m_topics; - - /** - * The key where user data are stored in the event dictionary. - */ - private String m_dataKey; - - /** - * The type of received data. - */ - private final Class m_dataType; - - /** - * Event filter. - */ - private Filter m_filter; - - /** - * The context of the bundle. - */ - private final BundleContext m_bundleContext; - - /** - * Constructor. - * - * @param bundleContext the bundle context of the managed instance. - * @param subscriber the subscriber metadata. - * @throws ConfigurationException if the configuration of the component or - * the instance is invalid. - */ - public EventAdminSubscriberMetadata(BundleContext bundleContext, - Element subscriber) throws ConfigurationException { - m_bundleContext = bundleContext; - - /** - * Setup required attributes - */ - - // NAME_ATTRIBUTE - if (subscriber.containsAttribute(NAME_ATTRIBUTE)) { - m_name = subscriber.getAttribute(NAME_ATTRIBUTE); - } else { - throw new ConfigurationException( - "Missing required attribute in component configuration : " - + NAME_ATTRIBUTE); - } - - // CALLBACK_ATTRIBUTE - if (subscriber.containsAttribute(CALLBACK_ATTRIBUTE)) { - m_callback = subscriber.getAttribute(CALLBACK_ATTRIBUTE); - } else if (subscriber.containsAttribute("method")) { - m_callback = subscriber.getAttribute("method"); - } else { - throw new ConfigurationException( - "Missing required attribute in component configuration : " - + CALLBACK_ATTRIBUTE); - } - - // TOPICS_ATTRIBUTE - if (subscriber.containsAttribute(TOPICS_ATTRIBUTE)) { - setTopics(subscriber.getAttribute(TOPICS_ATTRIBUTE)); - } else { - m_topics = null; - // Nothing to do if TOPICS_ATTRIBUTE is not present as it can be - // overridden in the instance configuration. - } - - /** - * Setup optional attributes - */ - - // DATA_KEY_ATTRIBUTE - m_dataKey = subscriber.getAttribute(DATA_KEY_ATTRIBUTE); - if (m_dataKey == null) { // Alternative configurations (data_key and dataKey) - // XML - m_dataKey = subscriber.getAttribute("data_key"); - if (m_dataKey == null) { - // Annotation - m_dataKey = subscriber.getAttribute("dataKey"); - } - } - - String t = subscriber.getAttribute(DATA_TYPE_ATTRIBUTE); - if (t == null) { // Alternative configurations - // XML - t = subscriber.getAttribute("data_type"); - if (t == null) { - /// Annotation - t = subscriber.getAttribute("dataType"); - } - } - - if (t != null) { - // Check that the data-key attribute is set. - if (m_dataKey == null) { - throw new ConfigurationException( - "Missing attribute in component configuration : " - + DATA_KEY_ATTRIBUTE); - } - Class type; - try { - type = m_bundleContext.getBundle().loadClass(t); - } catch (ClassNotFoundException e) { - throw new ConfigurationException("Data type class not found : " - + t); - } - m_dataType = type; - } else { - m_dataType = DEFAULT_DATA_TYPE_VALUE; - } - - // FILTER_ATTRIBUTE - if (subscriber.containsAttribute(FILTER_ATTRIBUTE)) { - setFilter(subscriber.getAttribute(FILTER_ATTRIBUTE)); - } - } - - /** - * Sets the topics attribute of the subscriber. - * - * @param topicsString the comma separated list of the topics to listen - * @throws ConfigurationException if the specified topic list is malformed - */ - public void setTopics(String topicsString) throws ConfigurationException { - String[] newTopics = ParseUtils.split(topicsString, - EventUtil.TOPIC_SEPARATOR); - // Check each topic is valid - for (int i = 0; i < newTopics.length; i++) { - String topicScope = newTopics[i]; - if (!EventUtil.isValidTopicScope(topicScope)) { - throw new ConfigurationException("Invalid topic scope : \"" - + topicScope + "\"."); - } - } - m_topics = newTopics; - } - - /** - * Sets the filter attribute of the subscriber. - * - * @param filterString the string representation of the event filter - * @throws ConfigurationException if the LDAP filter is malformed - */ - public void setFilter(String filterString) throws ConfigurationException { - try { - m_filter = m_bundleContext.createFilter(filterString); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("Invalid filter syntax"); - } - } - - /** - * Checks that the required instance configurable attributes are all set. - * - * @throws ConfigurationException if a required attribute is missing - */ - public void check() throws ConfigurationException { - if (m_topics == null || m_topics.length == 0) { - throw new ConfigurationException( - "Missing required attribute in component or instance configuration : " - + TOPICS_ATTRIBUTE); - } - } - - /** - * Gets the name attribute of the subscriber. - * - * @return the name - */ - public String getName() { - return m_name; - } - - /** - * Gets the topics attribute of the subscriber. - * - * @return the topics - */ - public String[] getTopics() { - return m_topics; - } - - /** - * Gets the callback attribute of the subscriber. - * - * @return the callback - */ - public String getCallback() { - return m_callback; - } - - /** - * Gets the data key attribute of the subscriber. - * - * @return the dataKey - */ - public String getDataKey() { - return m_dataKey; - } - - /** - * Gets the data type attribute of the subscriber. - * - * @return the dataType - */ - public Class getDataType() { - return m_dataType; - } - - /** - * Gets the filter attribute of the subscriber. - * - * @return the filter - */ - public Filter getFilter() { - return m_filter; - } -} diff --git a/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd b/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd deleted file mode 100644 index b9c8271d50..0000000000 --- a/ipojo/handler/eventadmin/eventadmin-handler/src/main/resources/event-admin.xsd +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - Description of an event publisher. - - - - The name of the event publisher, acting as a unique identifier. -The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher". - - - - The name of the POJO field associated to this event publisher. -Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending. - - - - The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events. - - - Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher. -The default value of this attribute is "false". - - - - The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key. -The default value of this attribute is user.data. - - - - - Description of an event subscriber. - - - - The name of the event subscriber, acting as a unique identifier. - - - The name of the POJO's method that will be called each time an event is received. -This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes. - - - - The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method. - - - The event filter is used to filter incoming events before sending them to the callback. -The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered. - - - - The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary. -If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event. -This attribute is generally used with the data-typeattribute to specify the received object type. -If an event is received and it does not contain such a key, it is ignored (with a warning message). - - - - This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects. -It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception. -Data events that are not corresponding to the specified type will be ignored (with a warning message). - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/eventadmin/pom.xml b/ipojo/handler/eventadmin/pom.xml deleted file mode 100644 index c8f5604a30..0000000000 --- a/ipojo/handler/eventadmin/pom.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.handler.event-admin-handler-project - 1.9.0-SNAPSHOT - Apache Felix iPOJO Event Admin Handler Project - pom - - - eventadmin-handler - eventadmin-handler-it - - - diff --git a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/eventadmin/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/extender/changelog.txt b/ipojo/handler/extender/changelog.txt deleted file mode 100644 index 6c7810ac63..0000000000 --- a/ipojo/handler/extender/changelog.txt +++ /dev/null @@ -1,26 +0,0 @@ -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1025] - iPOJO Extender Handler hold a lock during its initialization - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Bug - * [FELIX-613] - Extender pattern handler issue when bundles are leaving - -** Improvement - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/handler/extender/metadata.xml b/ipojo/handler/extender/metadata.xml deleted file mode 100644 index 68c4aa0479..0000000000 --- a/ipojo/handler/extender/metadata.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/handler/extender/obr.xml b/ipojo/handler/extender/obr.xml deleted file mode 100644 index 34b8e0e9f5..0000000000 --- a/ipojo/handler/extender/obr.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - -

-

-

- - \ No newline at end of file diff --git a/ipojo/handler/extender/pom.xml b/ipojo/handler/extender/pom.xml deleted file mode 100644 index cb8dc5ef1e..0000000000 --- a/ipojo/handler/extender/pom.xml +++ /dev/null @@ -1,102 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - bundle - Apache Felix iPOJO Extender Pattern Handler - org.apache.felix.ipojo.handler.extender - 1.5.0-SNAPSHOT - - - iPOJO extension to implement an extender pattern (host). - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/extender-pattern-handler.html - - - - - org.apache.felix - org.apache.felix.ipojo - 1.8.6 - - - - - - org.apache.felix - maven-bundle-plugin - true - - - The Apache Software Foundation - iPOJO Extender Pattern Handler - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/extender-pattern-handler.html - - org.apache.felix.ipojo.handler.extender - - ${project.artifactId} - ${project.name} - - - - - org.apache.felix - maven-ipojo-plugin - 1.8.6 - - - - ipojo-bundle - - - metadata.xml - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - diff --git a/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/extender/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/extender/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/extender/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java deleted file mode 100644 index 2f39ccc1db..0000000000 --- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/BundleTracker.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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.ipojo.handler.extender; - -import java.util.HashSet; -import java.util.Set; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.SynchronousBundleListener; - -/** - * This is a very simple bundle tracker utility class that tracks active - * bundles. The tracker must be given a bundle context upon creation, - * which it uses to listen for bundle events. The bundle tracker must be - * opened to track objects and closed when it is no longer needed. This - * class is abstract, which means in order to use it you must create a - * subclass of it. Subclasses must implement the addedBundle() - * and removedBundle() methods, which can be used to perform some - * custom action upon the activation or deactivation of bundles. Since this - * tracker is quite simple, its concurrency control approach is also - * simplistic. This means that subclasses should take great care to ensure - * that their addedBundle() and removedBundle() methods - * are very simple and do not do anything to change the state of any bundles. - * @author Felix Project Team - **/ -public abstract class BundleTracker { - /** - * Set of tracked bundles. - */ - final Set m_bundleSet = new HashSet(); - - /** - * Bundle context. - */ - final BundleContext m_context; - - /** - * Synchronous bundle listener. - */ - final SynchronousBundleListener m_listener; - - /** - * Flag indicating if the tracking is open. - */ - boolean m_open; - - /** - * Constructs a bundle tracker object that will use the specified - * bundle context. - * @param context the bundle context to use to track bundles. - **/ - public BundleTracker(BundleContext context) { - m_context = context; - m_listener = new SynchronousBundleListener() { - public void bundleChanged(BundleEvent evt) { - synchronized (BundleTracker.this) { - if (!m_open) { return; } - - if (evt.getType() == BundleEvent.STARTED) { - if (!m_bundleSet.contains(evt.getBundle())) { - m_bundleSet.add(evt.getBundle()); - addedBundle(evt.getBundle()); - } - } else if (evt.getType() == BundleEvent.STOPPED) { - if (m_bundleSet.contains(evt.getBundle())) { - m_bundleSet.remove(evt.getBundle()); - removedBundle(evt.getBundle()); - } - } - } - } - }; - } - - /** - * Returns the current set of active bundles. - * @return the current set of active bundles. - **/ - public synchronized Bundle[] getBundles() { - return (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]); - } - - /** - * Call this method to start the tracking of active bundles. - **/ - public void open() { - synchronized (this) { - if (!m_open) { - m_open = true; - - m_context.addBundleListener(m_listener); - } - } - - Bundle[] bundles = m_context.getBundles(); - for (int i = 0; i < bundles.length; i++) { - if (bundles[i].getState() == Bundle.ACTIVE) { - if (m_bundleSet.add(bundles[i])) { - addedBundle(bundles[i]); - } - } - } - } - - /** - * Call this method to stop the tracking of active bundles. - **/ - public synchronized void close() { - if (m_open) { - m_open = false; - - m_context.removeBundleListener(m_listener); - - Bundle[] bundles = (Bundle[]) m_bundleSet.toArray(new Bundle[m_bundleSet.size()]); - for (int i = 0; i < bundles.length; i++) { - if (m_bundleSet.remove(bundles[i])) { - removedBundle(bundles[i]); - } - } - } - } - - /** - * Subclasses must implement this method; it can be used to perform - * actions upon the activation of a bundle. Subclasses should keep - * this method implementation as simple as possible and should not - * cause the change in any bundle state to avoid concurrency issues. - * @param bundle the bundle being added to the active set. - **/ - protected abstract void addedBundle(Bundle bundle); - - /** - * Subclasses must implement this method; it can be used to perform - * actions upon the deactivation of a bundle. Subclasses should keep - * this method implementation as simple as possible and should not - * cause the change in any bundle state to avoid concurrency issues. - * @param bundle the bundle being removed from the active set. - **/ - protected abstract void removedBundle(Bundle bundle); -} diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java deleted file mode 100644 index 5d0186936d..0000000000 --- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderManager.java +++ /dev/null @@ -1,135 +0,0 @@ -/* - * 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.ipojo.handler.extender; - -import java.lang.reflect.InvocationTargetException; -import java.util.Dictionary; -import java.util.HashSet; -import java.util.Set; - -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.util.Callback; -import org.osgi.framework.Bundle; - -/** - * Track and manage extensions. - * @author Felix Project Team - */ -public class ExtenderManager extends BundleTracker { - - /** - * Looked extension. - */ - private String m_extension; - - /** - * OnArrival method. - */ - private Callback m_onArrival; - - /** - * OnDeparture method. - */ - private Callback m_onDeparture; - - /** - * Attached handler. - */ - private PrimitiveHandler m_handler; - - /** - * Set of managed bundles. - */ - private Set m_bundles = new HashSet(); - - /** - * Constructor. - * @param handler the attached handler. - * @param extension the looked extension. - * @param bind the onArrival method - * @param unbind the onDeparture method. - */ - public ExtenderManager(ExtenderModelHandler handler, String extension, String bind, String unbind) { - super(handler.getInstanceManager().getContext()); - m_handler = handler; - m_onArrival = new Callback(bind, new Class[] {Bundle.class, String.class}, false, m_handler.getInstanceManager()); - m_onDeparture = new Callback(unbind, new Class[] {Bundle.class}, false, m_handler.getInstanceManager()); - m_extension = extension; - } - - - /** - * A bundle arrives. - * Checks if the bundle match with the looked extension, if so call the arrival callback. - * @param bundle the arriving bundle. - * @see org.apache.felix.ipojo.handler.extender.BundleTracker#addedBundle(org.osgi.framework.Bundle) - */ - protected void addedBundle(Bundle bundle) { - Dictionary headers = bundle.getHeaders(); - String header = (String) headers.get(m_extension); - if (header != null) { - synchronized (this) { - m_bundles.add(bundle); - } - try { // Call the callback outside the synchronized block. - m_onArrival.call(new Object[] {bundle, header}); - } catch (NoSuchMethodException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e); - m_handler.getInstanceManager().stop(); - } catch (IllegalAccessException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be called", e); - m_handler.getInstanceManager().stop(); - } catch (InvocationTargetException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e.getTargetException()); - m_handler.getInstanceManager().stop(); - } - } - } - - /** - * A bundle is stopping. - * Check if the bundle was managed, if so call the remove departure callback. - * @param bundle the leaving bundle. - * @see org.apache.felix.ipojo.handler.extender.BundleTracker#removedBundle(org.osgi.framework.Bundle) - */ - protected void removedBundle(Bundle bundle) { - boolean contained; - synchronized (this) { - contained = m_bundles.remove(bundle); // Stack confinement - } - - if (contained) { - try { - m_onDeparture.call(new Object[] {bundle}); - } catch (NoSuchMethodException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e); - m_handler.getInstanceManager().stop(); - } catch (IllegalAccessException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be called", e); - m_handler.getInstanceManager().stop(); - } catch (InvocationTargetException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException()); - m_handler.getInstanceManager().stop(); - } - } - } - - - -} diff --git a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java b/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java deleted file mode 100644 index ec4356d8be..0000000000 --- a/ipojo/handler/extender/src/main/java/org/apache/felix/ipojo/handler/extender/ExtenderModelHandler.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.handler.extender; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Handler automating extender pattern. The component using this handler is notified - * when an handler with a special manifest extension is detected, the component is notified. - * When a managed handler leaves, the component is also notified. - * @author Felix Project Team - */ -public class ExtenderModelHandler extends PrimitiveHandler { - - /** - * The handler namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.extender"; - - /** - * The extension manager list. - * Immutable once set. - */ - private List m_managers = new ArrayList(1); - - /** - * Configures the handler. - * @param elem the component type element. - * @param dict the instance configuration. - * @throws ConfigurationException if the configuration is not valid. - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element elem, Dictionary dict) throws ConfigurationException { - Element[] elems = elem.getElements("extender", NAMESPACE); - for (int i = 0; i < elems.length; i++) { - String extension = elems[i].getAttribute("extension"); - String onArrival = elems[i].getAttribute("onArrival"); - String onDeparture = elems[i].getAttribute("onDeparture"); - - if (extension == null) { - throw new ConfigurationException("The extender element requires an 'extender' attribute"); - } - if (onArrival == null || onDeparture == null) { - throw new ConfigurationException("The extender element requires the 'onArrival' and 'onDeparture' attributes"); - } - - ExtenderManager wbm = new ExtenderManager(this, extension, onArrival, onDeparture); - m_managers.add(wbm); - } - - } - - /** - * Starts the handler. - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - for (int i = 0; i < m_managers.size(); i++) { - ((ExtenderManager) m_managers.get(i)).open(); - } - } - - /** - * Stops the handler. - * @see org.apache.felix.ipojo.Handler#stop() - */ - public void stop() { - for (int i = 0; i < m_managers.size(); i++) { - ((ExtenderManager) m_managers.get(i)).close(); - } - } - -} diff --git a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd b/ipojo/handler/extender/src/main/resources/extender-pattern.xsd deleted file mode 100644 index 0e2ed9fba7..0000000000 --- a/ipojo/handler/extender/src/main/resources/extender-pattern.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Description of the extender pattern configuration. -The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked. - - - - Declaring the method to invoke when a matching bundle arrives - - - - Declaring the method to invoke when a matching bundle leaves - - - - Declaring the looked manifest header. - - - \ No newline at end of file diff --git a/ipojo/handler/jmx/changelog.txt b/ipojo/handler/jmx/changelog.txt deleted file mode 100644 index 87556fcf47..0000000000 --- a/ipojo/handler/jmx/changelog.txt +++ /dev/null @@ -1,23 +0,0 @@ -Changes from 1.4.0 to 1.6.0 ---------------------------- -** Improvement - * [FELIX-2633] - Rename JMX annotations - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1183] - iPOJO JMX handler doesn't re-throw exceptions - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-828] - iPOJO JMX Handler: the name attribute has not the expected behavior - * [FELIX-829] - iPOJO JMX Handler: the sub-element should refer to the handler namespace - -Version 1.0.0 -------------- - * Initial release diff --git a/ipojo/handler/jmx/jmx-handler-it/pom.xml b/ipojo/handler/jmx/jmx-handler-it/pom.xml deleted file mode 100644 index e9148f5cfd..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/pom.xml +++ /dev/null @@ -1,389 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - - 4.0.0 - pom - Apache Felix iPOJO JMX Handler - Integration Test - org.apache.felix.ipojo.handler.jmx-it - 1.5.0-SNAPSHOT - - - 3.0.0 - 1.5.1 - - - - - - org.apache.felix - org.apache.felix.ipojo.handler.jmx - ${project.version} - - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo - 1.8.6 - test - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.0 - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - - - - junit - junit - 4.13.1 - test - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - - - - - - - test - - true - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - regular - - run - - - - felix - - ${project.build.directory}/regular - - - - - - - - - - test-all - - false - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - equinox-native - - run - - - - equinox - - ${project.build.directory}/equinox-native - - - - - felix-native - - run - - - - felix - - ${project.build.directory}/felix-native - - - - knopflerfish-native - - run - - - - knopflerfish - - ${project.build.directory}/knopflerfish-native - - - - - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - 5.2.0 - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - 3.8.1.v20120830-144521 - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - - diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml deleted file mode 100644 index d07cbcf529..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.handler.jmx-it - 1.5.0-SNAPSHOT - ../../../pom.xml - - - - ipojo-jmx-integration-test - ${project.artifactId} - - - - org.osgi - org.osgi.compendium - 4.2.0 - - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.8.6 - - - - \ No newline at end of file diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java deleted file mode 100644 index a99e0975ea..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponent.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.handler.jmx.components; - -/** - * Simple component that holds an integer. It is exposed as a MBean. - * - * @author Felix Project Team - */ -public class SimpleManagedComponent { - - /** - * The integer. - */ - private int m_integer /*= new Random().nextInt()*/; - - /** - * Set the value of the integer. - * @param newValue the new value - * @return the old value of the integer. - */ - @SuppressWarnings("unused") - private synchronized int setIntegerValue(int newValue) { - int oldValue = m_integer; - m_integer = newValue; - return oldValue; - } - - /** - * Get the value of the integer. - * @return the currentvalue of the integer. - */ - @SuppressWarnings("unused") - private synchronized int getIntegerValue() { - return m_integer; - } - -} diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java deleted file mode 100644 index 96a5f4fef4..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotated.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.ipojo.handler.jmx.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.jmx.JMXBean; -import org.apache.felix.ipojo.handlers.jmx.JMXMethod; -import org.apache.felix.ipojo.handlers.jmx.JMXProperty; - -import java.util.Random; - -/** - * Simple component that holds an integer. It is exposed as a MBean. This - * version uses the brand new annotations of the JMX handler. - * - * @author Felix Project Team - */ -@Component(immediate = true) -@JMXBean -public class SimpleManagedComponentAnnotated { - - /** - * The integer. - */ - @JMXProperty(name = "integer", rights = "r", notification = true) - private int m_integer = new Random().nextInt();; - - /** - * Set the value of the integer. - * - * @param newValue - * the new value - * @return the old value of the integer. - */ - @SuppressWarnings("unused") - @JMXMethod(description = "Set the value of the integer") - private synchronized int setIntegerValue(int newValue) { - int oldValue = m_integer; - m_integer = newValue; - return oldValue; - } - - /** - * Get the value of the integer. - * - * @return the currentvalue of the integer. - */ - @SuppressWarnings("unused") - @JMXMethod(description = "Get the value of the integer") - private synchronized int getIntegerValue() { - return m_integer; - } -} diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java deleted file mode 100644 index 5720b679d6..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/java/org/apache/felix/ipojo/handler/jmx/components/SimpleManagedComponentAnnotatedDeprecated.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.handler.jmx.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.jmx.Config; -import org.apache.felix.ipojo.handlers.jmx.Method; -import org.apache.felix.ipojo.handlers.jmx.Property; - -import java.util.Random; - - -/** - * Simple component that holds an integer. It is exposed as a MBean. This - * version uses the deprecated annotations of the JMX handler. - * - * @author Felix Project Team - */ -@Component(immediate = true) -@Config -public class SimpleManagedComponentAnnotatedDeprecated { - - /** - * The integer. - */ - @Property(name = "integer", rights = "r", notification = true) - private int m_integer = new Random().nextInt();; - - /** - * Set the value of the integer. - * - * @param newValue - * the new value - * @return the old value of the integer. - */ - @SuppressWarnings("unused") - @Method(description = "Set the value of the integer") - private synchronized int setIntegerValue(int newValue) { - int oldValue = m_integer; - m_integer = newValue; - return oldValue; - } - - /** - * Get the value of the integer. - * - * @return the currentvalue of the integer. - */ - @SuppressWarnings("unused") - @Method(description = "Get the value of the integer") - private synchronized int getIntegerValue() { - return m_integer; - } -} diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml deleted file mode 100644 index ac908abf71..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/main/resources/metadata.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java deleted file mode 100644 index 971fe0c3da..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/Common.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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.ipojo.handler.jmx.test; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.TrueFileFilter; -import org.junit.After; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.options.CompositeOption; -import org.ops4j.pax.exam.options.DefaultCompositeOption; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static junit.framework.Assert.fail; -import static org.ops4j.pax.exam.CoreOptions.*; - -/** - * Bootstrap the test from this project - */ -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerClass.class) -public class Common { - - @Inject - BundleContext bc; - - OSGiHelper osgiHelper; - IPOJOHelper ipojoHelper; - - Bundle testedBundle; - - @Configuration - public Option[] config() throws IOException { - Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - root.setLevel(Level.DEBUG); - - return options( - cleanCaches(), - ipojoBundles(), - junitBundles(), - testedBundle(), - systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN") - ); - } - - public static Option junitAndMockitoBundles() { - return new DefaultCompositeOption( - // Repository required to load harmcrest (OSGi-fied version). - repository("http://repository.springsource.com/maven/bundles/external").id( - "com.springsource.repository.bundles.external"), - - // Hamcrest with a version matching the range expected by Mockito - mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"), - - // Mockito core does not includes Hamcrest - mavenBundle("org.mockito", "mockito-core", "1.9.5"), - - // Objenesis with a version matching the range expected by Mockito - wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2")) - .exports("*;version=1.2"), - - // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of - // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets - // resolved correctly. - CoreOptions.junitBundles(), - - /* - * Felix has implicit boot delegation enabled by default. It conflicts with Mockito: - * java.lang.LinkageError: loader constraint violation in interface itable initialization: - * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc - * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader - * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class, - * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader - * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface - * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/ - * proxy/Callback used in the signature - * - * So we disable the bootdelegation. this property has no effect on the other OSGi implementation. - */ - frameworkProperty("felix.bootdelegation.implicit").value("false") - ); - } - - @Before - public void commonSetUp() { - osgiHelper = new OSGiHelper(bc); - ipojoHelper = new IPOJOHelper(bc); - - testedBundle = osgiHelper.getBundle("test.bundle"); - - // Dump OSGi Framework information - String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR); - if (vendor == null) { - vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); - } - String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION); - System.out.println("OSGi Framework : " + vendor + " - " + version); - } - - @After - public void commonTearDown() { - ipojoHelper.dispose(); - osgiHelper.dispose(); - } - - public static CompositeOption ipojoBundles() { - return new DefaultCompositeOption( - mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(), - mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(), - // The tested handler - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.jmx").versionAsInProject() - ); - } - - public Option testedBundle() throws MalformedURLException { - File out = new File("target/tested/bundle.jar"); - - TinyBundle tested = TinyBundles.bundle(); - - // We look inside target/classes to find the class and resources - File classes = new File("target/classes"); - Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); - List services = new ArrayList(); - for (File file : files) { - if (file.isDirectory()) { - // By convention we export of .services and .service package - if (file.getName().endsWith("services") || file.getName().endsWith("service")) { - services.add(file); - } - } else { - // We need to compute the path - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - tested.add(path, file.toURI().toURL()); - System.out.println(file.getName() + " added to " + path); - } - } - - String export = ""; - for (File file : services) { - if (export.length() > 0) { export += ", "; } - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - String packageName = path.replace('/', '.'); - export += packageName; - } - - System.out.println("Exported packages : " + export); - - InputStream inputStream = tested - .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle") - //.set(Constants.IMPORT_PACKAGE, "*") - //.set(Constants.EXPORT_PACKAGE, export) // No export... - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources"))); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the manipulated bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the manipulated bundle"); - } - } - - public void assertContains(String s, String[] arrays, String object) { - for (String suspect : arrays) { - if (object.equals(suspect)) { - return; - } - } - fail("Assertion failed : " + s); - } - - -} diff --git a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java b/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java deleted file mode 100644 index 0e52bf6691..0000000000 --- a/ipojo/handler/jmx/jmx-handler-it/src/it/jmx-it/src/test/java/org/apache/felix/ipojo/handler/jmx/test/TestMBean.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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.ipojo.handler.jmx.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.Bundle; - -import javax.management.*; -import java.lang.management.ManagementFactory; - -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.TestCase.assertEquals; -import static junit.framework.TestCase.assertTrue; - -/** - * Test the good behaviour of the EventAdminHandler. - * - * @author Felix Project Team - */ -public class TestMBean extends Common { - - /** - * The MBean server used to access exposed MBeans. - */ - private MBeanServer m_server; - - /** - * Initialize test. - */ - @Before - public void setUp() { - m_server = ManagementFactory.getPlatformMBeanServer(); - for (Bundle bundle : bc.getBundles()) { - System.out.println(bundle.getSymbolicName() + " - " + bundle.getState()); - } - } - - /** - * Test the MBean exposed by the simple component, defined without - * annotations and with the brand new JMX handler syntax. - */ - @Test - public void testMBeanWithoutAnnotations() throws MalformedObjectNameException, IntrospectionException, InstanceNotFoundException, ListenerNotFoundException, ReflectionException, MBeanException { - // Create an instance of the component - ComponentInstance componentInstance = ipojoHelper - .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent"); - String instanceName = componentInstance.getInstanceName(); - ObjectName objectName = new ObjectName( - "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent,instance=" - + instanceName); - doTest(objectName); - } - - /** - * Test the MBean exposed by the simple component, defined without - * annotations and with the deprecated JMX handler syntax. - */ - @Test - public void testMBeanWithoutAnnotationsDeprecated() throws MalformedObjectNameException, IntrospectionException, InstanceNotFoundException, ListenerNotFoundException, ReflectionException, MBeanException { - // Create an instance of the component - ComponentInstance componentInstance = ipojoHelper - .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentDeprecated"); - String instanceName = componentInstance.getInstanceName(); - ObjectName objectName = new ObjectName( - "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponent,instance=" - + instanceName); - doTest(objectName); - } - - /** - * Test the MBean exposed by the simple component, defined with - * annotations. - */ - @Test - public void testMBeanWithAnnotations() throws MalformedObjectNameException, IntrospectionException, - InstanceNotFoundException, ListenerNotFoundException, - ReflectionException, MBeanException { - // Create an instance of the component - ComponentInstance componentInstance = ipojoHelper - .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotated"); - String instanceName = componentInstance.getInstanceName(); - ObjectName objectName = new ObjectName( - "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotated,instance=" - + instanceName); - doTest(objectName); - } - - /** - * Test the MBean exposed by the simple component, defined with - * annotations. - */ - @Test - public void testMBeanWithAnnotationsDeprecated() throws MalformedObjectNameException, IntrospectionException, - InstanceNotFoundException, ListenerNotFoundException, - ReflectionException, MBeanException { - // Create an instance of the component - ComponentInstance componentInstance = ipojoHelper - .createComponentInstance("org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotatedDeprecated"); - String instanceName = componentInstance.getInstanceName(); - ObjectName objectName = new ObjectName( - "org.apache.felix.ipojo.handler.jmx.components:type=org.apache.felix.ipojo.handler.jmx.components.SimpleManagedComponentAnnotatedDeprecated,instance=" - + instanceName); - doTest(objectName); - } - - /** - * Utility method used to test the MBean with the given objectName. - * - * @param objectName the objectName of the MBean to test. - */ - private void doTest(ObjectName objectName) throws IntrospectionException, InstanceNotFoundException, ReflectionException, MBeanException, ListenerNotFoundException { - - // Get the MBean from the platform MBean server - - MBeanInfo mBeanInfo = m_server.getMBeanInfo(objectName); - ObjectInstance objectInstance = m_server.getObjectInstance(objectName); - assertNotNull(mBeanInfo); - assertNotNull(objectInstance); - // Check that the property is exposed - MBeanAttributeInfo[] attributes = mBeanInfo.getAttributes(); - assertEquals(1, attributes.length); - MBeanAttributeInfo attribute = attributes[0]; - assertEquals("integer", attribute.getName()); - assertEquals("int", attribute.getType()); - assertTrue(attribute.isReadable()); - assertFalse(attribute.isWritable()); - // Check that both methods are exposed - MBeanOperationInfo[] operations = mBeanInfo.getOperations(); - assertEquals(2, operations.length); - MBeanOperationInfo getOperation; - MBeanOperationInfo setOperation; - // Order is not important - if (operations[0].getName().equals("getIntegerValue")) { - getOperation = operations[0]; - setOperation = operations[1]; - } else { - setOperation = operations[0]; - getOperation = operations[1]; - } - // Check the 'get' operation - assertEquals("getIntegerValue", getOperation.getName()); - assertEquals("Get the value of the integer", - getOperation.getDescription()); - assertEquals("int", getOperation.getReturnType()); - MBeanParameterInfo[] getOperationParams = getOperation.getSignature(); - assertEquals(0, getOperationParams.length); - // Check the 'set' operation - assertEquals("setIntegerValue", setOperation.getName()); - assertEquals("Set the value of the integer", - setOperation.getDescription()); - assertEquals("int", setOperation.getReturnType()); - MBeanParameterInfo[] setOperationParams = setOperation.getSignature(); - assertEquals(1, setOperationParams.length); - assertEquals("int", setOperationParams[0].getType()); - // Call the methods and test the result, also test notifications - CustomNotificationListener listener = new CustomNotificationListener(); - m_server.addNotificationListener(objectName, listener, null, null); - int value1 = 123; - int value2 = 456; - m_server.invoke(objectName, "setIntegerValue", new Object[]{value1}, - new String[]{"int"}); - m_server.invoke(objectName, "setIntegerValue", new Object[]{value2}, - new String[]{"int"}); - int result = (Integer) m_server.invoke(objectName, "getIntegerValue", - new Object[0], new String[0]); - assertEquals(value2, result); - m_server.removeNotificationListener(objectName, listener, null, null); - //assertEquals(2, listener.getCount()); - } - - /** - * Custom listener used to count MBean notifications. - * - * @author Felix Project Team - */ - private class CustomNotificationListener implements NotificationListener { - - /** - * Counter for the notifications. - */ - private int m_counter = 0; - - /** - * Notified ! - * - * @param notification the notification - * @param handback ignored - */ - public void handleNotification(Notification notification, - Object handback) { - m_counter++; - } - - /** - * Return the notification count of this listener. - * - * @return the notification count of this listener. - */ - public int getCount() { - return m_counter; - } - } - -} diff --git a/ipojo/handler/jmx/jmx-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/jmx-handler-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/jmx/jmx-handler/changelog.txt b/ipojo/handler/jmx/jmx-handler/changelog.txt deleted file mode 100644 index 87556fcf47..0000000000 --- a/ipojo/handler/jmx/jmx-handler/changelog.txt +++ /dev/null @@ -1,23 +0,0 @@ -Changes from 1.4.0 to 1.6.0 ---------------------------- -** Improvement - * [FELIX-2633] - Rename JMX annotations - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1183] - iPOJO JMX handler doesn't re-throw exceptions - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-828] - iPOJO JMX Handler: the name attribute has not the expected behavior - * [FELIX-829] - iPOJO JMX Handler: the sub-element should refer to the handler namespace - -Version 1.0.0 -------------- - * Initial release diff --git a/ipojo/handler/jmx/jmx-handler/metadata.xml b/ipojo/handler/jmx/jmx-handler/metadata.xml deleted file mode 100644 index 67b6b38900..0000000000 --- a/ipojo/handler/jmx/jmx-handler/metadata.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/handler/jmx/jmx-handler/obr.xml b/ipojo/handler/jmx/jmx-handler/obr.xml deleted file mode 100644 index 310c385099..0000000000 --- a/ipojo/handler/jmx/jmx-handler/obr.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - -

-

-

- - -

-

-

- - \ No newline at end of file diff --git a/ipojo/handler/jmx/jmx-handler/pom.xml b/ipojo/handler/jmx/jmx-handler/pom.xml deleted file mode 100644 index 37636b7759..0000000000 --- a/ipojo/handler/jmx/jmx-handler/pom.xml +++ /dev/null @@ -1,105 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Apache Felix iPOJO JMX Handler - org.apache.felix.ipojo.handler.jmx - 1.5.0-SNAPSHOT - - - iPOJO extension to expose instances as MBean inside a MBean Server. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ipojo-jmx-handler.html - - - - - org.apache.felix - org.apache.felix.ipojo - 1.8.6 - - - - - - org.apache.felix - maven-bundle-plugin - true - 2.3.7 - - - - org.apache.felix.ipojo.handlers.jmx - - - org.osgi.framework;version=1.5, * - - ${project.name} - ${project.artifactId} - The Apache Software Foundation - iPOJO JMX Handler - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/ipojo-jmx-handler.html - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.felix - maven-ipojo-plugin - 1.8.6 - - - - ipojo-bundle - - - metadata.xml - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - diff --git a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/jmx-handler/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java deleted file mode 100644 index d2fe8f28dc..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanImpl.java +++ /dev/null @@ -1,408 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.management.Attribute; -import javax.management.AttributeChangeNotification; -import javax.management.AttributeList; -import javax.management.AttributeNotFoundException; -import javax.management.DynamicMBean; -import javax.management.InvalidAttributeValueException; -import javax.management.MBeanAttributeInfo; -import javax.management.MBeanException; -import javax.management.MBeanInfo; -import javax.management.MBeanNotificationInfo; -import javax.management.MBeanOperationInfo; -import javax.management.Notification; -import javax.management.NotificationBroadcasterSupport; -import javax.management.ReflectionException; -import javax.management.RuntimeOperationsException; - -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.util.Callback; -import org.apache.felix.ipojo.util.Logger; - -/** - * This class implements iPOJO DynamicMBean. it builds the dynamic MBean - * - * @author Felix Project Team - */ -public class DynamicMBeanImpl extends NotificationBroadcasterSupport implements - DynamicMBean { - - /** - * The instance manager. Used to store the InstanceManager instance. - */ - protected final InstanceManager m_instanceManager; - - /** - * The JmxConfigDFieldMap. Stors the data extracted from metadata.xml. - */ - private JmxConfigFieldMap m_configMap; - - /** - * The MBeanInfo. The class storing the MBean Informations. - */ - private MBeanInfo m_mBeanInfo; - - /** - * The class name. Constant storing the name of the class. - */ - private String m_className = this.getClass().getName(); - - /** - * The sequence number. Used to calculate unique id to notification. - */ - private int m_sequenceNumber; - - /** - * Constructor. - * - * @param properties the data extracted from metadat.xml file - * @param instanceManager the InstanceManager instance - */ - public DynamicMBeanImpl(JmxConfigFieldMap properties, - InstanceManager instanceManager) { - m_configMap = properties; - m_instanceManager = instanceManager; - this.buildMBeanInfo(); - } - - /** - * Gets the value of the required attribute. - * - * @param arg0 the name of required attribute - * @throws AttributeNotFoundException if the attribute doesn't exist - * @throws MBeanException if something bad occures - * @throws ReflectionException if something bad occures - * @return the object attribute - */ - public Object getAttribute(String arg0) throws AttributeNotFoundException, - MBeanException, ReflectionException { - PropertyField attribute = m_configMap.getPropertyFromName(arg0); - - if (attribute == null) { - throw new AttributeNotFoundException(arg0 + " not found"); - } else { - return attribute.getValue(); - } - } - - /** - * Gets values of required attributes. - * - * @param attributeNames the names of the required attributes - * @return return the list of the attribute - */ - public AttributeList getAttributes(String[] attributeNames) { - - if (attributeNames == null) { - throw new IllegalArgumentException( - "attributeNames[] cannot be null"); - } - - AttributeList resultList = new AttributeList(); - for (int i = 0; i < attributeNames.length; i++) { - PropertyField propertyField = (PropertyField) m_configMap - .getPropertyFromField((String) attributeNames[i]); - - if (propertyField != null) { - resultList.add(new Attribute(attributeNames[i], propertyField - .getValue())); - } - } - return resultList; - } - - /** - * Returns the MBean Class builded. - * - * @return return MBeanInfo class constructed by buildMBeanInfo - */ - public MBeanInfo getMBeanInfo() { - return m_mBeanInfo; - } - - /** - * Invokes the required method on the targeted POJO. - * - * @param operationName the name of the method called - * @param params the parameters given to the method - * @param signature the determine which method called - * @return the object return by the method - * @throws MBeanException if something bad occures - * @throws ReflectionException if something bad occures - */ - public Object invoke(String operationName, Object[] params, - String[] signature) throws MBeanException, ReflectionException { - - MethodField method = m_configMap.getMethodFromName(operationName, - signature); - if (method != null) { - MethodMetadata methodCall = method.getMethod(); - Callback mc = new Callback(methodCall, m_instanceManager); - try { - return mc.call(params); - } catch (NoSuchMethodException e) { - throw new ReflectionException(e); - } catch (IllegalAccessException e) { - throw new ReflectionException(e); - } catch (InvocationTargetException e) { - throw new MBeanException(e); - } - } else { - throw new ReflectionException(new NoSuchMethodException( - operationName), "Cannot find the operation " + operationName - + " in " + m_className); - } - } - - /** - * Changes specified attribute value. - * - * @param attribute the attribute with new value to be changed - * @throws AttributeNotFoundException if the required attribute was not found - * @throws InvalidAttributeValueException if the value is inccorrect type - * @throws MBeanException if something bad occures - * @throws ReflectionException if something bad occures - */ - public void setAttribute(Attribute attribute) - throws AttributeNotFoundException, InvalidAttributeValueException, - MBeanException, ReflectionException { - - // Check attribute is not null to avoid NullPointerException later on - if (attribute == null) { - throw new RuntimeOperationsException(new IllegalArgumentException( - "Attribute cannot be null"), "Cannot invoke a setter of " - + m_className + " with null attribute"); - } - String name = attribute.getName(); - Object value = attribute.getValue(); - - if (name == null) { - throw new RuntimeOperationsException(new IllegalArgumentException( - "Attribute name cannot be null"), - "Cannot invoke the setter of " + m_className - + " with null attribute name"); - } - // Check for a recognized attribute name and call the corresponding - // setter - // - - PropertyField propertyField = (PropertyField) m_configMap - .getPropertyFromName(name); - if (propertyField == null) { - // unrecognized attribute name: - throw new AttributeNotFoundException("Attribute " + name - + " not found in " + m_className); - } - if (!propertyField.isWritable()) { - throw new InvalidAttributeValueException("Attribute " + name - + " can not be set"); - } - - if (value == null) { - try { - m_instanceManager.onSet(null, propertyField.getField(), null); - } catch (Exception e) { - throw new InvalidAttributeValueException( - "Cannot set attribute " + name + " to null"); - } - } else { // if non null value, make sure it is assignable to the - // attribute -// if (true /* TODO type.class.isAssignableFrom(value.getClass()) */) { - // propertyField.setValue(value); - // setValue(attributeField.getField(),null); - m_instanceManager.onSet(null, propertyField.getField(), value); -// } else { -// throw new InvalidAttributeValueException( -// "Cannot set attribute " + name + " to a " -// + value.getClass().getName() -// + " object, String expected"); -// } - } - - } - - /** - * Changes all the attributes value. - * - * @param attributes the list of attribute value to be changed - * @return the list of new attribute - */ - public AttributeList setAttributes(AttributeList attributes) { - - // Check attributes is not null to avoid NullPointerException later on - if (attributes == null) { - throw new RuntimeOperationsException(new IllegalArgumentException( - "AttributeList attributes cannot be null"), - "Cannot invoke a setter of " + m_className); - } - AttributeList resultList = new AttributeList(); - - // if attributeNames is empty, nothing more to do - if (attributes.isEmpty()) { - return resultList; - } - - // for each attribute, try to set it and add to the result list if - // successful - for (Iterator i = attributes.iterator(); i.hasNext();) { - Attribute attr = (Attribute) i.next(); - try { - setAttribute(attr); - String name = attr.getName(); - Object value = getAttribute(name); - resultList.add(new Attribute(name, value)); - } catch (Exception e) { - e.printStackTrace(); - } - } - return resultList; - } - - /** - * Builds the MBean information on initialization. This - * value doesn't change further. - */ - private void buildMBeanInfo() { - - // generate infos for attributes - MBeanAttributeInfo[] dAttributes = null; - - if (m_configMap == null) { - return; - } - - String dDescription = m_configMap.getDecription(); - - if (m_configMap.getProperties() != null) { - List < MBeanAttributeInfo > lAttributes = null; - lAttributes = new ArrayList < MBeanAttributeInfo >(); - - Iterator < PropertyField > iterator = m_configMap.getProperties() - .iterator(); - while (iterator.hasNext()) { - PropertyField propertyField = iterator.next(); - lAttributes.add(new MBeanAttributeInfo(propertyField.getName(), - propertyField.getType(), propertyField.getDescription(), - propertyField.isReadable(), propertyField.isWritable(), - false)); - } - dAttributes = lAttributes - .toArray(new MBeanAttributeInfo[lAttributes.size()]); - } - - MBeanOperationInfo[] dOperations = null; - if (m_configMap.getMethods() != null) { - - List < MBeanOperationInfo > lOperations = new ArrayList < MBeanOperationInfo >(); - - Iterator < MethodField[] > iterator = m_configMap.getMethods() - .iterator(); - while (iterator.hasNext()) { - MethodField[] method = iterator.next(); - for (int i = 0; i < method.length; i++) { - lOperations.add(new MBeanOperationInfo(method[i].getName(), - method[i].getDescription(), method[i].getParams(), - method[i].getReturnType(), MBeanOperationInfo.UNKNOWN)); - } - dOperations = lOperations - .toArray(new MBeanOperationInfo[lOperations.size()]); - } - } - - MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0]; - if (m_configMap.getMethods() != null) { - - List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >(); - - Iterator < NotificationField > iterator = m_configMap - .getNotifications().iterator(); - while (iterator.hasNext()) { - NotificationField notification = iterator - .next(); - lNotifications.add(notification.getNotificationInfo()); - } - dNotification = lNotifications - .toArray(new MBeanNotificationInfo[lNotifications.size()]); - } - - m_mBeanInfo = new MBeanInfo(this.m_className, dDescription, - dAttributes, null, // No constructor - dOperations, dNotification); - } - - /** - * Gets the notification informations (use by JMX). - * - * @return the structure which describe the notifications - */ - public MBeanNotificationInfo[] getNotificationInfo() { - MBeanNotificationInfo[] dNotification = new MBeanNotificationInfo[0]; - if (m_configMap.getMethods() != null) { - - List < MBeanNotificationInfo > lNotifications = new ArrayList < MBeanNotificationInfo >(); - - Iterator < NotificationField > iterator = m_configMap - .getNotifications().iterator(); - while (iterator.hasNext()) { - NotificationField notification = iterator - .next(); - lNotifications.add(notification.getNotificationInfo()); - } - dNotification = lNotifications - .toArray(new MBeanNotificationInfo[lNotifications.size()]); - } - return dNotification; - } - - /** - * Sends a notification to a subscriber. - * - * @param msg the msg to send - * @param attributeName the name of the attribute - * @param attributeType the type of the attribute - * @param oldValue the old value of the attribute - * @param newValue the new value of the attribute - */ - public void sendNotification(String msg, String attributeName, - String attributeType, Object oldValue, Object newValue) { - - long timeStamp = System.currentTimeMillis(); - - if ((newValue == null && oldValue == null) - || (newValue != null && newValue.equals(oldValue))) { - return; - } - m_sequenceNumber++; - Notification notification = new AttributeChangeNotification(this, - m_sequenceNumber, timeStamp, msg, attributeName, attributeType, - oldValue, newValue); - sendNotification(notification); - m_instanceManager.getFactory().getLogger().log(Logger.INFO, - "Notification sent"); - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java deleted file mode 100644 index c3c9dd36af..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/DynamicMBeanWRegisterImpl.java +++ /dev/null @@ -1,165 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.reflect.InvocationTargetException; - -import javax.management.MBeanRegistration; -import javax.management.MBeanServer; -import javax.management.ObjectName; - -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.util.Callback; - -/** - * This class implements a 'wide' iPOJO DynamicMBean that can perform actions - * before and after its registration and deregistration. - * - * @author Felix Project Team - */ -public class DynamicMBeanWRegisterImpl extends DynamicMBeanImpl implements - MBeanRegistration { - - /** - * The preRegister method of MBeanRegistration interface. - */ - private MethodMetadata m_preRegisterMeth; - /** - * The postRegister method of MBeanRegistration interface. - */ - private MethodMetadata m_postRegisterMeth; - /** - * The preDeregister method of MBeanRegistration interface. - */ - private MethodMetadata m_preDeregisterMeth; - /** - * The postDeregister method of MBeanRegistration interface. - */ - private MethodMetadata m_postDeregisterMeth; - /** - * The effective name of the MBean. - */ - private ObjectName m_objName; - - /** - * Constructs a new DynamicMBeanWRegisterImpl. - * - * @param properties the data extracted from the metadata.xml - * @param instanceManager the instance manager - * @param preRegisterMeth the method to call before MBean registration - * @param postRegisterMeth the method to call after MBean registration - * @param preDeregisterMeth the method to call before MBean deregistration - * @param postDeregisterMeth the method to call after MBean registration - */ - public DynamicMBeanWRegisterImpl(JmxConfigFieldMap properties, - InstanceManager instanceManager, MethodMetadata preRegisterMeth, - MethodMetadata postRegisterMeth, MethodMetadata preDeregisterMeth, - MethodMetadata postDeregisterMeth) { - super(properties, instanceManager); - - m_preRegisterMeth = preRegisterMeth; - m_postRegisterMeth = postRegisterMeth; - m_preDeregisterMeth = preDeregisterMeth; - m_postDeregisterMeth = postDeregisterMeth; - } - - /** - * Returns the MBean name used to register it. - * - * @return the MBean name used to register it. - */ - public ObjectName getObjectName() { - return m_objName; - } - - /** - * This method is executed before the MBean registration. - * - * @param server the server on which the MBean will be registered - * @param name the name of the MBean to expose - * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException. - * @return the name with which the MBean will be registered - */ - public ObjectName preRegister(MBeanServer server, ObjectName name) - throws Exception { - m_objName = (ObjectName) callMethod(m_preRegisterMeth, - MBeanHandler.PRE_REGISTER_METH_NAME, new Object[] { server, name }); - return m_objName; - } - - /** - * This method is executed after the MBean registration. - * - * @param registrationDone indicates whether or not the MBean has been successfully registered in the MBean server. - */ - public void postRegister(Boolean registrationDone) { - callMethod(m_postRegisterMeth, MBeanHandler.POST_REGISTER_METH_NAME, - new Object[] { registrationDone }); - } - - /** - * This method is before after the MBean deregistration. - * - * @throws Exception This exception will be caught by the MBean server and re-thrown as an MBeanRegistrationException. - */ - public void preDeregister() throws Exception { - callMethod(m_preDeregisterMeth, MBeanHandler.PRE_DEREGISTER_METH_NAME, - null); - } - - /** - * This method is executed after the MBean deregistration. - */ - public void postDeregister() { - callMethod(m_postDeregisterMeth, - MBeanHandler.POST_DEREGISTER_METH_NAME, null); - } - - /** - * Private method used to execute a given callback. - * - * @param methodMetadata the metadata description of the callback - * @param methodName the name of the callback - * @param params the parameters of the callback - * @return the object eventually returned by the callback, or null if nothing's returned - */ - private Object callMethod(MethodMetadata methodMetadata, String methodName, - Object[] params) { - Callback mc = new Callback(methodMetadata, m_instanceManager); - try { - if ((params == null) || (params.length == 0)) { - return mc.call(); - } else { - return mc.call(params); - } - } catch (NoSuchMethodException e) { - // should never happen : method exists - System.err.println("No such method : " + methodName); - e.printStackTrace(); - } catch (IllegalAccessException e) { - System.err.println("Illegal Access Exception"); - e.printStackTrace(); - } catch (InvocationTargetException e) { - System.err.println("Invocation Target Exception"); - e.printStackTrace(); - } - return null; - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java deleted file mode 100644 index a5b19559b4..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXHandlerDescription.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Description of the JMX handler. - * - * @author Felix Project Team - */ -public class JMXHandlerDescription extends HandlerDescription { - - /** - * The referenced handler. - */ - private MBeanHandler m_handler; - - /** - * Constructs a new handler description for the given handler. - * - * @param handler the handler to describe - */ - public JMXHandlerDescription(MBeanHandler handler) { - super(handler); - m_handler = handler; - } - - /** - * Gets handler information. - * - * @return the handler information. - */ - public Element getHandlerInfo() { - Element elem = super.getHandlerInfo(); - elem.addAttribute(new Attribute("registered", Boolean - .toString(m_handler.isRegistered()))); - elem.addAttribute(new Attribute("objectName", m_handler - .getUsedObjectName())); - if (m_handler.isUsesMOSGi()) { - String foundStr = null; - - if (m_handler.isMOSGiExists()) { - foundStr = "found"; - } else { - foundStr = "not_found"; - } - elem.addAttribute(new Attribute("mosgi", foundStr)); - } - - return elem; - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java deleted file mode 100644 index 56f436a83d..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/JmxConfigFieldMap.java +++ /dev/null @@ -1,297 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; - -/** - * JmxConfigFieldMap : use to store the informations needed to build the Dynamic - * MBean. - * - * @author Felix Project Team - */ -public class JmxConfigFieldMap { - - /** - * The exposed attributes. - */ - private Map < String, PropertyField > m_properties = new HashMap < String, PropertyField >(); - /** - * The exposed methods. - */ - private Map < String, MethodField[] > m_methods = new HashMap < String, MethodField[] >(); - /** - * The allowed notifications. - */ - private Map < String, NotificationField > m_notifications = new HashMap < String, NotificationField >(); - /** - * The description of the Mbean. - */ - private String m_description; - - /** - * Constructor. - */ - public JmxConfigFieldMap() { - - } - - /** - * Gets the description of the MBean. - * - * @return the description of the MBean - */ - public String getDecription() { - return m_description; - } - - /** - * Sets the description of the MBean. - * - * @param description a String which describes the Mbean - */ - public void setDescription(String description) { - this.m_description = description; - } - - /** - * Adds a new attribute exposed in the Mbean. - * - * @param name the name of the new property - * @param propertyField the field which describes the property - */ - public void addPropertyFromName(String name, PropertyField propertyField) { - m_properties.put(name, propertyField); - } - - /** - * Gets all of the properties exposed. - * - * @return the collection of all properties - */ - public Collection < PropertyField > getProperties() { - if (m_properties != null) { - return m_properties.values(); - } else { - return null; - } - } - - /** - * Gets the property by the name. - * - * @param name the name of the required property - * @return the field required or null if is not found - */ - public PropertyField getPropertyFromName(String name) { - PropertyField prop = m_properties.get(name); - return prop; - } - - /** - * Gets the property by the field. - * - * @param field the required field - * @return the property by the field - */ - public PropertyField getPropertyFromField(String field) { - PropertyField property = null; - Iterator < PropertyField > it = m_properties.values().iterator(); - while (it.hasNext()) { - PropertyField p = it.next(); - if (p.getField().compareTo(field) == 0) { - if (property != null) { - System.err.println("a field already exists"); - } else { - property = p; - } - } - } - return property; - } - - /** - * Adds a new method descriptor from its name. - * - * @param name the name of the method - * @param methodField the description of the method - */ - public void addMethodFromName(String name, MethodField methodField) { - MethodField[] mf; - if (!m_methods.containsKey(name)) { - mf = new MethodField[1]; - mf[0] = methodField; - } else { - MethodField[] temp = m_methods.get(name); - mf = new MethodField[temp.length + 1]; - for (int i = 0; i < temp.length; i++) { - mf[i] = temp[i]; - } - mf[temp.length] = methodField; - } - m_methods.put(name, mf); - } - - /** - * Adds new methods descriptors from one name. (the method must have the same name but different signature). - * - * @param name the name of the method - * @param methodsField the description of the methods - */ - public void addMethodFromName(String name, MethodField[] methodsField) { - MethodField[] mf; - if (!m_methods.containsKey(name)) { - mf = methodsField; - } else { - MethodField[] temp = m_methods.get(name); - mf = new MethodField[temp.length + methodsField.length]; - for (int i = 0; i < temp.length; i++) { - mf[i] = temp[i]; - } - for (int i = 0; i < methodsField.length; i++) { - mf[i + temp.length] = methodsField[i]; - } - } - m_methods.put(name, mf); - } - - /** - * Adds a method from name and erases the older if exists. - * - * @param name the name of the method - * @param methodField the method to be added - */ - public void overrideMethodFromName(String name, MethodField methodField) { - MethodField[] mf = new MethodField[1]; - mf[0] = methodField; - m_methods.put(name, mf); - } - - /** - * Add methods from name and erases the olders if exists. - * - * @param name the name of the method - * @param methodsField the array of methods to be added - */ - public void overrideMethodFromName(String name, MethodField[] methodsField) { - m_methods.put(name, methodsField); - } - - /** - * Returns the method(s) with the given name. - * - * @param name the name of the methods - * @return the list of methods with the given name - */ - public MethodField[] getMethodFromName(String name) { - MethodField[] prop = m_methods.get(name); - return prop; - } - - /** - * Gets the method with the good signature. - * - * @param operationName the name of the method requiered - * @param signature the required signature - * @return the method which the same signature or null if not found - */ - public MethodField getMethodFromName(String operationName, - String[] signature) { - MethodField[] methods = m_methods.get(operationName); - for (int i = 0; i < methods.length; i++) { - if (isSameSignature(signature, methods[i].getSignature())) { - return methods[i]; - } - } - return null; - } - - /** - * Compares two method signature. - * - * @param sig1 the first signature - * @param sig2 the second signature - * @return true if the signature are similar false otherwise - */ - private boolean isSameSignature(String[] sig1, String[] sig2) { - if (sig1.length != sig2.length) { - return false; - } else { - for (int i = 0; i < sig1.length; i++) { - if (!sig1[i].equals(sig2[i])) { - return false; - } - } - - } - return true; - } - - /** - * Returns all methods store. - * - * @return the collection of methodField[] - */ - public Collection < MethodField[] > getMethods() { - if (m_methods != null) { - return m_methods.values(); - } else { - return null; - } - } - - /** - * Adds a notification. - * - * @param name the name of the notification - * @param notificationField the field involved with the notification. - */ - public void addNotificationFromName(String name, - NotificationField notificationField) { - m_notifications.put(name, notificationField); - } - - /** - * Returns the notification with the given name. - * - * @param name the name of the notification to return - * @return the notification if it exists, {@code null} otherwise - */ - public NotificationField getNotificationFromName(String name) { - NotificationField prop = m_notifications.get(name); - return prop; - } - - /** - * Gets all notifications defined. - * - * @return the collection of NotificationField - */ - public Collection < NotificationField > getNotifications() { - if (m_notifications != null) { - return m_notifications.values(); - } else { - return null; - } - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java deleted file mode 100644 index 2258b0e38d..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MBeanHandler.java +++ /dev/null @@ -1,664 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.management.ManagementFactory; -import java.util.*; - -import javax.management.MBeanRegistration; -import javax.management.MBeanServer; -import javax.management.ObjectInstance; -import javax.management.ObjectName; - -import org.apache.felix.ipojo.FieldInterceptor; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.FieldMetadata; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.parser.PojoMetadata; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -/** - * This class implements iPOJO Handler. it builds the dynamic MBean from - * metadata.xml and exposes it to the MBean Server. - * - * @author Felix Project Team - */ -public class MBeanHandler extends PrimitiveHandler { - - /** - * The name of the MBeanRegistration postDeregister method. - */ - public static final String POST_DEREGISTER_METH_NAME = "postDeregister"; - - /** - * The name of the MBeanRegistration preDeregister method. - */ - public static final String PRE_DEREGISTER_METH_NAME = "preDeregister"; - - /** - * The name of the MBeanRegistration postRegister method. - */ - public static final String POST_REGISTER_METH_NAME = "postRegister"; - - /** - * The name of the MBeanRegistration preRegister method. - */ - public static final String PRE_REGISTER_METH_NAME = "preRegister"; - - /** - * The name of the global configuration element. - */ - private static final String JMX_CONFIG_ELT = "config"; - - /** - * The name of the global configuration element. - */ - private static final String JMX_CONFIG_ALT_ELT = "JmxBean"; - - /** - * The name of the component object full name attribute. - */ - private static final String JMX_OBJ_NAME_ELT = "objectName"; - - /** - * The name of the component object name domain attribute. - */ - private static final String JMX_OBJ_NAME_DOMAIN_ELT = "domain"; - - /** - * The name of the component object name attribute. - */ - private static final String JMX_OBJ_NAME_WO_DOMAIN_ELT = "name"; - - /** - * The name of the attribute indicating if the handler uses MOSGi MBean server. - */ - private static final String JMX_USES_MOSGI_ELT = "usesMOSGi"; - - /** - * The name of a method element. - */ - private static final String JMX_METHOD_ELT = "method"; - - /** - * The alternative name of a method element. - */ - private static final String JMX_METHOD_ELT_ALT = "JmxMethod"; - - /** - * The name of the property or method name attribute. - */ - private static final String JMX_NAME_ELT = "name"; - - /** - * The name of a method description attribute. - */ - private static final String JMX_DESCRIPTION_ELT = "description"; - - /** - * The name of a property element. - */ - private static final String JMX_PROPERTY_ELT = "property"; - - /** - * The alternative name of a property element. - */ - private static final String JMX_PROPERTY_ELT_ALT = "JmxProperty"; - - /** - * The name of the field attribute. - */ - private static final String JMX_FIELD_ELT = "field"; - - /** - * The name of the notification attribute. - */ - private static final String JMX_NOTIFICATION_ELT = "notification"; - - /** - * The name of the rights attribute. - */ - private static final String JMX_RIGHTS_ELT = "rights"; - - /** - * The instance manager. Used to store the InstanceManager instance. - */ - private InstanceManager m_instanceManager; - /** - * The service registration. Used to register and unregister the Dynamic MBean. - */ - private ServiceRegistration m_serviceRegistration; - /** - * Stores data when parsing metadata.xml. - */ - private JmxConfigFieldMap m_jmxConfigFieldMap; - /** - * Stores the Dynamic MBean. - */ - private DynamicMBeanImpl m_MBean; - /** - * Constant storing the name of the class. - */ - private String m_namespace = "org.apache.felix.ipojo.handlers.jmx"; - /** - * The flag used to inform if we use the MOSGi framework. - */ - private boolean m_usesMOSGi; - /** - * The ObjectName used to register the MBean. - */ - private ObjectName m_objectName; - /** - * The flag used to inform if the MBean is registered. - */ - private boolean m_registered; - /** - * The ObjectName specified in handler configuration. It can be null. - */ - private String m_completeObjNameElt; - /** - * The ObjectName without domain specified in handler configuration. It can be null. - */ - private String m_objNameWODomainElt; - - /** - * The ObjectName domain specified in handler configuration. It can be null. - */ - private String m_domainElt; - /** - * The flag informing if the POJO implements the MBeanRegistration interface. - */ - private boolean m_registerCallbacks; - /** - * The preRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface. - */ - private MethodMetadata m_preRegisterMeth; - /** - * The postRegister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface. - */ - private MethodMetadata m_postRegisterMeth; - /** - * The preDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface. - */ - private MethodMetadata m_preDeregisterMeth; - /** - * The postDeregister method of MBeanRegistration interface. It is null if POJO doesn't implement MBeanRegistration interface. - */ - private MethodMetadata m_postDeregisterMeth; - - /** - * Constructs the structure JmxConfigFieldMap and the Dynamic Mbean. - * - * @param metadata the component metadata - * @param dict the instance configuration - */ - public void configure(Element metadata, Dictionary dict) { - - PojoMetadata manipulation = getPojoMetadata(); - - m_instanceManager = getInstanceManager(); - - m_jmxConfigFieldMap = new JmxConfigFieldMap(); - - // Build the hashmap - Element[] mbeans = metadata.getElements(JMX_CONFIG_ELT, m_namespace); - if (mbeans == null || mbeans.length == 0) { - mbeans = metadata.getElements(JMX_CONFIG_ALT_ELT, m_namespace); - } - - if (mbeans.length != 1) { - error("A component must have exactly one " + JMX_CONFIG_ELT + " or " + JMX_CONFIG_ALT_ELT + " element."); - error("The JMX handler configuration is ignored."); - return; - } - - Element mbean = mbeans[0]; - - // retrieve kind of MBeanServer to use - m_usesMOSGi = Boolean.parseBoolean(mbean.getAttribute(JMX_USES_MOSGI_ELT)); - - // retrieve object name - m_completeObjNameElt = mbean.getAttribute(JMX_OBJ_NAME_ELT); - m_domainElt = mbean.getAttribute(JMX_OBJ_NAME_DOMAIN_ELT); - m_objNameWODomainElt = mbean.getAttribute(JMX_OBJ_NAME_WO_DOMAIN_ELT); - - // test if Pojo is interested in registration callbacks - m_registerCallbacks = manipulation - .isInterfaceImplemented(MBeanRegistration.class.getName()); - if (m_registerCallbacks) { - // don't need to check that methods exist, the pojo implements - // MBeanRegistration interface - String[] preRegisterParams = { MBeanServer.class.getName(), - ObjectName.class.getName() }; - m_preRegisterMeth = manipulation.getMethod(PRE_REGISTER_METH_NAME, - preRegisterParams); - - String[] postRegisterParams = { Boolean.class.getName() }; - m_postRegisterMeth = manipulation.getMethod( - POST_REGISTER_METH_NAME, postRegisterParams); - - m_preDeregisterMeth = manipulation.getMethod( - PRE_DEREGISTER_METH_NAME, new String[0]); - - m_postDeregisterMeth = manipulation.getMethod( - POST_DEREGISTER_METH_NAME, new String[0]); - } - - // set property - Element[] attributes = mbean.getElements(JMX_PROPERTY_ELT, m_namespace); - Element[] attributesAlt = mbean.getElements(JMX_PROPERTY_ELT_ALT, m_namespace); - List listOfAttributes = new ArrayList(); - if (attributes != null) { - listOfAttributes.addAll(Arrays.asList(attributes)); - } - if (attributesAlt != null) { - listOfAttributes.addAll(Arrays.asList(attributesAlt)); - } - - Element[] attributesOld = mbeans[0].getElements(JMX_PROPERTY_ELT); - if (attributesOld != null) { - warn("The JMX property element should use the '" + m_namespace + "' namespace."); - listOfAttributes.addAll(Arrays.asList(attributesOld)); - } - - for (Element attribute : listOfAttributes) { - boolean notif = false; - String rights; - String name; - String field = attribute.getAttribute(JMX_FIELD_ELT); - - if (attribute.containsAttribute(JMX_NAME_ELT)) { - name = attribute.getAttribute(JMX_NAME_ELT); - } else { - name = field; - } - if (attribute.containsAttribute(JMX_RIGHTS_ELT)) { - rights = attribute.getAttribute(JMX_RIGHTS_ELT); - } else { - rights = "r"; - } - - PropertyField property = new PropertyField(name, field, rights, - getTypeFromAttributeField(field, manipulation)); - - if (attribute.containsAttribute(JMX_NOTIFICATION_ELT)) { - notif = Boolean.parseBoolean(attribute - .getAttribute(JMX_NOTIFICATION_ELT)); - } - - property.setNotifiable(notif); - - if (notif) { - // add the new notifiable property in structure - NotificationField notification = new NotificationField( - name, this.getClass().getName() + "." + field, null); - m_jmxConfigFieldMap.addNotificationFromName(name, - notification); - } - m_jmxConfigFieldMap.addPropertyFromName(name, property); - getInstanceManager().register(manipulation.getField(field), - this); - info("property exposed:" + name + " " + field + ":" - + getTypeFromAttributeField(field, manipulation) + " " - + rights + ", Notif=" + notif); - } - - // set methods - Element[] methods = mbean.getElements(JMX_METHOD_ELT, m_namespace); - Element[] methodsAlt = mbean.getElements(JMX_METHOD_ELT_ALT, m_namespace); - List listOfMethods = new ArrayList(); - if (methods != null) { - listOfMethods.addAll(Arrays.asList(methods)); - } - if (methodsAlt != null) { - listOfMethods.addAll(Arrays.asList(methodsAlt)); - } - - Element[] methodsOld = mbeans[0].getElements(JMX_PROPERTY_ELT); - if (methodsOld != null) { - warn("The JMX method element should use the '" + m_namespace + "' namespace."); - listOfMethods.addAll(Arrays.asList(methodsOld)); - } - - for (Element method : listOfMethods) { - String name = method.getAttribute(JMX_NAME_ELT); - if (name == null) { - name = method.getAttribute("method"); - } - String description = null; - if (method.containsAttribute(JMX_DESCRIPTION_ELT)) { - description = method.getAttribute(JMX_DESCRIPTION_ELT); - } - - MethodField[] meth = getMethodsFromName(name, manipulation, - description); - - for (int j = 0; j < meth.length; j++) { - m_jmxConfigFieldMap.addMethodFromName(name, meth[j]); - - info("method exposed:" + meth[j].getReturnType() + " " + name); - } - } - - } - - /** - * Registers the Dynamic Mbean. - */ - public void start() { - // create the corresponding MBean - if (m_registerCallbacks) { - m_MBean = new DynamicMBeanWRegisterImpl(m_jmxConfigFieldMap, - m_instanceManager, m_preRegisterMeth, m_postRegisterMeth, - m_preDeregisterMeth, m_postDeregisterMeth); - } else { - m_MBean = new DynamicMBeanImpl(m_jmxConfigFieldMap, - m_instanceManager); - } - - if (m_usesMOSGi) { - // use whiteboard pattern to register MBean - - if (m_serviceRegistration != null) { - m_serviceRegistration.unregister(); - } - - // Register the ManagedService - BundleContext bundleContext = m_instanceManager.getContext(); - Dictionary properties = new Hashtable(); - try { - m_objectName = new ObjectName(getObjectNameString()); - - properties.put("jmxagent.objectName", m_objectName.toString()); - - m_serviceRegistration = bundleContext.registerService( - javax.management.DynamicMBean.class.getName(), m_MBean, - properties); - - m_registered = true; - } catch (Exception e) { - e.printStackTrace(); - } - } else { - try { - m_objectName = new ObjectName(getObjectNameString()); - ObjectInstance instance = ManagementFactory - .getPlatformMBeanServer().registerMBean(m_MBean, - m_objectName); - - // we must retrieve object name used to register the MBean. - // It can have been changed by preRegister method of - // MBeanRegistration interface. - if (m_registerCallbacks) { - m_objectName = instance.getObjectName(); - } - - m_registered = true; - } catch (Exception e) { - error("Registration of MBean failed.", e); - } - } - } - - /** - * Returns the object name of the exposed component. - * - * @return the object name of the exposed component. - */ - private String getObjectNameString() { - if (m_completeObjNameElt != null) { - return m_completeObjNameElt; - } - - String domain; - if (m_domainElt != null) { - domain = m_domainElt; - } else { - domain = getPackageName(m_instanceManager.getClassName()); - } - - String name = "type=" + m_instanceManager.getClassName() + ",instance=" - + m_instanceManager.getInstanceName(); - if (m_objNameWODomainElt != null) { - name = "name=" + m_objNameWODomainElt; - } - - StringBuffer sb = new StringBuffer(); - if ((domain != null) && (domain.length() > 0)) { - sb.append(domain + ":"); - } - sb.append(name); - - info("Computed Objectname: " + sb.toString()); - - return sb.toString(); - } - - /** - * Extracts the package name from of given type. - * - * @param className the type name. - * @return the package name of the given type. - */ - private String getPackageName(String className) { - String packageName = ""; - - int plotIdx = className.lastIndexOf("."); - if (plotIdx != -1) { - packageName = className.substring(0, plotIdx); - } - - return packageName; - } - - /** - * Unregisters the Dynamic Mbean. - */ - public void stop() { - if (m_usesMOSGi) { - if (m_serviceRegistration != null) { - m_serviceRegistration.unregister(); - } - } else { - if (m_objectName != null) { - try { - ManagementFactory.getPlatformMBeanServer().unregisterMBean( - m_objectName); - } catch (Exception e) { - error("Unregistration of MBean failed.", e); - } - m_objectName = null; - } - } - - m_MBean = null; - m_registered = false; - } - - /** - * Called when a POJO member is modified externally. - * - * @param pojo the modified POJO object - * @param fieldName the name of the modified field - * @param value the new value of the field - * @see FieldInterceptor#onSet(Object, String, Object) - */ - public void onSet(Object pojo, String fieldName, Object value) { - // Check if the field is a configurable property - - PropertyField propertyField = (PropertyField) m_jmxConfigFieldMap - .getPropertyFromField(fieldName); - if (propertyField != null) { - if (propertyField.isNotifiable()) { - // TODO should send notif only when value has changed to a value - // different than the last one. - m_MBean.sendNotification(propertyField.getName() + " changed", - propertyField.getName(), propertyField.getType(), - propertyField.getValue(), value); - } - propertyField.setValue(value); - } - } - - /** - * Called when a POJO member is read by the MBean. - * - * @param pojo the read POJO object. - * @param fieldName the name of the modified field - * @param value the old value of the field - * @return the (injected) value of the field - * @see FieldInterceptor#onGet(Object, String, Object) - */ - public Object onGet(Object pojo, String fieldName, Object value) { - - // Check if the field is a configurable property - PropertyField propertyField = (PropertyField) m_jmxConfigFieldMap - .getPropertyFromField(fieldName); - if (propertyField != null) { - // Do we have a value to inject ? - Object v = propertyField.getValue(); - if (v == null) { - String type = propertyField.getType(); - if ("boolean".equals(type)) { v = Boolean.FALSE; } - else if ("byte".equals(type)) { v = new Byte((byte) 0); } - else if ("short".equals(type)) { v = new Short((short) 0); } - else if ("int".equals(type)) { v = new Integer(0); } - else if ("long".equals(type)) { v = new Long(0); } - else if ("float".equals(type)) { v = new Float(0); } - else if ("double".equals(type)) { v =new Double(0); } - else if ("char".equals(type)) { v = new Character((char) 0); } - - return v; - } - m_instanceManager.onSet(pojo, fieldName, propertyField.getValue()); - return propertyField.getValue(); - } - return value; - } - - /** - * Gets the type from a field name. - * - * @param fieldRequire the name of the required field - * @param manipulation the metadata extracted from metadata.xml file - * @return the type of the field or {@code null} if it wasn't found - */ - private static String getTypeFromAttributeField(String fieldRequire, - PojoMetadata manipulation) { - - FieldMetadata field = manipulation.getField(fieldRequire); - if (field == null) { - return null; - } else { - return FieldMetadata.getReflectionType(field.getFieldType()); - } - } - - /** - * Gets all the methods available which get this name. - * - * @param methodName the name of the required methods - * @param manipulation the metadata extract from metadata.xml file - * @param description the description which appears in JMX console - * @return the array of methods with the right name - */ - private MethodField[] getMethodsFromName(String methodName, - PojoMetadata manipulation, String description) { - - MethodMetadata[] methods = manipulation.getMethods(methodName); - if (methods.length == 0) { - return null; - } - - MethodField[] ret = new MethodField[methods.length]; - - if (methods.length == 1) { - ret[0] = new MethodField(methods[0], description); - return ret; - } else { - for (int i = 0; i < methods.length; i++) { - ret[i] = new MethodField(methods[i], description); - } - return ret; - } - } - - /** - * Gets the JMX handler description. - * - * @return the JMX handler description. - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public HandlerDescription getDescription() { - return new JMXHandlerDescription(this); - } - - /** - * Returns the objectName used to register the MBean. If the MBean is not registered, return an empty string. - * - * @return the objectName used to register the MBean. - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public String getUsedObjectName() { - if (m_objectName != null) { - return m_objectName.toString(); - } else { - return ""; - } - } - - /** - * Returns true if the MBean is registered. - * - * @return true if the MBean is registered. - */ - public boolean isRegistered() { - return m_registered; - } - - /** - * Returns true if the MBean must be registered thanks to white board pattern of MOSGi. - * - * @return {@code true} if the MBean must be registered thanks to white board pattern of MOSGi, false otherwise. - */ - public boolean isUsesMOSGi() { - return m_usesMOSGi; - } - - /** - * Returns true if the MOSGi framework is present on the OSGi platform. - * - * @return {@code true} if the MOSGi framework is present on the OSGi platform, false otherwise. - */ - public boolean isMOSGiExists() { - for (Bundle bundle : m_instanceManager.getContext().getBundles()) { - String symbolicName = bundle.getSymbolicName(); - if ("org.apache.felix.mosgi.jmx.agent".equals(symbolicName)) { - return true; - } - } - - return false; - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java deleted file mode 100644 index 6ef5b47276..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/MethodField.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import javax.management.MBeanParameterInfo; - -import org.apache.felix.ipojo.parser.MethodMetadata; - -/** - * This class builds a method JMX description. - * - * @author Felix Project Team - */ -public class MethodField { - - /** - * Stores the method description. - */ - private String m_description; - /** - * Stores the method properties. - */ - private MethodMetadata m_method; - - /** - * Constructor. - * - * @param method the method properties - * @param description the method description - */ - public MethodField(MethodMetadata method, String description) { - this.m_method = method; - this.m_description = description; - - } - - /** - * Gets the method. - * @return the method - */ - public MethodMetadata getMethod() { - return m_method; - } - - /** - * Gets the description. - * @return the description - */ - public String getDescription() { - return m_description; - } - - /** - * Gets the name. - * @return the name - */ - public String getName() { - return m_method.getMethodName(); - } - - /** - * Gets the parameter in JMX format. - * - * @return info on JMX format - */ - public MBeanParameterInfo[] getParams() { - MBeanParameterInfo[] mbean = new MBeanParameterInfo[m_method - .getMethodArguments().length]; - for (int i = 0; i < m_method.getMethodArguments().length; i++) { - mbean[i] = new MBeanParameterInfo("arg" + i, m_method - .getMethodArguments()[i], null); - } - return mbean; - } - - public String[] getSignature() { - return m_method.getMethodArguments(); - } - - public String getReturnType() { - return m_method.getMethodReturn(); - } - -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java deleted file mode 100644 index ac541c42b1..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/NotificationField.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import javax.management.MBeanNotificationInfo; - -/** - * This class builds the notification description structure. - * - * @author Felix Project Team - */ -public class NotificationField { - /** - * The name of the notification. - */ - private String m_name; - /** - * The description of the notification. - */ - private String m_description; - /** - * The field of the notification. - */ - private String m_field; - - /** - * Constructor. - * - * @param name the name of the notification - * @param field the field which send a notification when it is modified - * @param description the description which appears in JMX console - */ - - public NotificationField(String name, String field, String description) { - this.m_name = name; - this.m_field = field; - this.m_description = description; - } - - /** - * Returns the MBeanNotificationInfo from this class. - * - * @return the type of the field or {@code null} if it wasn't found - */ - public MBeanNotificationInfo getNotificationInfo() { - String[] notificationTypes = new String[1]; - notificationTypes[0] = m_field; - MBeanNotificationInfo mbni = new MBeanNotificationInfo( - notificationTypes, m_name, m_description); - return mbni; - } -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java b/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java deleted file mode 100644 index 0712733942..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/java/org/apache/felix/ipojo/handlers/jmx/PropertyField.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -/** - * This class build the notification description structure. - * - * @author Felix Project Team - */ -public class PropertyField { - - /** - * The name of the notification. - */ - private String m_name; - /** - * The name of the notification. - */ - private String m_field; - /** - * The name of the notification. - */ - private String m_rights; - /** - * The name of the notification. - */ - private String m_type; - /** - * The name of the notification. - */ - private Object m_value; - /** - * The name of the notification. - */ - private boolean m_notification; - - /** - * Constructor. - * - * @param name the name of the properety - * @param field the field which send a notification when it is modified - * @param rights the rights of the attribute (ie: 'r' or 'w') - * @param type the type of the attribute - */ - public PropertyField(String name, String field, String rights, String type) { - this.setName(name); - this.setField(field); - this.m_type = type; - if (isRightsValid(rights)) { - this.setRights(rights); - } else { - this.setRights("r"); // default rights is read only - } - } - - /** - * Returns the field. - * @return the field - */ - public String getField() { - return m_field; - } - - /** - * Modifies the field. - * @param field the new field - */ - public void setField(String field) { - this.m_field = field; - } - - /** - * Returns the name. - * @return the name - */ - public String getName() { - return m_name; - } - - /** - * Modifies the name. - * @param name the new name - */ - public void setName(String name) { - this.m_name = name; - } - - /** - * Returns the rights. - * @return the rights - */ - public String getRights() { - return m_rights; - } - - /** - * Modifies the rights. - * @param rights the new rights - */ - public void setRights(String rights) { - this.m_rights = rights; - } - - /** - * Returns the value. - * @return the value - */ - public Object getValue() { - return m_value; - } - - /** - * Modifies the value. - * @param value the new value - */ - public void setValue(Object value) { - this.m_value = value; - } - - /** - * Returns the type. - * @return the type - */ - public String getType() { - return this.m_type; - } - - /** - * Returns the description. - * @return the description - */ - public String getDescription() { - //TODO Implement this method. - return null; - } - - /** - * Returns true if this property field is readable, false otherwise. - * @return {@code true} if this property field is readable, {@code false} otherwise. - */ - public boolean isReadable() { - return this.getRights().equals("r") || this.getRights().equals("w"); - } - - /** - * Returns true if this property field is writable, false otherwise. - * @return {@code true} if this property field is writable, {@code false} otherwise. - */ - public boolean isWritable() { - return this.getRights().equals("w"); - } - - /** - * Returns true if this property field is notifiable, false otherwise. - * @return {@code true} if this property field is notifiable, {@code false} otherwise. - */ - public boolean isNotifiable() { - return this.m_notification; - } - - /** - * Modify the notifiability of this property field. - * @param value the new notifiability of this property field. - */ - public void setNotifiable(boolean value) { - this.m_notification = value; - } - - /** - * Is the rights is valid or not ? (ie = 'r' || 'w'). - * - * @param rights string representing the rights - * @return boolean : return {@code true} if rights = 'r' or 'w' - */ - public static boolean isRightsValid(String rights) { - return rights != null && (rights.equals("r") || rights.equals("w")); - } - -} diff --git a/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd b/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd deleted file mode 100644 index 80152e9f9c..0000000000 --- a/ipojo/handler/jmx/jmx-handler/src/main/resources/jmx.xsd +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Description of a JMX managed component. - - - - - - - The list of methods to expose. - - - - - - - The list of attributes to expose. - - - - - - - - Determines if the component must be register on the - MOSGi MBean server or not. - - - - - - - The complete object name of the managed component. - The syntax of this attribute must be compliant with - the ObjectName syntax, detailed in the JMX - specification. If neither domain nor name attributes - are specified, the default value is determined by - the package, the type and the instance name of the - component. This attribute overrides the domain and - name attributes. - - - - - - - The domain of the managed object (i.e., the left - part of the object name). This attribute must be - compliant with the domain syntax, as described in - the JMX specification. - - - - - - - The name property of the managed object. The value - of this attribute must comply with the ObjectName - value syntax, as described in the JMX specification. - - - - - - - - Specifies method to carry out operations before - beeing registered from the MBean server. The - signature of the specified method must be : - "ObjectName preRegister(MBeanServer server, - ObjectName name) throws Exception". - - - - - - - Specifies method to carry out operations after - beeing registered from the MBean server. The - signature of the specified method must be : "void - postRegister(Boolean registrationDone)". - - - - - - - Specifies method to carry out operations before - beeing unregistered from the MBean server. The - signature of the specified method must be : "void - preDeregister() throws Exception". - - - - - - - Specifies method to carry out operations after - beeing unregistered from the MBean server. The - signature of the specified method must be : - "void postDeregister()". - - - - - - Description of an attribute to expose. - - - - The name of the component's field to expose. - - - The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field. - - - Specify the access permission of the exposed field. - - - - Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access). - - - - - - - - - - Enable or disable attribute change notification sending for this property. If set to "true", a notification is sent each time the value of the field changes. - - - - - Description of a method to expose. - - - - The name of the method to expose. If multiple methods have the same name, all of them are exposed. - - - - The description of the exposed method, as it will appear in JMX. - - \ No newline at end of file diff --git a/ipojo/handler/jmx/pom.xml b/ipojo/handler/jmx/pom.xml deleted file mode 100644 index 5329b4be41..0000000000 --- a/ipojo/handler/jmx/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.handler.jmx-handler-project - 1.5.0-SNAPSHOT - Apache Felix iPOJO JMX Handler Project - pom - - - jmx-handler - jmx-handler-it - - - - - - src/main/resources - - - . - META-INF - - LICENSE* - NOTICE* - DEPENDENCIES* - - - - - - - - release - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-assembly - package - - single - - - - project - - - false - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-assemblies - package - - attach-artifact - - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz - - project - tar.gz - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.zip - - project - zip - - - - - - - - - - - diff --git a/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/jmx/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/jmx/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/jmx/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/temporal/changelog.txt b/ipojo/handler/temporal/changelog.txt deleted file mode 100644 index ce0f55b986..0000000000 --- a/ipojo/handler/temporal/changelog.txt +++ /dev/null @@ -1,42 +0,0 @@ -Changes from the 1.6.2 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2438] - Temporal dependencies should use proxies by default - -** Improvement - * [FELIX-2666] - Rename the temporal handler annotation to avoid collision - -Changes from the 1.6.0 to 1.6.2 -------------------------------- -** Improvement - * [FELIX-2472] - Proxies should throw a runtime exception instead of a null point exception - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-855] - Collection support in iPOJO Temporal Dependencies - * [FELIX-860] - Temporal Dependency Proxy injection - -Changes from 0.8.1 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-625] - Temporal Dependency improvements (onTimeout policies) - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - - -Version 0.8.1 -------------- - * Initial release diff --git a/ipojo/handler/temporal/pom.xml b/ipojo/handler/temporal/pom.xml deleted file mode 100644 index 4e9132b63e..0000000000 --- a/ipojo/handler/temporal/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.handler.temporal-handler-project - 1.7.0-SNAPSHOT - Apache Felix iPOJO Temporal Dependency Handler Project - pom - - - temporal-dependency-handler - temporal-dependency-handler-it - - - - - - src/main/resources - - - . - META-INF - - LICENSE* - NOTICE* - DEPENDENCIES* - - - - - - - - release - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-assembly - package - - single - - - - project - - - false - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-assemblies - package - - attach-artifact - - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz - - project - tar.gz - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.zip - - project - zip - - - - - - - - - - - diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index f76ce776e5..0000000000 --- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,17 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 -- BSD License - diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE b/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index c45a1e75aa..0000000000 --- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Temporal Handler: - -The Apache Felix iPOJO Temporal Handler includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 6f2e68f9d5..0000000000 --- a/ipojo/handler/temporal/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,4 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml deleted file mode 100644 index 74c5a51c74..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/pom.xml +++ /dev/null @@ -1,390 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../../pom/pom.xml - - - 4.0.0 - pom - Apache Felix iPOJO Temporal Dependency Handler - Integration Test - org.apache.felix.ipojo.handler.temporal-it - 1.7.0-SNAPSHOT - - - 3.0.0 - 1.5.1 - - - - - - org.apache.felix - org.apache.felix.ipojo.handler.temporal - ${project.version} - - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo - 1.10.1 - test - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.1 - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - - - - junit - junit - 4.13.1 - test - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - - - - - - - test - - true - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - regular - - run - - - - felix - - ${project.build.directory}/regular - - - - - - - - - - test-all - - false - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - equinox-native - - run - - - - equinox - - ${project.build.directory}/equinox-native - - - - - felix-native - - run - - - - felix - - ${project.build.directory}/felix-native - - - - knopflerfish-native - - run - - - - knopflerfish - - ${project.build.directory}/knopflerfish-native - - - - - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - 5.2.0 - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - 3.8.1.v20120830-144521 - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - - diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml deleted file mode 100644 index af12fda763..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/pom.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.handler.temporal-it - 1.7.0-SNAPSHOT - ../../../pom.xml - - - - ipojo-temporal-integration-test - ${project.artifactId} - - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.8.6 - - - - \ No newline at end of file diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java deleted file mode 100644 index 404ef353e8..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CheckServiceProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class CheckServiceProvider implements CheckService { - - /** - * Temporal dependency. - */ - private FooService fs; - - public boolean check() { - if (fs != null) { - return fs.foo(); - } - return false; - } - - public Properties getProps() { - if (fs != null) { - return fs.fooProps(); - } - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java deleted file mode 100644 index 853fefc17f..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/CollectionCheckServiceProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Properties; - -public class CollectionCheckServiceProvider implements CheckService { - - /** - * Temporal dependency. - */ - private Collection fs; - - public boolean check() { - boolean result = true; - //Use a local variable to avoid to wait at each access. - Collection col = fs; - if (col != null) { - Iterator it = col.iterator(); - while (it.hasNext()) { - FooService svc = (FooService) it.next(); - result = result && svc.foo(); - } - } - return result; - } - - public Properties getProps() { - Iterator it = fs.iterator(); - if (it.hasNext()) { - FooService svc = (FooService) it.next(); - return svc.fooProps(); - } - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java deleted file mode 100644 index b8c1d28ccf..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/FooProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components; - -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class FooProvider implements FooService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java deleted file mode 100644 index 9affa3f403..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/MultipleCheckServiceProvider.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class MultipleCheckServiceProvider implements CheckService { - - /** - * Temporal dependency. - */ - private FooService[] fs; - - public boolean check() { - boolean result = true; - //Use a local variable to avoid to wait at each access. - FooService[] array = fs; - for (int i = 0; array != null && i < array.length; i++) { - result = result && array[i].foo(); - System.out.println("Result : " + result); - } - return result; - } - - public Properties getProps() { - return fs[0].fooProps(); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java deleted file mode 100644 index be4d452edd..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/NullableFooProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components; - -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class NullableFooProvider implements FooService { - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return -1; - } - - public int getInt() { - return -1; - } - - public long getLong() { - return -1; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java deleted file mode 100755 index 0a91fbfcaa..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CheckServiceProviderHelper.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components.proxy; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class CheckServiceProviderHelper implements CheckService { - - /** - * injected dependency. - */ - private FooService fs; - - public CheckServiceProviderHelper(FooService svc) { - fs = svc; - } - - public boolean check() { - if (fs != null) { // Cannot be null - try { - return fs.foo(); - } catch (RuntimeException e) { // Now it's a runtime exception (FELIX-2472) - // Can throw a RTE for null policy and for time out - if (e.getMessage().equals("No service available")) { - // Has detected a null policy. - System.out.println(e.getMessage()); - return false; - } else { - // Timeout - // Propagate the exception - throw e; - } - } - } - return false; - } - - public Properties getProps() { - if (fs != null) { - return fs.fooProps(); - } - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java deleted file mode 100644 index ad0a7d0513..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/CollectionCheckServiceProviderHelper.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components.proxy; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Properties; - -public class CollectionCheckServiceProviderHelper implements CheckService { - - /** - * Injected dependency. - */ - private Collection fs; - - public CollectionCheckServiceProviderHelper(Collection col) { - fs = col; - } - - public boolean check() { - boolean result = true; - //Use a local variable to avoid to wait at each access. - Collection col = fs; - if (col != null) { - Iterator it = col.iterator(); // Get the cached copy - while (it != null && it.hasNext()) { - FooService svc = (FooService) it.next(); - result = result && svc.foo(); - } - } - return result; - } - - public Properties getProps() { - Iterator it = fs.iterator(); - if (it.hasNext()) { - FooService svc = (FooService) it.next(); - return svc.fooProps(); - } - return null; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java deleted file mode 100755 index dcd8240a43..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCheckServiceProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components.proxy; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; - -import java.util.Properties; - -public class HelpedCheckServiceProvider implements CheckService { - - /** - * Temporal dependency. - */ - private FooService fs; - - private CheckServiceProviderHelper helper = new CheckServiceProviderHelper(fs); - - public boolean check() { - return helper.check(); - } - - public Properties getProps() { - return helper.getProps(); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java deleted file mode 100644 index 4d409170e1..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/components/proxy/HelpedCollectionCheckServiceProvider.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.handler.temporal.components.proxy; - -import org.apache.felix.ipojo.handler.temporal.services.CheckService; - -import java.util.Collection; -import java.util.Properties; - -public class HelpedCollectionCheckServiceProvider implements CheckService { - - /** - * Temporal dependency. - */ - private Collection fs; - - private CollectionCheckServiceProviderHelper helper = new CollectionCheckServiceProviderHelper(fs); - - public boolean check() { - return helper.check(); - } - - public Properties getProps() { - return helper.getProps(); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java deleted file mode 100644 index a1ff6199c8..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java deleted file mode 100644 index abc918a4f3..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java deleted file mode 100644 index a0cd10eb30..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ChildInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -public interface ChildInterface extends ParentInterface1, ParentInterface2 { - - public void processChild(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java deleted file mode 100644 index 91c34375ab..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java deleted file mode 100644 index b7e45fe540..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface1.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -public interface ParentInterface1 extends ParentParentInterface { - - public void processParent1(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java deleted file mode 100644 index fd9af2fc6d..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentInterface2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -public interface ParentInterface2 { - - public void processParent2(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java deleted file mode 100644 index aa00405f96..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/java/org/apache/felix/ipojo/handler/temporal/services/ParentParentInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.handler.temporal.services; - -public interface ParentParentInterface { - - public void processParentParent(); - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml deleted file mode 100644 index 620fee80e7..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/main/resources/metadata.xml +++ /dev/null @@ -1,262 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java deleted file mode 100644 index a6b32afbc2..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/Common.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.ops4j.pax.exam.Option; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - @Override - protected Option[] getCustomOptions() { - return new Option[]{ - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.temporal") - .versionAsInProject() - }; - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java deleted file mode 100644 index 42bc9b3f59..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DefaultImplementationTest.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class DefaultImplementationTest extends Common { - - @Test - public void testDefaultImplementation() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDefaultImplementationWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDefaultImplementationTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDefaultImplementationTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DICheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDefaultImplementationMultipleTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDefaultImplementationCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDefaultImplementationProxiedCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-DIProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayOnMultipleDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnProxiedCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained DI will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java deleted file mode 100644 index 0c15b652c0..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayTest.java +++ /dev/null @@ -1,494 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class DelayTest extends Common { - - @Test - public void testDelay() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - assertNull("No FooService", osgiHelper.getServiceReference(FooService.class.getName(), null)); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay (" + (end - begin) + ")", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 4000); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 4000); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testDelayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testSetTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testSetTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testDelayOnMultipleDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnProxiedCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java deleted file mode 100644 index ba65c0a539..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/DelayedProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; - -public class DelayedProvider implements Runnable { - - - public static final long DELAY = 1000; - ComponentInstance instance; - long delay = DELAY; - Thread thread; - - public DelayedProvider(ComponentInstance ci) { - instance =ci; - } - - public DelayedProvider(ComponentInstance ci, long time) { - instance =ci; - delay = time; - } - - public void start() { - thread = new Thread(this); - thread.start(); - } - - public void stop() { - if (thread != null) { - thread.interrupt(); - } - } - - public void run() { - System.out.println("Start sleeping for " + delay); - long begin = System.currentTimeMillis(); - try { - Thread.sleep(delay); - long end = System.currentTimeMillis(); - if (end - begin < delay) { - // Wait for the remaining time - Thread.sleep(delay - (end - begin)); - } - } catch (InterruptedException e) { - System.out.println("Interrupted ..."); - return; - } - System.out.println("Wakeup"); - thread = null; - instance.start(); - System.out.println(instance.getInstanceName() + " started"); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java deleted file mode 100755 index 1d3303472f..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/EmptyTest.java +++ /dev/null @@ -1,303 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class EmptyTest extends Common { - - @Test - public void testEmptyArrayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("An empty array was expected ..."); - } - assertTrue("Check empty array", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testEmptyCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("An empty array was expected ..."); - } - assertTrue("Check empty array", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testEmptyProxiedCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("An empty array was expected ..."); - } - assertTrue("Check empty array", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayOnMultipleDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyMultipleCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertTrue("Check invocation - 3", cs.check()); - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertTrue("Check invocation - 3", cs.check()); - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnProxiedCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-EmptyProxiedColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertTrue("Check invocation - 3", cs.check()); - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java deleted file mode 100644 index ddbc70a2e5..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/FilterTest.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Dictionary; -import java.util.Hashtable; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -/** - * Checks requires.filter, temporal.filter, temporal.from and - * requires.from attributes. - */ -public class FilterTest extends Common { - - /** - * Checks temporal.filter with dependency id. - * The filter is made to get only one provider. - */ - @Test - public void testWithTemporalFilters() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - - Dictionary configuration = new Hashtable(); - String un = "under-1"; - configuration.put("instance.name", un); - Dictionary filter = new Hashtable(); - filter.put("foo", "(instance.name=provider2)"); - configuration.put("temporal.filters", filter); - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", - configuration); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - /** - * Checks requires.filter with dependency id. - * The filter is made to get only one provider. - */ - @Test - public void testWithRequireFilters() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - - Dictionary configuration = new Hashtable(); - String un = "under-1"; - configuration.put("instance.name", un); - Dictionary filter = new Hashtable(); - filter.put("foo", "(instance.name=provider2)"); - configuration.put("requires.filters", filter); - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - /** - * Checks temporal.from with dependency id. - * The filter is made to get only one specific provider. - */ - @Test - public void testWithTemporalFrom() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - - Dictionary configuration = new Hashtable(); - String un = "under-1"; - configuration.put("instance.name", un); - Dictionary filter = new Hashtable(); - filter.put("foo", "provider2"); - configuration.put("temporal.from", filter); - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - /** - * Checks requires.from with dependency id. - * The filter is made to get only one specific provider. - */ - @Test - public void testWithRequiresFrom() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - - Dictionary configuration = new Hashtable(); - String un = "under-1"; - configuration.put("instance.name", un); - Dictionary filter = new Hashtable(); - filter.put("foo", "provider2"); - configuration.put("requires.from", filter); - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", configuration); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider1.stop(); - provider2.stop(); - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java deleted file mode 100644 index 600de6c99b..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NoDelayTest.java +++ /dev/null @@ -1,146 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class NoDelayTest extends Common { - - @Test - public void testNoDelay() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProvider", un); - assertNotNull("Check creation", under); - assertNotNull("Check provider creation", prov); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNoDelayWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProvider", un); - assertNotNull("Check creation", under); - assertNotNull("Check provider creation", prov); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testMultipleNoDelay() { - String prov1 = "provider-1"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1); - String un = "under-2"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-MultipleCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - provider1.stop(); - provider1.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testCollectionNoDelay() { - String prov1 = "provider-1"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1); - String un = "under-2"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - provider1.stop(); - provider1.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testProxiedCollectionNoDelay() { - String prov1 = "provider-1"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov1); - String un = "under-2"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedColCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - provider1.stop(); - provider1.dispose(); - under.stop(); - under.dispose(); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java deleted file mode 100644 index 289ed35a42..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullTest.java +++ /dev/null @@ -1,536 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class NullTest extends Common { - - @Test - public void testNull() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A null was expected ..."); - } - assertFalse("Check null", res); // Return false when the foo service is null. - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A null was expected ..."); - } - assertFalse("Check null", res); // Return false when the foo service is null. - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullMultipleTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A null was expected ..."); - } - assertTrue("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testNullCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A null was expected ..."); - } - assertTrue("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testNullProxiedCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A null was expected ... : " + e.getMessage()); - e.printStackTrace(); - } - assertTrue("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayOnMultipleDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnProxiedCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java deleted file mode 100644 index ca3c1d2e56..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/NullableTest.java +++ /dev/null @@ -1,535 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class NullableTest extends Common { - - @Test - public void testNullable() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullableTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullableWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullableTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProvider", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testNullableMultipleTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testNullableCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testNullableProxiedCollectionTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - boolean res = false; - try { - res = cs.check(); - } catch (RuntimeException e) { - fail("A nullable was expected ..."); - } - assertFalse("Check nullable", res); - - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - @Test - public void testDelayOnMultipleDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableMultipleCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayOnProxiedCollectionDependency() { - String prov = "provider"; - ComponentInstance provider1 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String prov2 = "provider2"; - ComponentInstance provider2 = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov2); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-NullableProxiedColCheckServiceProviderTimeout", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the providers. - provider1.stop(); - provider2.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider1, 1500); - DelayedProvider dp2 = new DelayedProvider(provider2, 100); - dp.start(); - dp2.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - System.out.println("delay = " + (end - begin)); - assertTrue("Assert min delay", (end - begin) >= 100); - assertTrue("Assert max delay", (end - begin) <= 1000); - dp.stop(); - dp2.stop(); - - provider1.stop(); - provider2.stop(); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertFalse("Check invocation - 3", cs.check()); // Will return false as the contained nullable will return false to the foo method. - - provider1.dispose(); - provider2.dispose(); - under.stop(); - under.dispose(); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java b/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java deleted file mode 100644 index 87d6acf854..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler-it/src/it/temporal-it/src/test/java/org/apache/felix/ipojo/handler/temporal/test/TemporalTest.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * 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.ipojo.handler.temporal.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.temporal.services.CheckService; -import org.apache.felix.ipojo.handler.temporal.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static org.junit.Assert.*; - -public class TemporalTest extends Common { - - @Test - public void testDelay() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - assertNull("No FooService", osgiHelper.getServiceReference(FooService.class.getName(), null)); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay (" + (end - begin) + ")", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 4000); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 4000); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testDelayTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testDelayTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - long begin = System.currentTimeMillis(); - DelayedProvider dp = new DelayedProvider(provider, 200); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 2", cs.check()); - long end = System.currentTimeMillis(); - - assertTrue("Assert delay", (end - begin) >= 200); - - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 3", ref_cs); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation - 3", cs.check()); - - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - } - - @Test - public void testSetTimeout() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-CheckServiceProviderTimeoutUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } - - @Test - public void testSetTimeoutWithProxy() { - String prov = "provider"; - ComponentInstance provider = ipojoHelper.createComponentInstance("TEMPORAL-FooProvider", prov); - String un = "under-1"; - ComponentInstance under = ipojoHelper.createComponentInstance("TEMPORAL-ProxiedCheckServiceProviderTimeoutUsingTemporal", un); - - ServiceReference ref_fs = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov); - assertNotNull("Check foo availability", ref_fs); - - ServiceReference ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability", ref_cs); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - assertTrue("Check invocation", cs.check()); - - // Stop the provider. - provider.stop(); - ref_cs = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), un); - assertNotNull("Check cs availability - 2", ref_cs); - DelayedProvider dp = new DelayedProvider(provider, 400); - dp.start(); - cs = (CheckService) osgiHelper.getServiceObject(ref_cs); - try { - cs.check(); - } catch (RuntimeException e) { - // OK - dp.stop(); - provider.stop(); - provider.dispose(); - under.stop(); - under.dispose(); - return; - } - - fail("Timeout expected"); - } -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/temporal-dependency-handler-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt b/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt deleted file mode 100644 index ce0f55b986..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/changelog.txt +++ /dev/null @@ -1,42 +0,0 @@ -Changes from the 1.6.2 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2438] - Temporal dependencies should use proxies by default - -** Improvement - * [FELIX-2666] - Rename the temporal handler annotation to avoid collision - -Changes from the 1.6.0 to 1.6.2 -------------------------------- -** Improvement - * [FELIX-2472] - Proxies should throw a runtime exception instead of a null point exception - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-855] - Collection support in iPOJO Temporal Dependencies - * [FELIX-860] - Temporal Dependency Proxy injection - -Changes from 0.8.1 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-625] - Temporal Dependency improvements (onTimeout policies) - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - - -Version 0.8.1 -------------- - * Initial release diff --git a/ipojo/handler/temporal/temporal-dependency-handler/obr.xml b/ipojo/handler/temporal/temporal-dependency-handler/obr.xml deleted file mode 100644 index ef50806032..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/obr.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - -

-

-

- - \ No newline at end of file diff --git a/ipojo/handler/temporal/temporal-dependency-handler/pom.xml b/ipojo/handler/temporal/temporal-dependency-handler/pom.xml deleted file mode 100644 index 166ea07fe7..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/pom.xml +++ /dev/null @@ -1,122 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../../pom/pom.xml - - 4.0.0 - bundle - org.apache.felix.ipojo.handler.temporal - 1.7.0-SNAPSHOT - Apache Felix iPOJO Temporal Service Dependency Handler - - - iPOJO extension to inject temporal service dependencies. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/temporal-service-dependency.html - - - - - org.osgi - org.osgi.core - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo - 1.10.1 - - - org.ow2.asm - asm-all - 5.0.2 - - - org.ow2.asm - asm-tree - - - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - - org.apache.felix.ipojo.handler.temporal;-split-package:=merge-first, - org.objectweb.asm;-split-package:=merge-last - - ${project.name} - ${project.artifactId} - - org.apache.felix.ipojo;version=1.10.0, - !org.objectweb.asm.tree, * - - The Apache Software Foundation - iPOJO Temporal Dependency Handler - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/temporal-service-dependency.html - - - - - - org.apache.felix - maven-ipojo-plugin - 1.10.1 - - - - ipojo-bundle - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index f76ce776e5..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,17 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 -- BSD License - diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index c45a1e75aa..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Temporal Handler: - -The Apache Felix iPOJO Temporal Handler includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 6f2e68f9d5..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,4 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java deleted file mode 100644 index a3fcd69aa6..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ProxyGenerator.java +++ /dev/null @@ -1,183 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - - -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; - -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * Generates proxy class delegating operation invocations thanks to a - * a temporal dependency. - * @author Felix Project Team - */ -public class ProxyGenerator implements Opcodes { - - /** - * The temporal dependency name. - */ - private static final String DEPENDENCY = "m_dependency"; - - /** - * The Temporal Dependency descriptor. - */ - private static final String DEPENDENCY_DESC = Type.getDescriptor(TemporalDependency.class); - - /** - * Temporal dependency internal class name. - */ - private static final String TEMPORAL_DEPENDENCY = "org/apache/felix/ipojo/handler/temporal/TemporalDependency"; - - /** - * Gets the internal names of the given class objects. - * @param classes the classes - * @return the array containing internal names of the given class array. - */ - private static String[] getInternalClassNames(Class[] classes) { - final String[] names = new String[classes.length]; - for (int i = 0; i < names.length; i++) { - names[i] = Type.getInternalName(classes[i]); - } - return names; - } - - /** - * Generates a proxy class. - * @param spec the proxied service specification - * @return the byte[] for the generated proxy class. - */ - public static byte[] dumpProxy(Class spec) { - ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); - String internalClassName = Type.getInternalName(spec); // Specification class internal name. - String[] itfs = new String[] {internalClassName}; // Implemented interface. - String className = internalClassName + "$$Proxy"; // Unique name. - Method[] methods = spec.getMethods(); // Method to delegate - - cw.visit(Opcodes.V1_3, Opcodes.ACC_PUBLIC | Opcodes.ACC_FINAL, className, null, "java/lang/Object", itfs); - addDependencyField(cw); - generateConstructor(cw, className); - - // For each method, create the delegator code. - for (int i = 0; i < methods.length; i++) { - if ((methods[i].getModifiers() & (Modifier.STATIC | Modifier.FINAL)) == 0) { - generateDelegator(cw, methods[i], className, internalClassName); - } - } - - cw.visitEnd(); - - return cw.toByteArray(); - - } - - /** - * Generates a delegated method. - * @param cw the class writer - * @param method the method object to delegate - * @param className the generated class name - * @param itfName the internal specification class name - */ - private static void generateDelegator(ClassWriter cw, Method method, - String className, String itfName) { - String methodName = method.getName(); - String desc = Type.getMethodDescriptor(method); - String[] exceptions = getInternalClassNames(method.getExceptionTypes()); - int modifiers = method.getModifiers() - & ~(Modifier.ABSTRACT | Modifier.NATIVE | Modifier.SYNCHRONIZED); - Type[] types = Type.getArgumentTypes(method); - - int freeRoom = 1; - for (int t = 0; t < types.length; t++) { - freeRoom = freeRoom + types[t].getSize(); - } - - MethodVisitor mv = cw.visitMethod(modifiers, methodName, desc, null, - exceptions); - mv.visitCode(); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, DEPENDENCY, DEPENDENCY_DESC); // The temporal dependency is on the stack. - mv.visitMethodInsn(INVOKEVIRTUAL, TEMPORAL_DEPENDENCY, "getService", // Call getService - "()Ljava/lang/Object;"); // The service object is on the stack. - int varSvc = freeRoom; - freeRoom = freeRoom + 1; // Object Reference. - mv.visitVarInsn(ASTORE, varSvc); // Store the service object. - - // Invoke the method on the service object. - mv.visitVarInsn(ALOAD, varSvc); - // Push argument on the stack. - int i = 1; // Arguments. (non static method) - for (int t = 0; t < types.length; t++) { - mv.visitVarInsn(types[t].getOpcode(ILOAD), i); - i = i + types[t].getSize(); - } - // Invocation - mv.visitMethodInsn(INVOKEINTERFACE, itfName, methodName, desc); - - // Return the result - Type returnType = Type.getReturnType(desc); - if (returnType.getSort() != Type.VOID) { - mv.visitInsn(returnType.getOpcode(IRETURN)); - } else { - mv.visitInsn(RETURN); - } - - // End of the method. - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Generates the constructors. The constructor receives a temporal dependency - * and set the {@link ProxyGenerator#DEPENDENCY} field. - * @param cw the class writer - * @param className the generated class name. - */ - private static void generateConstructor(ClassWriter cw, String className) { - MethodVisitor mv = cw.visitMethod(Opcodes.ACC_PUBLIC, "", '(' + DEPENDENCY_DESC + ")V", null, null); - mv.visitCode(); - - mv.visitVarInsn(ALOAD, 0); // Load this - mv.visitInsn(DUP); // Dup - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V"); // Call super - mv.visitVarInsn(ALOAD, 1); // Load the argument - mv.visitFieldInsn(PUTFIELD, className, DEPENDENCY, DEPENDENCY_DESC); // Assign the dependency field - mv.visitInsn(RETURN); // Return void - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Adds the temporal dependency field {@link ProxyGenerator#DEPENDENCY}. - * @param cw the class writer - */ - private static void addDependencyField(ClassWriter cw) { - cw.visitField(Opcodes.ACC_FINAL, DEPENDENCY, DEPENDENCY_DESC, null, null); - cw.visitEnd(); - } - - - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java deleted file mode 100644 index 3369b59a28..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceCollection.java +++ /dev/null @@ -1,334 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.osgi.framework.ServiceReference; - -/** -* Maintains a service object collection. -* This collection wrap the temporal dependency to be accessible from a -* {@link Collection}, that can be passed to helper objects (Collaborators). -* -* The onTimeout policies are executed when the {@link Collection#iterator()}, -* {@link Collection#toArray(Object[])} and {@link Collection#toArray()} methods -* are called. -* -* The {@link Collection#iterator()} method returns an {@link Iterator} iterating -* on a cached copy of available service objects. In the case that there are no -* available services when the timeout is reached, the policies act as follows: -*

    -*
  • 'null' returns a null iterator
  • -*
  • 'nullable' and default-implementation returns an iterator iterating on one object (the -* nullable or default-implementation object
  • -*
  • 'empty' returns an empty iterator.
  • -*
  • 'no policy' throws runtime exception
  • -*
-* @author Felix Project Team -*/ -public class ServiceCollection implements Collection { - - /** - * The wrapped temporal dependencies. - */ - private TemporalDependency m_dependency; - - /** - * Creates a Service Collection. - * @param dep the wrapped temporal dependencies - */ - public ServiceCollection(TemporalDependency dep) { - m_dependency = dep; - } - - /** - * Unsupported method. - * @param o an object - * @return N/A - * @see java.util.Collection#add(java.lang.Object) - */ - public boolean add(Object o) { - throw new UnsupportedOperationException("Cannot add elements inside this collection"); - } - - /** - * Unsupported method. - * @param c an object - * @return N/A - * @see java.util.Collection#addAll(java.util.Collection) - */ - public boolean addAll(Collection c) { - throw new UnsupportedOperationException("Cannot add elements inside this collection"); - } - - /** - * Unsupported method. - * @see java.util.Collection#clear() - */ - public void clear() { - throw new UnsupportedOperationException("Cannot remove elements from this collection"); - } - - /** - * Checks if the wrapped temporal dependencies has always access to the - * given service object.The method allows knowing if the provider returning the - * service object has leaved. - * @param o the service object - * @return true if the object is still available, - * false otherwise. - * @see java.util.Collection#contains(java.lang.Object) - */ - public boolean contains(Object o) { - return getAvailableObjects().contains(o); - } - - /** - * Checks if the wrapped temporal dependencies has always access to the - * given service objects.The method allows knowing if providers returning the - * service objects have leaved. - * @param c the set of service object - * @return true if the objects are still available, - * false otherwise. - * @see java.util.Collection#contains(java.lang.Object) - */ - public boolean containsAll(Collection c) { - return getAvailableObjects().containsAll(c); - } - - /** - * Checks if at least one provider matching with the dependency - * is available. - * @return true if one provider or more satisfying the - * dependency are available. Otherwise, returns false - * @see java.util.Collection#isEmpty() - */ - public boolean isEmpty() { - return m_dependency.getSize() == 0; - } - - /** - * Helper method creating a list of available service objects. - * @return the list of available service objects. - */ - private List getAvailableObjects() { - List list = new ArrayList(); - ServiceReference[] refs = m_dependency.getServiceReferences(); - if (refs != null) { - for (int i = 0; i < refs.length; i++) { - list.add(m_dependency.getService(refs[i])); - } - } - return list; - } - - /** - * Gets an iterator on the actual list of available service objects. - * This method applies on timeout policies is no services are - * available after the timeout. - * The returned iterator iterates on a cached copy of the service - * objects. - * @return a iterator giving access to service objects. - * @see java.util.Collection#iterator() - */ - public Iterator iterator() { - ServiceReference[] refs = m_dependency.getServiceReferences(); - if (refs != null) { - // Immediate return. - return new ServiceIterator(refs); // Create the service iterator with the service reference list. - } else { - // Begin to wait ... - long enter = System.currentTimeMillis(); - boolean exhausted = false; - synchronized (this) { - while (m_dependency.getServiceReference() == null && !exhausted) { - try { - wait(1); - } catch (InterruptedException e) { - // We was interrupted .... - } finally { - long end = System.currentTimeMillis(); - exhausted = (end - enter) > m_dependency.getTimeout(); - } - } - } - // Check - if (exhausted) { - Object oto = m_dependency.onTimeout(); // Throws the RuntimeException - if (oto == null) { // If null, return null - return null; - } else { - // oto is an instance of collection containing either empty or with only one element - return new ServiceIterator((Collection) oto); - } - } else { - refs = m_dependency.getServiceReferences(); - return new ServiceIterator(refs); - } - } - - - } - - /** - * Unsupported method. - * @param o a object - * @return N/A - * @see java.util.Collection#remove(java.lang.Object) - */ - public boolean remove(Object o) { - throw new UnsupportedOperationException("Cannot remove elements from this collection"); - } - - /** - * Unsupported method. - * @param c a set of objects - * @return N/A - * @see java.util.Collection#removeAll(java.util.Collection) - */ - public boolean removeAll(Collection c) { - throw new UnsupportedOperationException("Cannot remove elements from this collection"); - } - - /** - *Unsupported method. - * @param c a set of objects - * @return N/A - * @see java.util.Collection#retainAll(java.util.Collection) - */ - public boolean retainAll(Collection c) { - throw new UnsupportedOperationException("Cannot remove elements from this collection"); - } - - /** - * Gets the number of available providers. - * @return the number of matching service providers. - * @see java.util.Collection#size() - */ - public int size() { - return m_dependency.getSize(); - } - - /** - * Returns an array containing available service objects. - * This method executed on timeout policies if no matching - * providers when the timeout is reached. - * @return a array containing available service objects. - * depending on the timeout policy, this array can also be null, - * be empty, or can contain only one element (a default-implementation - * object, or a nullable object). - * @see java.util.Collection#toArray() - */ - public Object[] toArray() { - return toArray(new Object[0]); - } - - /** - * Returns an array containing available service objects. - * This method executed on timeout policies if no matching - * providers when the timeout is reached. - * @param a the array into which the elements of this collection - * are to be stored, if it is big enough; otherwise, a new array - * of the same runtime type is allocated for this purpose. - * @return a array containing available service objects. - * depending on the timeout policy, this array can also be null, - * be empty, or can contain only one element (a default-implementation - * object, or a nullable object). - * @see java.util.Collection#toArray(java.lang.Object[]) - */ - public Object[] toArray(Object[] a) { - Iterator it = iterator(); // Can throw an exception. - if (it == null) { - return null; - } - // Else we get an iterator. - List list = new ArrayList(size()); - while (it.hasNext()) { - list.add(it.next()); - } - return list.toArray(a); - } - - /** - * Iterator on a set of service objects. - * This iterator iterates on a cached copy of service objects. - */ - private final class ServiceIterator implements Iterator { - - /** - * Underlying iterator. - */ - private Iterator m_iterator; - - /** - * Creates a Service Iterator iterating - * on the given set of providers. - * @param refs the available service providers - */ - private ServiceIterator(ServiceReference[] refs) { - List objects = new ArrayList(refs.length); - for (int i = 0; i < refs.length; i++) { - objects.add(m_dependency.getService(refs[i])); - } - m_iterator = objects.iterator(); - } - - /** - * Creates a Service Iterator iterating - * on service object contained in the given - * collection. - * @param col a collection containing service objects. - */ - private ServiceIterator(Collection col) { - m_iterator = col.iterator(); - } - - /** - * Returns true if the iteration has - * more service objects. - * @return true if the iterator has more elements. - * @see java.util.Iterator#hasNext() - */ - public boolean hasNext() { - return m_iterator.hasNext(); - } - - /** - * Returns the next service objects in the iteration. - * @return the next service object in the iteration. - * @see java.util.Iterator#next() - */ - public Object next() { - return m_iterator.next(); - } - - /** - * Unsupported operation. - * @see java.util.Iterator#remove() - */ - public void remove() { - throw new UnsupportedOperationException(); - } - - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java deleted file mode 100644 index 70184c9fa0..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/ServiceUsage.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - - -/** - * Object managing thread local copy of required services. - * - * @author Felix Project Team - */ -public class ServiceUsage extends ThreadLocal { - - /** - * Structure contained in the Thread Local. - */ - public static class Usage { - - /** - * Stack Size. - */ - int m_stack = 0; - /** - * Object to inject. - */ - Object m_object; - - /** - * Increment the stack level. - */ - public void inc() { - m_stack++; - } - - /** - * Decrement the stack level. - * @return true if the stack is 0 after the decrement. - */ - public boolean dec() { - m_stack--; - return m_stack == 0; - } - - /** - * Clear the service object array. - */ - public void clear() { - m_object = null; - } - - } - - /** - * Initialize the cached object. - * @return an empty Usage object. - * @see java.lang.ThreadLocal#initialValue() - */ - public Object initialValue() { - return new Usage(); - } - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java deleted file mode 100644 index 49ea111bc8..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalDependency.java +++ /dev/null @@ -1,555 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - -import java.lang.reflect.*; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import org.apache.felix.ipojo.FieldInterceptor; -import org.apache.felix.ipojo.MethodInterceptor; -import org.apache.felix.ipojo.Nullable; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.handler.temporal.ServiceUsage.Usage; -import org.apache.felix.ipojo.handlers.dependency.NullableObject; -import org.apache.felix.ipojo.util.DependencyModel; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; - -/** - * Temporal dependency. A temporal dependency waits (block) for the availability - * of the service. If no provider arrives in the specified among of time, a - * runtime exception is thrown. - * @author Felix Project Team - */ -public class TemporalDependency extends DependencyModel implements - FieldInterceptor, MethodInterceptor { - - /** - * The timeout. - */ - private long m_timeout; - - /** - * The default implementation. - */ - private String m_di; - - /** - * The {@link Nullable} object or Default-Implementation instance if used. - */ - private Object m_nullableObject; - - /** - * The handler managing this dependency. - */ - private PrimitiveHandler m_handler; - - /** - * The timeout policy. Null injects null, {@link Nullable} injects a nullable object or - * an array with a nullable object, Default-Implementation injects an object - * created from the specified injected implementation or an array with it - * Empty array inject an empty array (must be an aggregate dependency) No - * policy (0) throw a runtime exception when the timeout occurs * - */ - private int m_policy; - - /** - * The dependency is injected as a collection. - * The field must be of the {@link Collection} type - */ - private boolean m_collection; - - /** - * Enables the proxy mode. - */ - private boolean m_proxy; - - /** - * Service Usage (Thread Local). - */ - private ServiceUsage m_usage; - - /** - * The proxy object. - * This field is used for scalar proxied temporal dependency. - */ - private Object m_proxyObject; - - - /** - * Creates a temporal dependency. - * @param spec the service specification - * @param agg is the dependency aggregate ? - * @param collection the dependency field is a collection - * @param proxy enable the proxy-mode - * @param filter the LDAP filter - * @param context service context - * @param timeout timeout - * @param handler Handler managing this dependency - * @param defaultImpl class used as default-implementation - * @param policy onTimeout policy - */ - public TemporalDependency(Class spec, boolean agg, boolean collection, boolean proxy, Filter filter, - BundleContext context, long timeout, int policy, - String defaultImpl, TemporalHandler handler) { - super(spec, agg, true, filter, null, - DependencyModel.DYNAMIC_BINDING_POLICY, context, handler, handler.getInstanceManager()); - m_di = defaultImpl; - m_policy = policy; - m_timeout = timeout; - m_handler = handler; - m_collection = collection; - m_proxy = proxy; - if (! proxy) { // No proxy => initialize the Thread local. - m_usage = new ServiceUsage(); - } else if (proxy && ! agg) { // Scalar proxy => Create the proxy. - ProxyFactory proxyFactory = new ProxyFactory(this.getClass().getClassLoader()); - m_proxyObject = proxyFactory.getProxy(getSpecification(), this); - } - } - - /** - * The dependency has been reconfigured. - * @param arg0 new service references - * @param arg1 old service references - * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], - * org.osgi.framework.ServiceReference[]) - */ - public void onDependencyReconfiguration(ServiceReference[] arg0, - ServiceReference[] arg1) { - throw new UnsupportedOperationException( - "Reconfiguration not yet supported"); - } - - /** - * A provider arrives. - * @param ref service reference of the new provider. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference) - */ - public synchronized void onServiceArrival(ServiceReference ref) { - // Notify if a thread is waiting. - notifyAll(); - } - - /** - * A provider leaves. - * @param arg0 leaving service references. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference) - */ - public void onServiceDeparture(ServiceReference arg0) { } - - /** - * A provider is modified. - * @param arg0 leaving service references. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference) - */ - public void onServiceModification(ServiceReference arg0) { } - - /** - * The code require a value of the monitored field. If providers are - * available, the method return service object(s) immediately. Else, the - * thread is blocked until an arrival. If no provider arrives during the - * among of time specified, the method throws a Runtime Exception. - * @param arg0 POJO instance asking for the service - * @param arg1 field name - * @param arg2 previous value - * @return the object to inject. - * @see org.apache.felix.ipojo.FieldInterceptor#onGet(java.lang.Object, java.lang.String, java.lang.Object) - */ - public synchronized Object onGet(Object arg0, String arg1, Object arg2) { - // Check if the Thread local as a value - if (! m_proxy) { - Usage usage = (Usage) m_usage.get(); - if (usage.m_stack > 0) { - return usage.m_object; - } - } - - ServiceReference[] refs = getServiceReferences(); - if (refs != null) { - // Immediate return. - return getServiceObjects(refs); - } else { - // Begin to wait ... - long enter = System.currentTimeMillis(); - boolean exhausted = false; - synchronized (this) { - while (getServiceReference() == null && !exhausted) { - try { - wait(1); - } catch (InterruptedException e) { - // We was interrupted .... - } finally { - long end = System.currentTimeMillis(); - exhausted = (end - enter) > m_timeout; - } - } - } - // Check - if (exhausted) { - return onTimeout(); - } else { - refs = getServiceReferences(); - return getServiceObjects(refs); - } - } - } - - /** - * A POJO method will be invoked. - * @param pojo : Pojo object - * @param method : called method - * @param args : arguments - * @see org.apache.felix.ipojo.MethodInterceptor#onEntry(java.lang.Object, java.lang.reflect.Member, java.lang.Object[]) - */ - public void onEntry(Object pojo, Member method, Object[] args) { - if (m_usage != null) { - Usage usage = (Usage) m_usage.get(); - if (usage.m_stack > 0) { - usage.inc(); - m_usage.set(usage); // Set the Thread local as value has been modified - } - } - } - - /** - * A POJO method has thrown an error. - * This method does nothing and wait for the finally. - * @param pojo : POJO object. - * @param method : Method object. - * @param throwable : thrown error - * @see org.apache.felix.ipojo.MethodInterceptor#onError(java.lang.Object, java.lang.reflect.Member, java.lang.Throwable) - */ - public void onError(Object pojo, Member method, Throwable throwable) { - // Nothing to do : wait onFinally - } - - /** - * A POJO method has returned. - * @param pojo : POJO object. - * @param member : Method object. - * @param returnedObj : returned object (null for void method) - * @see org.apache.felix.ipojo.MethodInterceptor#onExit(java.lang.Object, java.lang.reflect.Member, java.lang.Object) - */ - public void onExit(Object pojo, Member member, Object returnedObj) { - // Nothing to do : wait onFinally - } - - /** - * A POJO method is finished. - * @param pojo : POJO object. - * @param method : Method object. - * @see org.apache.felix.ipojo.MethodInterceptor#onFinally(java.lang.Object, java.lang.reflect.Member) - */ - public void onFinally(Object pojo, Member method) { - if (m_usage != null) { - Usage usage = (Usage) m_usage.get(); - if (usage.m_stack > 0) { - if (usage.dec()) { - // Exit the method flow => Release all objects - usage.clear(); - m_usage.set(usage); // Set the Thread local as value has been modified - } - } - } - } - - /** - * Creates and returns object to inject in the dependency. - * This method handles aggregate, collection and proxy cases. - * @param refs the available service references - * @return the object to inject. Can be a 'simple' object, a proxy, - * a collection or an array. - */ - private Object getServiceObjects(ServiceReference [] refs) { - if (m_proxy) { - if (m_proxyObject == null) { // Not aggregate. - return new ServiceCollection(this); - } else { - return m_proxyObject; - } - } else { - // Initialize the thread local object is not already touched. - Usage usage = (Usage) m_usage.get(); - if (usage.m_stack == 0) { // uninitialized usage. - if (isAggregate()) { - if (m_collection) { - Collection svc = new ArrayList(refs.length); // Use an array list as collection implementation. - for (int i = 0; i < refs.length; i++) { - svc.add(getService(refs[i])); - } - usage.m_object = svc; - } else { - Object[] svc = (Object[]) Array.newInstance(getSpecification(), - refs.length); - for (int i = 0; i < svc.length; i++) { - svc[i] = getService(refs[i]); - } - usage.m_object = svc; - } - } else { - usage.m_object = getService(refs[0]); - } - usage.inc(); // Start the caching, so set the stack level to 1 - m_usage.set(usage); - } - return usage.m_object; - } - - } - - /** - * Called by the proxy to get a service object to delegate a method. - * This methods manages the waited time and on timeout policies. - * @return a service object or a nullable/default-implmentation object. - */ - public Object getService() { - ServiceReference ref = getServiceReference(); - if (ref != null) { - return getService(ref); // Return immediately the service object. - } else { - // Begin to wait ... - long enter = System.currentTimeMillis(); - boolean exhausted = false; - synchronized (this) { - while (ref == null && !exhausted) { - try { - wait(1); - } catch (InterruptedException e) { - // We was interrupted .... - } finally { - long end = System.currentTimeMillis(); - exhausted = (end - enter) > m_timeout; - ref = getServiceReference(); - } - } - } - // Check - if (exhausted) { - Object obj = onTimeout(); // Throw the Runtime Exception - if (obj == null) { - throw new RuntimeException("No service available"); // Runtime Exception to be consistent with iPOJO Core. - } else { - return obj; // Return a nullable or DI - } - } else { - // If not exhausted, ref is not null. - return getService(ref); - } - } - } - - /** - * Start method. Initializes the nullable object. - * @see org.apache.felix.ipojo.util.DependencyModel#start() - */ - public void start() { - super.start(); - switch (m_policy) { - case TemporalHandler.NULL: - m_nullableObject = null; - break; - case TemporalHandler.NULLABLE: - // To load the proxy we use the POJO class loader. Indeed, this - // classloader imports iPOJO (so can access to Nullable) and has - // access to the service specification. - try { - m_nullableObject = Proxy.newProxyInstance(m_handler - .getInstanceManager().getClazz().getClassLoader(), - new Class[] { getSpecification(), Nullable.class }, - new NullableObject()); // NOPMD - if (isAggregate()) { - if (m_collection) { - List list = new ArrayList(1); - list.add(m_nullableObject); - m_nullableObject = list; - } else { - Object[] array = (Object[]) Array.newInstance( - getSpecification(), 1); - array[0] = m_nullableObject; - m_nullableObject = array; - } - } - } catch (NoClassDefFoundError e) { - // A NoClassDefFoundError is thrown if the specification - // uses a - // class not accessible by the actual instance. - // It generally comes from a missing import. - throw new IllegalStateException( - "Cannot create the Nullable object, a referenced class cannot be loaded: " - + e.getMessage()); - } - - break; - case TemporalHandler.DEFAULT_IMPLEMENTATION: - // Create the default-implementation object. - try { - Class clazz = m_handler.getInstanceManager().getContext() - .getBundle().loadClass(m_di); - m_nullableObject = clazz.newInstance(); - } catch (IllegalAccessException e) { - throw new IllegalStateException( - "Cannot load the default-implementation " + m_di - + " : " + e.getMessage()); - } catch (InstantiationException e) { - throw new IllegalStateException( - "Cannot load the default-implementation " + m_di - + " : " + e.getMessage()); - } catch (ClassNotFoundException e) { - throw new IllegalStateException( - "Cannot load the default-implementation " + m_di - + " : " + e.getMessage()); - } - if (isAggregate()) { - if (m_collection) { - List list = new ArrayList(1); - list.add(m_nullableObject); - m_nullableObject = list; - } else { - Object[] array = (Object[]) Array.newInstance( - getSpecification(), 1); - array[0] = m_nullableObject; - m_nullableObject = array; - } - } - break; - case TemporalHandler.EMPTY: - if (! m_collection) { - m_nullableObject = Array.newInstance(getSpecification(), 0); - } else { // Empty collection - m_nullableObject = new ArrayList(0); - } - break; - default: // Cannot occurs - break; - } - } - - /** - * Stop method. Just releases the reference on the nullable object. - * @see org.apache.felix.ipojo.util.DependencyModel#stop() - */ - public void stop() { - super.stop(); - m_nullableObject = null; - m_proxyObject = null; - } - - /** - * The monitored field receives a value. Nothing to do. - * @param arg0 POJO setting the value. - * @param arg1 field name - * @param arg2 received value - * @see org.apache.felix.ipojo.FieldInterceptor#onSet(java.lang.Object, java.lang.String, java.lang.Object) - */ - public void onSet(Object arg0, String arg1, Object arg2) { } - - /** - * Implements the timeout policy according to the specified configuration. - * @return the object to return when the timeout occurs. - */ - Object onTimeout() { - switch (m_policy) { - case TemporalHandler.NULL: - case TemporalHandler.NULLABLE: - case TemporalHandler.DEFAULT_IMPLEMENTATION: - case TemporalHandler.EMPTY: - return m_nullableObject; - default: - // Throws a runtime exception - throw new RuntimeException("Service " - + getSpecification().getName() - + " unavailable : timeout"); - } - } - - long getTimeout() { - return m_timeout; - } - - /** - * Creates proxy object for proxied scalar dependencies. - */ - private class ProxyFactory extends ClassLoader { - - /** - * Handler classloader, used to load the temporal dependency class. - */ - private ClassLoader m_handlerCL; - - /** - * Creates the proxy classloader. - * @param parent the handler classloader. - */ - public ProxyFactory(ClassLoader parent) { - this.m_handlerCL = parent; - } - - /** - * Loads a proxy class generated for the given (interface) class. - * @param clazz the service specification to proxy - * @return the Class object of the proxy. - */ - protected Class getProxyClass(Class clazz) { - byte[] clz = ProxyGenerator.dumpProxy(clazz); // Generate the proxy. - return defineClass(clazz.getName() + "$$Proxy", clz, 0, clz.length); - } - - /** - * Create a proxy object for the given specification. The proxy - * uses the given temporal dependency to get the service object. - * @param spec the service specification (interface) - * @param dep the temporal dependency used to get the service - * @return the proxy object. - */ - public Object getProxy(Class spec, TemporalDependency dep) { - try { - Class clazz = getProxyClass(getSpecification()); - Constructor constructor = clazz.getConstructor(new Class[] {dep.getClass()}); // The proxy constructor - return constructor.newInstance(new Object[] {dep}); - } catch (Throwable e) { - m_handler.error("Cannot create the proxy object", e); - m_handler.getInstanceManager().stop(); - return null; - } - } - - /** - * Loads the given class. - * This class use the classloader of the specification class - * or the handler class loader. - * @param name the class name - * @return the class object - * @throws ClassNotFoundException if the class is not found by the two classloaders. - * @see java.lang.ClassLoader#loadClass(java.lang.String) - */ - public Class loadClass(String name) throws ClassNotFoundException { - try { - return m_handler.getInstanceManager().getContext().getBundle().loadClass(name); - } catch (ClassNotFoundException e) { - return m_handlerCL.loadClass(name); - } - } - } - - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java b/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java deleted file mode 100644 index 0056508a76..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/java/org/apache/felix/ipojo/handler/temporal/TemporalHandler.java +++ /dev/null @@ -1,317 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.FieldMetadata; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.parser.PojoMetadata; -import org.apache.felix.ipojo.util.DependencyMetadataHelper; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.DependencyStateListener; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; - -import java.util.*; - -/** - * Temporal dependency handler. - * A temporal dependency waits (block) for the availability of the service. - * If no provider arrives in the specified among of time, a runtime exception is thrown. - * - * @author Felix Project Team - */ -public class TemporalHandler extends PrimitiveHandler implements DependencyStateListener { - - /** - * Default timeout if not specified. - */ - public static final int DEFAULT_TIMEOUT = 3000; - /** - * No policy. - */ - public static final int NO_POLICY = 0; - /** - * Uses a nullable object. - */ - public static final int NULLABLE = 1; - /** - * Uses a default-implementation object. - */ - public static final int DEFAULT_IMPLEMENTATION = 2; - /** - * Uses an empty array. - */ - public static final int EMPTY = 3; - /** - * Uses {@code null}. - */ - public static final int NULL = 4; - /** - * The handler namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.handler.temporal"; - /** - * The list of managed dependencies. - */ - private List/**/ m_dependencies = new ArrayList(1); - - /** - * Start method. Starts managed dependencies. - * - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - for (int i = 0; i < m_dependencies.size(); i++) { - ((TemporalDependency) m_dependencies.get(i)).start(); - } - } - - /** - * Stop method. Stops managed dependencies. - * - * @see org.apache.felix.ipojo.Handler#stop() - */ - public void stop() { - for (int i = 0; i < m_dependencies.size(); i++) { - ((TemporalDependency) m_dependencies.get(i)).stop(); - } - m_dependencies.clear(); - } - - /** - * Configure method. Creates managed dependencies. - * - * @param meta the component type metadata. - * @param dictionary the instance configuration. - * @throws ConfigurationException if the dependency is not configured correctly - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element meta, Dictionary dictionary) throws ConfigurationException { - PojoMetadata manipulation = getFactory().getPojoMetadata(); - Element[] deps = meta.getElements("requires", NAMESPACE); - - // Also check with temporal is no requires. - if (deps == null || deps.length == 0) { - deps = meta.getElements("temporal", NAMESPACE); - } - - // Get instance filters. - Dictionary filtersConfiguration = getRequiresFilters(dictionary.get("temporal.filters")); - if (filtersConfiguration == null || filtersConfiguration.isEmpty()) { - // Fall back on the Requires handler configuration, if any - filtersConfiguration = getRequiresFilters(dictionary.get("requires.filters")); - } - // Get from filters if any. - Dictionary fromConfiguration = getRequiresFilters(dictionary.get("temporal.from")); - if (fromConfiguration == null || fromConfiguration.isEmpty()) { - // Fall back on the Requires handler configuration, if any - fromConfiguration = getRequiresFilters(dictionary.get("requires.from")); - } - - - for (int i = 0; i < deps.length; i++) { - if (!deps[i].containsAttribute("field") || m_dependencies.contains(deps[i].getAttribute("field"))) { - error("One temporal dependency must be attached to a field or the field is already used"); - return; - } - String field = deps[i].getAttribute("field"); - - String id = field; - if (deps[i].containsAttribute("id")) { - id = deps[i].getAttribute("id"); - } - - FieldMetadata fieldmeta = manipulation.getField(field); - if (fieldmeta == null) { - error("The field " + field + " does not exist in the class " + getInstanceManager().getClassName()); - return; - } - - boolean agg = false; - boolean collection = false; - String spec = fieldmeta.getFieldType(); - if (spec.endsWith("[]")) { - agg = true; - spec = spec.substring(0, spec.length() - 2); - } else if (Collection.class.getName().equals(spec)) { - agg = true; - collection = true; - // Collection detected. Check for the specification attribute - spec = deps[i].getAttribute("specification"); - if (spec == null) { - error("A dependency injected inside a Collection must contain the 'specification' attribute"); - } - } - - // Determine the filter - String fil = deps[i].getAttribute("filter"); - // Override the filter if filter configuration if available in the instance configuration - if (filtersConfiguration != null && id != null && filtersConfiguration.get(id) != null) { - fil = (String) filtersConfiguration.get(id); - } - - // Check the from attribute - String from = deps[i].getAttribute("from"); - if (fromConfiguration != null && id != null && fromConfiguration.get(id) != null) { - from = (String) fromConfiguration.get(id); - } - - if (from != null) { - String fromFilter = "(|(instance.name=" + from + ")(service.pid=" + from + "))"; - if (agg) { - warn("The 'from' attribute is incompatible with aggregate requirements: only one provider will " + - "match : " + fromFilter); - } - if (fil != null) { - fil = "(&" + fromFilter + fil + ")"; // Append the two filters - } else { - fil = fromFilter; - } - } - - Filter filter = null; - if (fil != null) { - try { - filter = getInstanceManager().getContext().createFilter(fil); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("A requirement filter is invalid : " + filter, e); - } - } - - String prox = deps[i].getAttribute("proxy"); - // Use proxy by default except for array: - boolean proxy = prox == null || prox.equals("true"); - - if (prox == null && proxy) { // Proxy set because of the default. - if (agg && !collection) { // Aggregate and array - proxy = false; - } - } - - if (proxy && agg) { - if (!collection) { - error("Proxied aggregate temporal dependencies cannot be an array. Only collections are supported"); - } - } - - long timeout = DEFAULT_TIMEOUT; - if (deps[i].containsAttribute("timeout")) { - String to = deps[i].getAttribute("timeout"); - if (to.equalsIgnoreCase("infinite") || to.equalsIgnoreCase("-1")) { - timeout = Long.MAX_VALUE; // Infinite wait time ... - } else { - timeout = new Long(deps[i].getAttribute("timeout")).longValue(); - } - } - - int policy = NO_POLICY; - String di = null; - String onTimeout = deps[i].getAttribute("onTimeout"); - if (onTimeout != null) { - if (onTimeout.equalsIgnoreCase("nullable")) { - policy = NULLABLE; - } else if (onTimeout.equalsIgnoreCase("empty-array") || onTimeout.equalsIgnoreCase("empty")) { - policy = EMPTY; - if (!agg) { - // The empty array policy can only be used on aggregate dependencies - error("Cannot use the empty array policy for " + field + " : non aggregate dependency."); - } - } else if (onTimeout.equalsIgnoreCase("null")) { - policy = NULL; - } else if (onTimeout.length() > 0) { - di = onTimeout; - policy = DEFAULT_IMPLEMENTATION; - } - } - - Class specification = DependencyMetadataHelper.loadSpecification(spec, getInstanceManager().getContext()); - TemporalDependency dep = new TemporalDependency(specification, agg, collection, proxy, filter, getInstanceManager().getContext(), timeout, policy, di, this); - m_dependencies.add(dep); - - if (!proxy) { // Register method interceptor only if are not a proxy - MethodMetadata[] methods = manipulation.getMethods(); - for (int k = 0; k < methods.length; k++) { - getInstanceManager().register(methods[k], dep); - } - } - - getInstanceManager().register(fieldmeta, dep); - } - } - - /** - * Gets the requires filter configuration from the given object. - * The given object must come from the instance configuration. - * This method was made to fix FELIX-2688. It supports filter configuration using - * an array: - * {"myFirstDep", "(property1=value1)", "mySecondDep", "(property2=value2)"}); - *

- * Copied from DependencyHandler#getRequiresFilters(Object) - * - * @param requiresFiltersValue the value contained in the instance - * configuration. - * @return the dictionary. If the object in already a dictionary, just returns it, - * if it's an array, builds the dictionary. - * @throws ConfigurationException the dictionary cannot be built - */ - private Dictionary getRequiresFilters(Object requiresFiltersValue) - throws ConfigurationException { - if (requiresFiltersValue != null - && requiresFiltersValue.getClass().isArray()) { - String[] filtersArray = (String[]) requiresFiltersValue; - if (filtersArray.length % 2 != 0) { - throw new ConfigurationException( - "A requirement filter is invalid : " - + requiresFiltersValue); - } - Dictionary requiresFilters = new Hashtable(); - for (int i = 0; i < filtersArray.length; i += 2) { - requiresFilters.put(filtersArray[i], filtersArray[i + 1]); - } - return requiresFilters; - } - - return (Dictionary) requiresFiltersValue; - } - - /** - * Nothing to do. - * A temporal dependency is always valid. - * - * @param dependencymodel dependency. - * @see org.apache.felix.ipojo.util.DependencyStateListener#invalidate(org.apache.felix.ipojo.util.DependencyModel) - */ - public void invalidate(DependencyModel dependencymodel) { - } - - /** - * Nothing to do. - * A temporal dependency is always valid. - * - * @param dependencymodel dependency. - * @see org.apache.felix.ipojo.util.DependencyStateListener#validate(org.apache.felix.ipojo.util.DependencyModel) - */ - public void validate(DependencyModel dependencymodel) { - } - - -} diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml b/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml deleted file mode 100644 index e514b20fdd..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/metadata.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd b/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd deleted file mode 100644 index 48dbc7fe3a..0000000000 --- a/ipojo/handler/temporal/temporal-dependency-handler/src/main/resources/temporal.xsd +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - - - - Description of a temporal dependency. - - - - The implementation field supporting the dependency. - - - - The dependency id - - - - Filter use to discover matching filter. - - - Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait. - - - - Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached. - - - - - Enables or Disables the proxy injection - - - - - Specifies the looked service specification. This attribute is mandatory when injecting in a Collection - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/pom.xml b/ipojo/handler/transaction/pom.xml deleted file mode 100644 index c526e43a56..0000000000 --- a/ipojo/handler/transaction/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.handler.transaction-handler-project - 1.5.0-SNAPSHOT - Apache Felix iPOJO Transaction Handler Project - pom - - - transaction-handler - transaction-handler-it - - - - - - src/main/resources - - - . - META-INF - - LICENSE* - NOTICE* - DEPENDENCIES* - - - - - - - - release - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-assembly - package - - single - - - - project - - - false - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-assemblies - package - - attach-artifact - - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz - - project - tar.gz - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.zip - - project - zip - - - - - - - - - - - diff --git a/ipojo/handler/transaction/transaction-handler-it/pom.xml b/ipojo/handler/transaction/transaction-handler-it/pom.xml deleted file mode 100644 index f51dc5577c..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/pom.xml +++ /dev/null @@ -1,413 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - - 4.0.0 - pom - Apache Felix iPOJO Transaction Handler - Integration Test - org.apache.felix.ipojo.handler.transaction-it - 1.5.0-SNAPSHOT - - - 3.0.0 - 1.5.1 - - - - - ow2.snapshots - http://repository.ow2.org/nexus/content/repositories/snapshots/ - - - - - - org.ow2.chameleon.transaction - geronimo-transaction-service - 0.0.1-SNAPSHOT - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.ipojo.handler.transaction - ${project.version} - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo - 1.8.6 - test - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.0 - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - - - - junit - junit - 4.13.1 - test - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - - - - - - - test - - true - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - regular - - run - - - - felix - - ${project.build.directory}/regular - - - - - - - - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - 5.2.0 - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - 3.8.1.v20120830-144521 - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - - diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml deleted file mode 100644 index f118348293..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.handler.transaction-it - 1.5.0-SNAPSHOT - ../../../pom.xml - - - - ipojo-transaction-integration-test - ${project.artifactId} - - - - org.osgi - org.osgi.compendium - 4.2.0 - - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.8.6 - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java deleted file mode 100644 index 432f833ac3..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/ComponentUsingAnnotations.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ipojo.handler.transaction.components; - -import org.apache.felix.ipojo.annotations.Component; - -import javax.transaction.Transaction; - -@Component -@org.apache.felix.ipojo.transaction.Transaction(field="transaction") -public class ComponentUsingAnnotations { - - Transaction transaction; - - - @org.apache.felix.ipojo.transaction.Transactional - public void doSomethingBad() throws NullPointerException { - } - - @org.apache.felix.ipojo.transaction.Transactional(propagation="required") - public void doSomethingBad2() throws UnsupportedOperationException { - - } - - @org.apache.felix.ipojo.transaction.Transactional(propagation="supported", norollbackfor= {"java.lang.Exception"}) - public void doSomethingGood() { - - } - - @org.apache.felix.ipojo.transaction.Transactional(timeout=1000, exceptiononrollback=true) - public void doSomethingLong() { - - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java deleted file mode 100644 index b32ae26959..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooDelegator.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.ipojo.handler.transaction.components; - -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; - -import javax.transaction.Transaction; - -public class FooDelegator implements CheckService { - - Transaction transaction; - Transaction lastCommitted; - Transaction lastRolledback; - Transaction current; - private Foo foo; - private int commit; - private int rollback; - - public void onCommit(String method) { - commit++; - } - - public void onRollback(String method, Exception e) { - rollback++; - } - - public void doSomethingBad() throws NullPointerException { - current = transaction; - foo.doSomethingBad(); - } - - public void doSomethingBad2() throws UnsupportedOperationException { - current = transaction; - foo.doSomethingBad2(); - - } - - public void doSomethingGood() { - current = transaction; - foo.doSomethingGood(); - } - - public void doSomethingLong() { - current = transaction; - foo.doSomethingLong(); - } - - public Transaction getCurrentTransaction() { - return current; - } - - public int getNumberOfCommit() { - return commit; - } - - public int getNumberOfRollback() { - return rollback; - } - - public Transaction getLastRolledBack() { - return lastRolledback; - } - - public Transaction getLastCommitted() { - return lastCommitted; - } - - public void onRollback(Transaction t) { - lastRolledback = t; - rollback++; - } - - public void onCommit(Transaction t) { - lastCommitted = t; - commit++; - } - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java deleted file mode 100644 index 8ac81461d1..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/components/FooImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ipojo.handler.transaction.components; - -import org.apache.felix.ipojo.handler.transaction.services.Foo; - -public class FooImpl implements Foo { - - public void doSomethingBad() throws NullPointerException { - throw new NullPointerException("NULL"); - } - - public void doSomethingBad2() throws UnsupportedOperationException { - throw new UnsupportedOperationException("Expected exception"); - - } - - public void doSomethingGood() { - // Good... - } - - public void doSomethingLong() { - try { - Thread.sleep(5000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - } - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java deleted file mode 100644 index f2c978f5d4..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/CheckService.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.handler.transaction.services; - -import javax.transaction.Transaction; - -public interface CheckService { - - public void doSomethingGood(); - - public void doSomethingBad() throws NullPointerException; - - public void doSomethingBad2() throws UnsupportedOperationException; - - public void doSomethingLong(); - - public int getNumberOfCommit(); - - public int getNumberOfRollback(); - - public Transaction getCurrentTransaction(); - - public Transaction getLastRolledBack(); - - public Transaction getLastCommitted(); - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java deleted file mode 100644 index 91079799af..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/java/org/apache/felix/ipojo/handler/transaction/services/Foo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.handler.transaction.services; - -public interface Foo { - - public void doSomethingGood(); - - public void doSomethingBad() throws NullPointerException; - - public void doSomethingBad2() throws UnsupportedOperationException; - - public void doSomethingLong(); - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml deleted file mode 100644 index 97fa837bd9..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/annotation.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml deleted file mode 100644 index 2bc6421c40..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/foo.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml deleted file mode 100644 index b9c74a1d4f..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/mandatory.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml deleted file mode 100644 index bad5164b91..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/never.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml deleted file mode 100644 index 88088541b6..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/notsupported.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml deleted file mode 100644 index f209c65de3..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requires.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml deleted file mode 100644 index 0fcc9e9a8f..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/requiresnew.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml deleted file mode 100644 index 7a56e5f2cc..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/main/resources/supported.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java deleted file mode 100644 index 87aa4c1244..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/Common.java +++ /dev/null @@ -1,217 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.TrueFileFilter; -import org.junit.After; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.options.CompositeOption; -import org.ops4j.pax.exam.options.DefaultCompositeOption; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static junit.framework.Assert.fail; -import static org.ops4j.pax.exam.CoreOptions.*; -import static org.ops4j.pax.exam.MavenUtils.asInProject; - -/** - * Bootstrap the test from this project - */ -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerMethod.class) -public class Common { - - @Inject - BundleContext context; - OSGiHelper osgiHelper; - IPOJOHelper ipojoHelper; - - public static Option junitAndMockitoBundles() { - return new DefaultCompositeOption( - // Repository required to load harmcrest (OSGi-fied version). - repository("http://repository.springsource.com/maven/bundles/external").id( - "com.springsource.repository.bundles.external"), - - // Hamcrest with a version matching the range expected by Mockito - mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"), - - // Mockito core does not includes Hamcrest - mavenBundle("org.mockito", "mockito-core", "1.9.5"), - - // Objenesis with a version matching the range expected by Mockito - wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2")) - .exports("*;version=1.2"), - - // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of - // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets - // resolved correctly. - CoreOptions.junitBundles(), - - /* - * Felix has implicit boot delegation enabled by default. It conflicts with Mockito: - * java.lang.LinkageError: loader constraint violation in interface itable initialization: - * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc - * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader - * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class, - * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader - * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface - * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/ - * proxy/Callback used in the signature - * - * So we disable the bootdelegation. this property has no effect on the other OSGi implementation. - */ - frameworkProperty("felix.bootdelegation.implicit").value("false") - ); - } - - public static CompositeOption ipojoBundles() { - return new DefaultCompositeOption( - mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(), - mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(), - // The tested handler - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.transaction").versionAsInProject() - ); - } - - @Configuration - public Option[] config() throws IOException { - Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - root.setLevel(Level.DEBUG); - - return options( - cleanCaches(), - ipojoBundles(), - junitBundles(), - //testedBundle(), // Each test is doing its own deployment. - systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN"), - provision( - mavenBundle().groupId("org.ow2.chameleon.transaction").artifactId("geronimo-transaction-service").version(asInProject()) - ), - systemPackage("javax.transaction;version>=1.1.0") - ); - } - - @Before - public void commonSetUp() { - osgiHelper = new OSGiHelper(context); - ipojoHelper = new IPOJOHelper(context); - - // Dump OSGi Framework information - String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR); - if (vendor == null) { - vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); - } - String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION); - System.out.println("OSGi Framework : " + vendor + " - " + version); - } - - @After - public void commonTearDown() { - ipojoHelper.dispose(); - osgiHelper.dispose(); - } - - public Option testedBundle() throws MalformedURLException { - File out = new File("target/tested/bundle.jar"); - - TinyBundle tested = TinyBundles.bundle(); - - // We look inside target/classes to find the class and resources - File classes = new File("target/classes"); - Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); - List services = new ArrayList(); - for (File file : files) { - if (file.isDirectory()) { - // By convention we export of .services and .service package - if (file.getName().endsWith("services") || file.getName().endsWith("service")) { - services.add(file); - } - } else { - // We need to compute the path - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1); - tested.add(path, file.toURI().toURL()); - System.out.println(file.getName() + " added to " + path); - } - } - - String export = ""; - for (File file : services) { - if (export.length() > 0) { - export += ", "; - } - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() + 1); - String packageName = path.replace('/', '.'); - export += packageName; - } - - System.out.println("Exported packages : " + export); - - InputStream inputStream = tested - .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle") - //.set(Constants.IMPORT_PACKAGE, "*") - //.set(Constants.EXPORT_PACKAGE, export) // No export... - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources"))); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the manipulated bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the manipulated bundle"); - } - } - - public void assertContains(String s, String[] arrays, String object) { - for (String suspect : arrays) { - if (object.equals(suspect)) { - return; - } - } - fail("Assertion failed : " + s); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java deleted file mode 100644 index 2e96e299c4..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestAnnotations.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.handler.transaction.components.ComponentUsingAnnotations; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Bundle; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.*; -import static org.ops4j.pax.exam.MavenUtils.asInProject; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestAnnotations extends Common { - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(TinyBundles.withBnd()); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(ComponentUsingAnnotations.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "TransactionAnnotationTest") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "annotation.xml"))); - - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - ), - repository("http://maven.ow2.org/maven2-snapshot/") - ); - } - - @Test - public void annotations() { - Element elem = IPOJOHelper.getMetadata(getBundle(), "org.apache.felix.ipojo.handler.transaction.components.ComponentUsingAnnotations"); - Assert.assertNotNull(elem); - - Element tr = elem.getElements("transaction", "org.apache.felix.ipojo.transaction")[0]; - Assert.assertEquals("transaction", tr.getAttribute("field")); - - Assert.assertNull(tr.getAttribute("oncommit")); - Assert.assertNull(tr.getAttribute("onrollback")); - - Element[] methods = tr.getElements(); - Assert.assertEquals(4, methods.length); - - Element m1 = getElementByMethod(methods, "doSomethingBad"); - Assert.assertNotNull(m1); - - Element m2 = getElementByMethod(methods, "doSomethingBad2"); - Assert.assertNotNull(m2); - Assert.assertEquals("required", m2.getAttribute("propagation")); - - Element m3 = getElementByMethod(methods, "doSomethingGood"); - Assert.assertNotNull(m3); - Assert.assertEquals("supported", m3.getAttribute("propagation")); - Assert.assertEquals("{java.lang.Exception}", m3.getAttribute("norollbackfor")); - - Element m4 = getElementByMethod(methods, "doSomethingLong"); - Assert.assertNotNull(m4); - Assert.assertEquals("1000", m4.getAttribute("timeout")); - Assert.assertEquals("true", m4.getAttribute("exceptiononrollback")); - } - - private Element getElementByMethod(Element[] e, String m) { - for (Element elem : e) { - if (m.equals(elem.getAttribute("method"))) { - return elem; - } - } - Assert.fail("Method " + m + " not found"); - return null; - } - - private Bundle getBundle() { - for (Bundle b : context.getBundles()) { - System.out.println(b.getSymbolicName()); - if ("TransactionAnnotationTest".equals(b.getSymbolicName())) { - return b; - } - } - Assert.fail("Cannot find the tested bundle"); - return null; - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java deleted file mode 100644 index 8f68dc391a..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInstallation.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Bundle; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ops4j.pax.exam.CoreOptions.options; -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ops4j.pax.exam.MavenUtils.asInProject; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestInstallation extends Common { - - public static final File TEST = new File("src/main/resources"); - - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "RequiredTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "requires.xml"))); - - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - } - - @Test - public void install() throws NotSupportedException, SystemException, IllegalStateException, - SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException, InvalidSyntaxException { - Bundle[] bundles = context.getBundles(); - for (Bundle b : bundles) { - System.out.println("Bundle : " + b.getSymbolicName() + " - " + b.getState()); - Assert.assertTrue(b.getSymbolicName(), b.getState() == Bundle.ACTIVE); - } - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - // Transaction Service available - osgiHelper.isServiceAvailable(TransactionManager.class.getName()); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Assert.assertNotNull(tm.getTransaction()); - tm.commit(); - - tm.begin(); - Assert.assertNotNull(tm.getTransaction()); - tm.rollback(); - - // Handler exposed - ServiceReference ref = osgiHelper.getServiceReference(HandlerFactory.class.getName(), "(&(handler.name=transaction)(handler.namespace=org.apache.felix.ipojo.transaction))"); - Assert.assertNotNull(ref); - - // Create an install of the components - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference[] refs = context.getAllServiceReferences(CheckService.class.getName(), "(instance.name=" + under.getInstanceName() + ")"); - -// ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(refs); - - ((CheckService) osgiHelper.getServiceObject(refs[0])).doSomethingGood(); - } - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java deleted file mode 100644 index caf1e59bdb..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestInvalidation.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestInvalidation extends Common { - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "RequiredTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "requires.xml"))); - - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - } - - @Test - public void testInvalidation() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - final ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - - Thread thread = new Thread(new Runnable() { - public void run() { - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - prov.dispose(); - } - }); - - thread.start(); - - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingLong(); // 5s, so prov should be disposed during this time and under becomes invalid - - Assert.assertEquals(ComponentInstance.INVALID, under.getState()); - - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.rollback(); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java deleted file mode 100644 index 8edec8325b..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestMandatory.java +++ /dev/null @@ -1,397 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - - -public class TestMandatory extends Common { - - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MandatoryTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "mandatory.xml"))); - - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - - } - - @Test(expected = RuntimeException.class) - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); // Fail ! - } - - @Test - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - } - - @Test(expected = RuntimeException.class) - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // Fail, RTE thrown before the other exception - } - - @Test(expected = RollbackException.class) - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.commit(); // Throws a rollback exception. - } - - @Test - public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.rollback(); - } - - @Test(expected = RuntimeException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); // Throws a RTE - } - - @Test - public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } - - @Test(expected = RuntimeException.class) - public void testOkOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingGood(); // Throws a RTE. - - } - - @Test - public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - @Test(expected = RuntimeException.class) - public void testExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad(); // Thows a RTE. - - } - - @Test - public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - try { - t.commit(); // Throw a rollback exception. - } catch (RollbackException e) { - // Expected - } catch (Throwable e) { - Assert.fail(e.getMessage()); // Unexpected - } - - Assert.assertNotNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(1, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastRolledBack()); - } - - @Test(expected = RuntimeException.class) - public void testExpectedExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad2(); - - - } - - @Test - public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("mandatory-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java deleted file mode 100644 index d8c6b592ab..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNever.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestNever extends Common { - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "NeverTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "never.xml"))); - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - } - - @Test - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("never-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); - } - - @Test(expected = RuntimeException.class) - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("never-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - cs.doSomethingGood(); // Fail - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("never-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // Throws an NPE - } - - @Test - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("never-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); // Fail - Assert.fail("RuntimeException expected"); - } catch (RuntimeException e) { - // Ok :-) - } - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.rollback(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("never-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java deleted file mode 100644 index b9fdd96980..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestNotSupported.java +++ /dev/null @@ -1,403 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -@ExamReactorStrategy(PerClass.class) -public class TestNotSupported extends Common { - - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "NotSupportedTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "notsupported.xml"))); - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - } - - @Test - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = ((CheckService) osgiHelper.getServiceObject(ref)); - cs.doSomethingGood(); - // No transaction. - } - - @Test - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); // Is executed in the transaction despite it's not supported. - Assert.assertSame(t2, t); - t.commit(); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); - } - - @Test - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No impact on the transaction. - - t.commit(); // Ok. - } - - @Test - public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No impact on the transaction. - - t.rollback(); // Ok. - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); - } - - @Test - public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } - - @Test - public void testOkOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingGood(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); // No effect on the transaction - - try { - t.commit(); // Throw a rollback exception. - } catch (RollbackException e) { - // Expected - } catch (Throwable e) { - Assert.fail(e.getMessage()); // Unexpected - } - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad2(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("notsupported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java deleted file mode 100644 index 62212935e0..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequires.java +++ /dev/null @@ -1,406 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestRequires extends Common { - - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "RequiresTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "requires.xml"))); - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - - } - - @Test - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); - } - - @Test - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); - } - - @Test(expected = RollbackException.class) - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.commit(); // Throw a rollback exception. - } - - @Test - public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.rollback(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); - } - - @Test - public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } - - @Test - public void testOkOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingGood(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad(); - - Assert.assertNotNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(1, cs.getNumberOfRollback()); - } - - @Test - public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - try { - t.commit(); // Throw a rollback exception. - } catch (RollbackException e) { - // Expected - } catch (Throwable e) { - Assert.fail(e.getMessage()); // Unexpected - } - - Assert.assertNotNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(1, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastRolledBack()); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad2(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requires-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java deleted file mode 100644 index b18733f9ab..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestRequiresNew.java +++ /dev/null @@ -1,219 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -public class TestRequiresNew extends Common { - - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "RequiresNewTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "requiresnew.xml"))); - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - ) - ); - - - } - - @Test - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingGood(); // Ok - } - - @Test - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertNotSame(t2, t); // Two different transactions - // Check that t2 is commited => no transaction - Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus()); - t.commit(); - } - - @Test - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - try { - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); // throws an exception on rollback - Assert.fail("Exception expected on rollback"); - } catch (IllegalStateException e) { - // Ok. - } catch (Exception e) { - Assert.fail("IllegalStateException expected on rollback"); - } - } - - @Test - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("IllegalStateException expected"); // throws an exception on rollback - } catch (Exception e) { - Assert.assertTrue(e instanceof IllegalStateException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertNotSame(t2, t); - // Check that t2 is rolledback - Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus()); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); - } - - @Test - public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("requiresnew-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertNotSame(t2, t); - Assert.assertEquals(Status.STATUS_NO_TRANSACTION, t2.getStatus()); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java b/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java deleted file mode 100644 index f36c4e6acb..0000000000 --- a/ipojo/handler/transaction/transaction-handler-it/src/it/transaction-it/src/test/java/org/apache/felix/ipojo/handler/transaction/test/TestSupported.java +++ /dev/null @@ -1,411 +0,0 @@ -/* - * 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.ipojo.handler.transaction.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handler.transaction.components.FooDelegator; -import org.apache.felix.ipojo.handler.transaction.components.FooImpl; -import org.apache.felix.ipojo.handler.transaction.services.CheckService; -import org.apache.felix.ipojo.handler.transaction.services.Foo; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; - -import javax.transaction.*; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.provision; -import static org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy.withiPOJO; - -@ExamReactorStrategy(PerClass.class) -public class TestSupported extends Common { - - - public static final File TEST = new File("src/main/resources"); - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - - InputStream service = TinyBundles.bundle() - .add(CheckService.class) - .add(Foo.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Service") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(); - - InputStream fooimpl = TinyBundles.bundle() - .add(FooImpl.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Foo Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services") - .build(withiPOJO(new File(TEST, "foo.xml"))); - - InputStream test = TinyBundles.bundle() - .add(FooDelegator.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "SupportedTransactionPropagation") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.handler.transaction.services, javax.transaction;version=1.1") - .build(withiPOJO(new File(TEST, "supported.xml"))); - - return OptionUtils.combine( - options, - provision( - service, - fooimpl, - test - )); - } - - @Test - public void testOkOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = ((CheckService) osgiHelper.getServiceObject(ref)); - cs.doSomethingGood(); - // No transaction. - } - - @Test - public void testOkInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad(); - } - - @Test(expected = RollbackException.class) - public void testExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.commit(); // Throw a rollback exception. - } - - @Test - public void testExceptionInsideTransactionRB() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - t.rollback(); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransaction() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - ((CheckService) osgiHelper.getServiceObject(ref)).doSomethingBad2(); - } - - @Test - public void testExpectedExceptionInsideTransaction() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-ok"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - } - - @Test - public void testOkOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingGood(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testOkInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - cs.doSomethingGood(); - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - @Test(expected = NullPointerException.class) - public void testExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad(); - Assert.fail("NullPointerException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof NullPointerException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_MARKED_ROLLBACK, t.getStatus()); - - try { - t.commit(); // Throw a rollback exception. - } catch (RollbackException e) { - // Expected - } catch (Throwable e) { - Assert.fail(e.getMessage()); // Unexpected - } - - Assert.assertNotNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(1, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastRolledBack()); - } - - @Test(expected = UnsupportedOperationException.class) - public void testExpectedExceptionOutsideTransactionWithCallback() { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - - cs.doSomethingBad2(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNull(cs.getLastCommitted()); - Assert.assertEquals(0, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - } - - @Test - public void testExpectedExceptionInsideTransactionWithCallback() throws NotSupportedException, SystemException, SecurityException, HeuristicMixedException, HeuristicRollbackException, RollbackException { - ComponentInstance prov = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.handler.transaction.components.FooImpl"); - ComponentInstance under = ipojoHelper.createComponentInstance("supported-cb"); - - Assert.assertEquals(ComponentInstance.VALID, prov.getState()); - Assert.assertEquals(ComponentInstance.VALID, under.getState()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), under.getInstanceName()); - Assert.assertNotNull(ref); - - osgiHelper.waitForService(TransactionManager.class.getName(), null, 5000); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - TransactionManager tm = (TransactionManager) osgiHelper.getServiceObject(TransactionManager.class.getName(), null); - tm.begin(); - Transaction t = tm.getTransaction(); - try { - cs.doSomethingBad2(); - Assert.fail("UnsupportedOperationException expected"); - } catch (Exception e) { - Assert.assertTrue(e instanceof UnsupportedOperationException); - } - Transaction t2 = cs.getCurrentTransaction(); - Assert.assertSame(t2, t); - Assert.assertEquals(Status.STATUS_ACTIVE, t.getStatus()); - - t.commit(); - - Assert.assertNull(cs.getLastRolledBack()); - Assert.assertNotNull(cs.getLastCommitted()); - Assert.assertEquals(1, cs.getNumberOfCommit()); - Assert.assertEquals(0, cs.getNumberOfRollback()); - - Assert.assertSame(t, cs.getLastCommitted()); - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/transaction/transaction-handler-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/transaction/transaction-handler/pom.xml b/ipojo/handler/transaction/transaction-handler/pom.xml deleted file mode 100644 index 9c09988238..0000000000 --- a/ipojo/handler/transaction/transaction-handler/pom.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - org.apache.felix.ipojo.handler.transaction - - 1.5.0-SNAPSHOT - Apache Felix iPOJO Transaction Handler - - - - - org.apache.felix - maven-bundle-plugin - 1.4.3 - true - - - ${project.artifactId} - org.apache.felix.ipojo.transaction - javax.transaction;version=1.1, * - - - - - org.apache.felix - maven-ipojo-plugin - 1.8.4 - - - - ipojo-bundle - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - - - - - org.apache.felix - org.apache.felix.ipojo - 1.9.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.ipojo.metadata - 1.4.0 - - - geronimo-spec - geronimo-spec-jta - 1.0-M1 - - - diff --git a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/transaction/transaction-handler/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java b/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java deleted file mode 100644 index d0eea3f714..0000000000 --- a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionHandler.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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.ipojo.transaction; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import javax.transaction.Status; -import javax.transaction.Synchronization; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.FieldMetadata; -import org.apache.felix.ipojo.parser.MethodMetadata; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.apache.felix.ipojo.util.Callback; - -public class TransactionHandler extends PrimitiveHandler implements Synchronization { - - public static final String NAMESPACE= "org.apache.felix.ipojo.transaction"; - - public static final String NAME= "transaction"; - - private static final String FIELD_ATTRIBUTE= "field"; - - private static final String ONCOMMIT_ATTRIBUTE= "oncommit"; - - private static final String ONROLLBACK_ATTRIBUTE= "onrollback"; - - private static final String TRANSACTIONAL_ELEMENT = "transactional"; - - private static final String METHOD_ATTRIBUTE = "method"; - - private static final String TIMEOUT_ATTRIBUTE = "timeout"; - - private static final String PROPAGATION_ATTRIBUTE = "propagation"; - - private static final String EXCEPTIONONROLLBACK_ATTRIBUTE = "exceptiononrollback"; - - private static final String NOROLLBACKFOR_ATTRIBUTE = "norollbackfor"; - - public static final int DEFAULT_PROPAGATION = TransactionalMethod.REQUIRES; - - - private TransactionManager m_transactionManager; // Service Dependency - - private List m_methods = new ArrayList(); - - private Callback m_onRollback; - - private Callback m_onCommit; - - private List m_transactions = new ArrayList(); - - - public void configure(Element arg0, Dictionary arg1) - throws ConfigurationException { - Element[] elements = arg0.getElements(NAME, NAMESPACE); - if (elements.length > 1) { - throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + " cannot be declared several times"); - } - - String field = elements[0].getAttribute(FIELD_ATTRIBUTE); - if (field != null) { - FieldMetadata meta = getPojoMetadata().getField(field); - if (meta == null) { - throw new ConfigurationException("The transaction field does not exist in the pojo class : " + field); - } - if (! meta.getFieldType().equals(Transaction.class.getName())) { - throw new ConfigurationException("The transaction field type must be " + Transaction.class.getName()); - } - // Register the interceptor - getInstanceManager().register(meta, this); - - } - - String oncommit = elements[0].getAttribute(ONCOMMIT_ATTRIBUTE); - if (oncommit != null) { - m_onCommit = new Callback(oncommit, new String[] { Transaction.class.getName() }, false, getInstanceManager()); - } - - String onrollback = elements[0].getAttribute(ONROLLBACK_ATTRIBUTE); - if (onrollback != null) { - m_onRollback = new Callback(onrollback, new String[] { Transaction.class.getName() }, false, getInstanceManager()); - } - - - Element[] sub = elements[0].getElements(TRANSACTIONAL_ELEMENT); - if (sub == null || sub.length == 0) { - throw new ConfigurationException("The handler " + NAMESPACE + ":" + NAME + " must have " + TRANSACTIONAL_ELEMENT + " subelement"); - } - - for (int i = 0; i < sub.length; i++) { - String method = sub[i].getAttribute(METHOD_ATTRIBUTE); - String to = sub[i].getAttribute(TIMEOUT_ATTRIBUTE); - String propa = sub[i].getAttribute(PROPAGATION_ATTRIBUTE); - String nrbf = sub[i].getAttribute(NOROLLBACKFOR_ATTRIBUTE); - String eorb = sub[i].getAttribute(EXCEPTIONONROLLBACK_ATTRIBUTE); - - if (method == null) { - throw new ConfigurationException("A transactional element must specified the method attribute"); - } - MethodMetadata meta = this.getPojoMetadata().getMethod(method); - if (meta == null) { - throw new ConfigurationException("A transactional method is not in the pojo class : " + method); - } - - int timeout = 0; - if (to != null) { - timeout = new Integer(to).intValue(); - } - - int propagation = DEFAULT_PROPAGATION; - if (propa != null) { - propagation = parsePropagation(propa); - } - - List exceptions = new ArrayList(); - if (nrbf != null) { - exceptions = (List) ParseUtils.parseArraysAsList(nrbf); - } - - boolean exceptionOnRollback = false; - if (eorb != null) { - exceptionOnRollback = new Boolean(eorb).booleanValue(); - } - - TransactionalMethod tm = new TransactionalMethod(method, propagation, timeout, exceptions, exceptionOnRollback, this); - m_methods.add(tm); - this.getInstanceManager().register(meta, tm); - } - - } - - private int parsePropagation(String propa) throws ConfigurationException { - if (propa.equalsIgnoreCase("requires")) { - return TransactionalMethod.REQUIRES; - - } else if (propa.equalsIgnoreCase("mandatory")){ - return TransactionalMethod.MANDATORY; - - } else if (propa.equalsIgnoreCase("notsupported")) { - return TransactionalMethod.NOT_SUPPORTED; - - } else if (propa.equalsIgnoreCase("supported")) { - return TransactionalMethod.SUPPORTED; - - } else if (propa.equalsIgnoreCase("never")) { - return TransactionalMethod.NEVER; - - } else if (propa.equalsIgnoreCase("requiresnew")) { - return TransactionalMethod.REQUIRES_NEW; - } - - throw new ConfigurationException("Unknown propgation policy : " + propa); - } - - public void start() { - // Set transaction managers. - for (TransactionalMethod method : m_methods) { - method.setTransactionManager(m_transactionManager); - } - } - - public void stop() { - // Nothing to do. - } - - public synchronized void bind(TransactionManager tm) { - for (TransactionalMethod method : m_methods) { - method.setTransactionManager(tm); - } - } - - public synchronized void unbind(TransactionManager tm) { - for (TransactionalMethod method : m_methods) { - method.setTransactionManager(null); - } - } - - public void transactionRolledback(Transaction t) { - if (m_onRollback != null) { - try { - m_onRollback.call(new Object[] { t }); - } catch (NoSuchMethodException e1) { - error("Cannot invoke the onRollback method, method not found", - e1); - } catch (IllegalAccessException e1) { - error( - "Cannot invoke the onRollback method,cannot access the method", - e1); - } catch (InvocationTargetException e1) { - error( - "Cannot invoke the onRollback method,the method thrown an exception", - e1.getTargetException()); - } - } - } - - public void transactionCommitted(Transaction t) { - if (m_onRollback != null) { - try { - m_onCommit.call(new Object[] { t }); - } catch (NoSuchMethodException e1) { - error("Cannot invoke the onCommit callback, method not found", - e1); - } catch (IllegalAccessException e1) { - error( - "Cannot invoke the onCommit callback,cannot access the method", - e1); - } catch (InvocationTargetException e1) { - error( - "Cannot invoke the onCommit callback,the method thrown an exception", - e1.getTargetException()); - } - } - - } - - public void stateChanged(int newState) { - if (newState == ComponentInstance.INVALID) { - // rollback all owned transactions. - for (int i = 0; i < m_methods.size(); i++) { - m_methods.get(i).rollbackOwnedTransactions(); - } - - for (int i =0; i < m_transactions.size(); i++) { - try { - m_transactions.get(i).setRollbackOnly(); - } catch (Exception e) { - error("Cannot set rollback only on a transaction : " + e.getMessage()); - } - } - } - } - - public synchronized Object onGet(Object pojo, String fieldName, Object value) { - try { - if (m_transactionManager != null) { - return m_transactionManager.getTransaction(); - } else { - return null; - } - } catch (SystemException e) { - error("Cannot get the current transaction, internal error", e); - return null; - } - } - - public void afterCompletion(int arg0) { - try { - if (m_transactionManager.getTransaction() != null) { - m_transactions .remove(m_transactionManager.getTransaction()); - if (arg0 == Status.STATUS_ROLLEDBACK) { - transactionRolledback(m_transactionManager.getTransaction()); - } else if (arg0 == Status.STATUS_COMMITTED) { - transactionCommitted(m_transactionManager.getTransaction()); - } - } - } catch (SystemException e) { - error("Cannot remove the transaction from the transaction list : " + e.getMessage()); - } - } - - public void beforeCompletion() { - - } - - public void addTransaction(Transaction transaction) { - if (m_transactions.contains(transaction)) { - return; - } - try { - transaction.registerSynchronization(this); - m_transactions.add(transaction); - } catch (Exception e) { - error("Cannot add the transaction to the transaction list : " + e.getMessage()); - } - } - - public List getTransactions() { - return m_transactions; - } - - -} diff --git a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java b/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java deleted file mode 100644 index df06423a44..0000000000 --- a/ipojo/handler/transaction/transaction-handler/src/main/java/org/apache/felix/ipojo/transaction/TransactionalMethod.java +++ /dev/null @@ -1,306 +0,0 @@ -/* - * 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.ipojo.transaction; - -import java.lang.reflect.Member; -import java.lang.reflect.Method; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import javax.transaction.HeuristicMixedException; -import javax.transaction.HeuristicRollbackException; -import javax.transaction.InvalidTransactionException; -import javax.transaction.NotSupportedException; -import javax.transaction.RollbackException; -import javax.transaction.SystemException; -import javax.transaction.Transaction; -import javax.transaction.TransactionManager; - -import org.apache.felix.ipojo.MethodInterceptor; - -public class TransactionalMethod implements MethodInterceptor { - - public static final int REQUIRES = 0; - - public static final int REQUIRES_NEW = 1; - - public static final int MANDATORY = 2; - - public static final int SUPPORTED = 3; - - public static final int NOT_SUPPORTED = 4; - - public static final int NEVER = 5; - - private String method; - - private int propagation; - - private int timeout; - - private List exceptions; - - private TransactionManager manager; - - private Map m_owned = new HashMap(); - - private boolean exceptionOnRollback; - - - private TransactionHandler handler; - - private Transaction suspended; - - public TransactionalMethod(String method, int propagation, int timeout, List exception, boolean exceptionOnRollback, TransactionHandler handler) { - this.method = method; - this.propagation = propagation; - this.timeout = timeout; - this.exceptions = exception; - this.exceptionOnRollback = exceptionOnRollback; - this.handler = handler; - } - - public synchronized void setTransactionManager(TransactionManager tm) { - manager = tm; - if (manager == null) { - // Clear stored transactions. - m_owned.clear(); - - } - } - - - public void onEntry() throws SystemException, NotSupportedException { - TransactionManager manager = null; - synchronized (this) { - if (this.manager != null) { - manager = this.manager; // Stack confinement - } else { - return; // Nothing can be done... - } - } - - Transaction transaction = manager.getTransaction(); - switch (propagation) { - case REQUIRES: - // Are we already in a transaction? - if (transaction == null) { - // No, create one - if (timeout > 0) { - manager.setTransactionTimeout(timeout); - } - manager.begin(); - m_owned.put(Thread.currentThread(), manager.getTransaction()); - } else { - // Add the transaction to the transaction list - handler.addTransaction(transaction); - } - break; - case MANDATORY: - if (transaction == null) { - // Error - throw new IllegalStateException("The method " + method + " must be called inside a transaction"); - } else { - // Add the transaction to the transaction list - handler.addTransaction(transaction); - } - break; - case SUPPORTED: - // if transaction != null, register the callback, else do nothing - if (transaction != null) { - handler.addTransaction(transaction); - } // Else do nothing. - break; - case NOT_SUPPORTED: - // Do nothing. - break; - case NEVER: - if (transaction != null) { - throw new IllegalStateException("The method " + method + " must never be called inside a transaction"); - } - break; - case REQUIRES_NEW: - if (transaction == null) { - // No current transaction, Just creates a new one - if (timeout > 0) { - manager.setTransactionTimeout(timeout); - } - manager.begin(); - m_owned.put(Thread.currentThread(), manager.getTransaction()); - } else { - if (suspended == null) { - suspended = manager.suspend(); - if (timeout > 0) { - manager.setTransactionTimeout(timeout); - } - manager.begin(); - m_owned.put(Thread.currentThread(), manager.getTransaction()); - } else { - throw new IllegalStateException("The method " + method + " requires to suspend a second times a transaction"); - } - } - break; - default: - throw new UnsupportedOperationException("Unknown or unsupported propagation policy for " + method + " :" + propagation); - - } - } - - public void onExit() throws SecurityException, HeuristicMixedException, HeuristicRollbackException, SystemException, InvalidTransactionException, IllegalStateException { - switch (propagation) { - case REQUIRES: - // Are we the owner of the transaction? - Transaction transaction = m_owned.get(Thread.currentThread()); - if (transaction != null) { // Owner. - try { - transaction.commit(); // Commit the transaction - m_owned.remove(Thread.currentThread()); - handler.transactionCommitted(transaction); // Manage potential notification. - } catch ( RollbackException e) { - m_owned.remove(Thread.currentThread()); - // The transaction was rolledback - if (exceptionOnRollback) { - throw new IllegalStateException("The transaction was rolled back : " + e.getMessage()); - } - handler.transactionRolledback(transaction); // Manage potential notification. - } - } // Else wait for commit. - break; - case MANDATORY: - // We are never the owner, so just exits the transaction. - break; - case SUPPORTED: - // Do nothing. - break; - case NOT_SUPPORTED: - // Do nothing. - break; - case NEVER: - // Do nothing. - break; - case REQUIRES_NEW: - // We're necessary the owner. - transaction = m_owned.get(Thread.currentThread()); - if (transaction == null) { - throw new RuntimeException("Cannot apply the REQUIRES NEW propagation, we're not the transaction owner!"); - } - try { - transaction.commit(); // Commit the transaction - m_owned.remove(Thread.currentThread()); - handler.transactionCommitted(transaction); // Manage potential notification. - if (suspended != null) { - manager.suspend(); // suspend the completed transaction. - manager.resume(suspended); - suspended = null; - } - } catch ( RollbackException e) { // The transaction was rolledback rather than committed - m_owned.remove(Thread.currentThread()); - if (suspended != null) { - manager.suspend(); // suspend the completed transaction. - manager.resume(suspended); // The resume transaction is not rolledback, they are independent. - suspended = null; - } - // The transaction was rolledback - if (exceptionOnRollback) { - throw new IllegalStateException("The transaction was rolled back : " + e.getMessage()); - } - handler.transactionRolledback(transaction); // Manage potential notification. - } - break; - default: - throw new UnsupportedOperationException("Unknown or unsupported propagation policy for " + method + " :" + propagation); - - } - } - - public void onError(String exception) throws SystemException { - TransactionManager manager = null; - synchronized (this) { - if (this.manager != null) { - manager = this.manager; // Stack confinement - } else { - return; // Nothing can be done... - } - } - - // is the error something to exclude, and are we inside the transaction (owner or participant)? - if (! exceptions.contains(exception)) { - Transaction tr = manager.getTransaction(); - if (m_owned.containsValue(tr) || handler.getTransactions().contains(tr)) { - // Set the transaction to rollback only - manager.getTransaction().setRollbackOnly(); - } - } - } - - public void onEntry(Object o, Member member, Object[] objects) { - try { - onEntry(); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage()); - } - - } - - public void onError(Object o, Member member, Throwable throwable) { - try { - throwable.printStackTrace(); - - onError(throwable.getClass().getName()); - } catch (Exception e) { - e.printStackTrace(); - throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage()); - } - } - - public void onExit(Object o, Member member, Object o1) { - // Wait for on finally. - } - - public void onFinally(Object o, Member member) { - try { - onExit(); - } catch (IllegalStateException e) { - throw e; - } catch (Exception e) { - throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage()); - } - } - - public void rollbackOwnedTransactions() { - Iterator> entries = m_owned.entrySet().iterator(); - while(entries.hasNext()) { - Entry entry = entries.next(); - try { - entry.getValue().rollback(); - } catch (IllegalStateException e) { - throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage()); - } catch (SystemException e) { - throw new RuntimeException("An issue occurs during transaction management of " + method + " : " + e.getMessage()); - } - } - m_owned.clear(); - } - -} diff --git a/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml b/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml deleted file mode 100644 index 8b91423259..0000000000 --- a/ipojo/handler/transaction/transaction-handler/src/main/resources/metadata.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/whiteboard/changelog.txt b/ipojo/handler/whiteboard/changelog.txt deleted file mode 100644 index 01992b4bb1..0000000000 --- a/ipojo/handler/whiteboard/changelog.txt +++ /dev/null @@ -1,33 +0,0 @@ -Changes from 1.4.0 to 1.6.0 ----------------------------- -** Bug - * [FELIX-2581] - White Board Pattern onActivate called before @Validate - -** Improvement - * [FELIX-2624] - Support multiple whiteboards using annotations - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-944] - Fix white-board pattern handler symbolic name - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/handler/whiteboard/pom.xml b/ipojo/handler/whiteboard/pom.xml deleted file mode 100644 index 7ee3d578b8..0000000000 --- a/ipojo/handler/whiteboard/pom.xml +++ /dev/null @@ -1,115 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.handler.whiteboard-handler-project - 1.6.1-SNAPSHOT - Apache Felix iPOJO Whiteboard Handler Project - pom - - - whiteboard-handler - whiteboard-handler-it - - - - - - src/main/resources - - - . - META-INF - - LICENSE* - NOTICE* - DEPENDENCIES* - - - - - - - - release - - - - org.apache.maven.plugins - maven-assembly-plugin - - - make-assembly - package - - single - - - - project - - - false - - - - - - - org.codehaus.mojo - build-helper-maven-plugin - - - attach-assemblies - package - - attach-artifact - - - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.tar.gz - - project - tar.gz - - - - ${project.build.directory}/${project.artifactId}-${project.version}-project.zip - - project - zip - - - - - - - - - - - diff --git a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 5748e9cd4e..0000000000 --- a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,12 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 - diff --git a/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml deleted file mode 100644 index 0ef84a6ffe..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/pom.xml +++ /dev/null @@ -1,385 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../../pom/pom.xml - - - 4.0.0 - pom - Apache Felix iPOJO Whiteboard Handler - Integration Test - org.apache.felix.ipojo.handler.whiteboard-it - 1.6.1-SNAPSHOT - - - 3.0.0 - 1.5.1 - - - - - - org.apache.felix - org.apache.felix.ipojo.handler.whiteboard - ${project.version} - - - org.osgi - org.osgi.compendium - - - org.osgi - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo - 1.8.6 - test - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - - ch.qos.logback - logback-core - 1.5.34 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.0 - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - - - - junit - junit - 4.13.1 - test - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - - - - - - - test - - true - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - regular - - run - - - - felix - - ${project.build.directory}/regular - - - - - - - - - - test-all - - false - - - - - org.apache.maven.plugins - maven-invoker-plugin - 1.8 - - true - - clean - test - - true - - - - equinox-native - - run - - - - equinox - - ${project.build.directory}/equinox-native - - - - - felix-native - - run - - - - felix - - ${project.build.directory}/felix-native - - - - knopflerfish-native - - run - - - - knopflerfish - - ${project.build.directory}/knopflerfish-native - - - - - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - 5.2.0 - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - 3.8.1.v20120830-144521 - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - 4.2.0 - test - - - - - - diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml deleted file mode 100644 index d9fbae776b..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.handler.whiteboard-it - 1.6.1-SNAPSHOT - ../../../pom.xml - - - - ipojo-whiteboard-integration-test - ${project.artifactId} - - - - org.osgi - org.osgi.compendium - 4.2.0 - - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.8.6 - - - - \ No newline at end of file diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java deleted file mode 100644 index 1739528a62..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.components; - -import org.apache.felix.ipojo.handler.whiteboard.services.FooService; - -public class FooProvider implements FooService { - - public String foo; - - public void foo() { - if (foo.equals("foo")) { - foo = "bar"; - } else { - foo = "foo"; - } - } - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java deleted file mode 100644 index a2c80d2a5e..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/components/FooWhiteBoardPattern.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.components; - -import org.apache.felix.ipojo.handler.whiteboard.services.Observable; -import org.osgi.framework.ServiceReference; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public class FooWhiteBoardPattern implements Observable { - - List list = new ArrayList(); - int modifications = 0; - - long validate_time = 0; - long first_arrival_time = 0; - long first_departure_time = 0; - long invalidate_time = 0; - - public void onArrival(ServiceReference ref) { - if (first_arrival_time == 0) { - first_arrival_time = System.currentTimeMillis(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - list.add(ref); - } - - public void onDeparture(ServiceReference ref) { - list.remove(ref); - if (first_departure_time == 0) { - first_departure_time = System.currentTimeMillis(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - } - - public void onModification(ServiceReference ref) { - modifications = modifications + 1; - } - - public Map getObservations() { - Map map = new HashMap(); - map.put("list", list); - map.put("modifications", new Integer(modifications)); - map.put("validate", new Long(validate_time)); - map.put("invalidate", new Long(invalidate_time)); - map.put("arrival", new Long(first_arrival_time)); - map.put("departure", new Long(first_departure_time)); - return map; - } - - public void start() { - if (validate_time == 0) { - validate_time = System.currentTimeMillis(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - } - - public void stop() { - if (invalidate_time == 0) { - invalidate_time = System.currentTimeMillis(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { } - } - } - - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java deleted file mode 100644 index 17cc02adbb..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/FooService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.services; - -public interface FooService { - - public void foo(); - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java deleted file mode 100644 index 084ebdbbc0..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/java/org/apache/felix/ipojo/handler/whiteboard/services/Observable.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.services; - -import java.util.Map; - -public interface Observable { - - public Map getObservations(); - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml deleted file mode 100644 index f294aa604a..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/main/resources/metadata.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java deleted file mode 100644 index e5c6725023..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/Common.java +++ /dev/null @@ -1,216 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.test; - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.TrueFileFilter; -import org.junit.After; -import org.junit.Before; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.options.CompositeOption; -import org.ops4j.pax.exam.options.DefaultCompositeOption; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static junit.framework.Assert.fail; -import static org.ops4j.pax.exam.CoreOptions.*; - -/** - * Bootstrap the test from this project - */ -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerClass.class) -public class Common { - - @Inject - BundleContext bc; - - OSGiHelper osgiHelper; - IPOJOHelper ipojoHelper; - - Bundle testedBundle; - - @Configuration - public Option[] config() throws IOException { - Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - root.setLevel(Level.DEBUG); - - return options( - cleanCaches(), - ipojoBundles(), - junitBundles(), - testedBundle(), - systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("WARN") - ); - } - - public static Option junitAndMockitoBundles() { - return new DefaultCompositeOption( - // Repository required to load harmcrest (OSGi-fied version). - repository("http://repository.springsource.com/maven/bundles/external").id( - "com.springsource.repository.bundles.external"), - - // Hamcrest with a version matching the range expected by Mockito - mavenBundle("org.hamcrest", "com.springsource.org.hamcrest.core", "1.1.0"), - - // Mockito core does not includes Hamcrest - mavenBundle("org.mockito", "mockito-core", "1.9.5"), - - // Objenesis with a version matching the range expected by Mockito - wrappedBundle(mavenBundle("org.objenesis", "objenesis", "1.2")) - .exports("*;version=1.2"), - - // The default JUnit bundle also exports Hamcrest, but with an (incorrect) version of - // 4.9 which does not match the Mockito import. When deployed after the hamcrest bundles, it gets - // resolved correctly. - CoreOptions.junitBundles(), - - /* - * Felix has implicit boot delegation enabled by default. It conflicts with Mockito: - * java.lang.LinkageError: loader constraint violation in interface itable initialization: - * when resolving method "org.osgi.service.useradmin.User$$EnhancerByMockitoWithCGLIB$$dd2f81dc - * .newInstance(Lorg/mockito/cglib/proxy/Callback;)Ljava/lang/Object;" the class loader - * (instance of org/mockito/internal/creation/jmock/SearchingClassLoader) of the current class, - * org/osgi/service/useradmin/User$$EnhancerByMockitoWithCGLIB$$dd2f81dc, and the class loader - * (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) for interface - * org/mockito/cglib/proxy/Factory have different Class objects for the type org/mockito/cglib/ - * proxy/Callback used in the signature - * - * So we disable the bootdelegation. this property has no effect on the other OSGi implementation. - */ - frameworkProperty("felix.bootdelegation.implicit").value("false") - ); - } - - @Before - public void commonSetUp() { - osgiHelper = new OSGiHelper(bc); - ipojoHelper = new IPOJOHelper(bc); - - testedBundle = osgiHelper.getBundle("test.bundle"); - - // Dump OSGi Framework information - String vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VENDOR); - if (vendor == null) { - vendor = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_SYMBOLICNAME); - } - String version = (String) osgiHelper.getBundle(0).getHeaders().get(Constants.BUNDLE_VERSION); - System.out.println("OSGi Framework : " + vendor + " - " + version); - } - - @After - public void commonTearDown() { - ipojoHelper.dispose(); - osgiHelper.dispose(); - } - - public static CompositeOption ipojoBundles() { - return new DefaultCompositeOption( - mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(), - mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(), - // The tested handler - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.whiteboard").versionAsInProject() - ); - } - - public Option testedBundle() throws MalformedURLException { - File out = new File("target/tested/bundle.jar"); - - TinyBundle tested = TinyBundles.bundle(); - - // We look inside target/classes to find the class and resources - File classes = new File("target/classes"); - Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); - List services = new ArrayList(); - for (File file : files) { - if (file.isDirectory()) { - // By convention we export of .services and .service package - if (file.getName().endsWith("services") || file.getName().endsWith("service")) { - services.add(file); - } - } else { - // We need to compute the path - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - tested.add(path, file.toURI().toURL()); - System.out.println(file.getName() + " added to " + path); - } - } - - String export = ""; - for (File file : services) { - if (export.length() > 0) { export += ", "; } - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - String packageName = path.replace('/', '.'); - export += packageName; - } - - System.out.println("Exported packages : " + export); - - InputStream inputStream = tested - .set(Constants.BUNDLE_SYMBOLICNAME, "test.bundle") - //.set(Constants.IMPORT_PACKAGE, "*") - .set(Constants.EXPORT_PACKAGE, export) - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources"))); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the manipulated bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the manipulated bundle"); - } - } - - public void assertContains(String s, String[] arrays, String object) { - for (String suspect : arrays) { - if (object.equals(suspect)) { - return; - } - } - fail("Assertion failed : " + s); - } - - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java b/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java deleted file mode 100644 index ae8e9c251b..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/it/whiteboard-it/src/test/java/org/apache/felix/ipojo/handler/whiteboard/test/TestWhiteboardPatternHandler.java +++ /dev/null @@ -1,302 +0,0 @@ -/* - * 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.ipojo.handler.whiteboard.test; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.handler.whiteboard.services.FooService; -import org.apache.felix.ipojo.handler.whiteboard.services.Observable; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestWhiteboardPatternHandler extends Common { - - Factory provFactory; - Factory factory, factory2, factory3, factory4; - - @Before - public void setUp() { - provFactory = ipojoHelper.getFactory("fooprovider"); - factory = ipojoHelper.getFactory("under-providers"); - factory2 = ipojoHelper.getFactory("under-properties"); - factory3 = ipojoHelper.getFactory("under-providers-lifecycle"); - factory4 = ipojoHelper.getFactory("under-providers-2"); - } - - @Test - public void testServiceProviders() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = factory.createComponentInstance(new Properties()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName()); - assertNotNull("Check Observable availability", ref); - Observable obs = (Observable) osgiHelper.getServiceObject(ref); - - Map map = obs.getObservations(); - assertEquals("Check empty list", ((List) map.get("list")).size(), 0); - - Properties p1 = new Properties(); - p1.put("foo", "foo"); - ComponentInstance prov1 = provFactory.createComponentInstance(p1); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - - Properties p2 = new Properties(); - p2.put("foo", "foo"); - ComponentInstance prov2 = provFactory.createComponentInstance(p2); - - map = obs.getObservations(); - assertEquals("Check list #2", ((List) map.get("list")).size(), 2); - - prov1.stop(); - - map = obs.getObservations(); - assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1); - - prov2.stop(); - - map = obs.getObservations(); - assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0); - - prov2.start(); - - map = obs.getObservations(); - assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1); - - prov1.start(); - - map = obs.getObservations(); - assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2); - - prov1.dispose(); - - map = obs.getObservations(); - assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1); - - prov2.dispose(); - - map = obs.getObservations(); - assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0); - - bc.ungetService(ref); - ci.dispose(); - } - - @Test - public void testPropertiesProviders() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = factory2.createComponentInstance(new Properties()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName()); - assertNotNull("Check Observable availability", ref); - Observable obs = (Observable) osgiHelper.getServiceObject(ref); - - Map map = obs.getObservations(); - assertEquals("Check empty list", ((List) map.get("list")).size(), 0); - - Properties p1 = new Properties(); - p1.put("foo", "foo"); - ComponentInstance prov1 = provFactory.createComponentInstance(p1); - ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov1.getInstanceName()); - FooService fs1 = (FooService) osgiHelper.getServiceObject(ref1); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - - Properties p2 = new Properties(); - p2.put("foo", "foo"); - ComponentInstance prov2 = provFactory.createComponentInstance(p2); - ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), prov2.getInstanceName()); - FooService fs2 = (FooService) osgiHelper.getServiceObject(ref2); - - map = obs.getObservations(); - assertEquals("Check list #2", ((List) map.get("list")).size(), 2); - - fs1.foo(); - - map = obs.getObservations(); - assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1); - - fs2.foo(); - - map = obs.getObservations(); - assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0); - - fs2.foo(); - - map = obs.getObservations(); - assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1); - - fs1.foo(); - - map = obs.getObservations(); - assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2); - - prov1.dispose(); - - map = obs.getObservations(); - assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1); - - prov2.dispose(); - - map = obs.getObservations(); - assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0); - - bc.ungetService(ref1); - bc.ungetService(ref2); - bc.ungetService(ref); - ci.dispose(); - } - - @Test - public void testModifications() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = factory.createComponentInstance(new Properties()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName()); - assertNotNull("Check Observable availability", ref); - Observable obs = (Observable) osgiHelper.getServiceObject(ref); - - Map map = obs.getObservations(); - assertEquals("Check empty list", ((List) map.get("list")).size(), 0); - - Properties p1 = new Properties(); - p1.put("foo", "foo"); - ComponentInstance prov1 = provFactory.createComponentInstance(p1); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - assertEquals("Check modification #0", ((Integer) map.get("modifications")).intValue(), 0); - - ServiceReference ref2 = osgiHelper.getServiceReference(FooService.class.getName(), null); - assertNotNull("Check FooService availability", ref2); - - FooService fs = (FooService) osgiHelper.getServiceObject(ref2); - fs.foo(); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - assertEquals("Check modification #1 (" + map.get("modifications") + ")", ((Integer) map.get("modifications")).intValue(), 1); - - fs.foo(); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - assertEquals("Check modification #2", ((Integer) map.get("modifications")).intValue(), 2); - - prov1.dispose(); - map = obs.getObservations(); - assertEquals("Check list #0", ((List) map.get("list")).size(), 0); - assertEquals("Check modification #2", ((Integer) map.get("modifications")).intValue(), 2); - - bc.ungetService(ref); - bc.ungetService(ref2); - ci.dispose(); - } - - @Test - public void testLifecycleCompliance() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // First expose a service. - Properties p1 = new Properties(); - p1.put("foo", "foo"); - ComponentInstance prov1 = provFactory.createComponentInstance(p1); - - ComponentInstance ci = factory3.createComponentInstance(new Properties()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName()); - assertNotNull("Check Observable availability", ref); - Observable obs = (Observable) osgiHelper.getServiceObject(ref); - - Map map = obs.getObservations(); - // Check time - Long validate = (Long) map.get("validate"); - Long arrival = (Long) map.get("arrival"); - - // Validate must be call before. - assertTrue(validate + " " + arrival, validate < arrival); - - prov1.dispose(); - ci.dispose(); - - } - - @Test - public void testServiceProvidersWhiteWhiteboards() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = factory4.createComponentInstance(new Properties()); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Observable.class.getName(), ci.getInstanceName()); - assertNotNull("Check Observable availability", ref); - Observable obs = (Observable) osgiHelper.getServiceObject(ref); - - Map map = obs.getObservations(); - assertEquals("Check empty list", ((List) map.get("list")).size(), 0); - - Properties p1 = new Properties(); - p1.put("foo", "foo"); - ComponentInstance prov1 = provFactory.createComponentInstance(p1); - - map = obs.getObservations(); - assertEquals("Check list #1", ((List) map.get("list")).size(), 1); - - Properties p2 = new Properties(); - p2.put("foo", "foo"); - ComponentInstance prov2 = provFactory.createComponentInstance(p2); - - map = obs.getObservations(); - assertEquals("Check list #2", ((List) map.get("list")).size(), 2); - - prov1.stop(); - - map = obs.getObservations(); - assertEquals("(1) Check list #1", ((List) map.get("list")).size(), 1); - - prov2.stop(); - - map = obs.getObservations(); - assertEquals("(2) Check list #0", ((List) map.get("list")).size(), 0); - - prov2.start(); - - map = obs.getObservations(); - assertEquals("(3) Check list #1", ((List) map.get("list")).size(), 1); - - prov1.start(); - - map = obs.getObservations(); - assertEquals("(4) Check list #2", ((List) map.get("list")).size(), 2); - - prov1.dispose(); - - map = obs.getObservations(); - assertEquals("(5) Check list #1", ((List) map.get("list")).size(), 1); - - prov2.dispose(); - - map = obs.getObservations(); - assertEquals("(6) Check list #0", ((List) map.get("list")).size(), 0); - - bc.ungetService(ref); - ci.dispose(); - } -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/whiteboard-handler-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt b/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt deleted file mode 100644 index 01992b4bb1..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/changelog.txt +++ /dev/null @@ -1,33 +0,0 @@ -Changes from 1.4.0 to 1.6.0 ----------------------------- -** Bug - * [FELIX-2581] - White Board Pattern onActivate called before @Validate - -** Improvement - * [FELIX-2624] - Support multiple whiteboards using annotations - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-944] - Fix white-board pattern handler symbolic name - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml b/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml deleted file mode 100644 index 88eec46852..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/metadata.xml +++ /dev/null @@ -1,30 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ipojo/handler/whiteboard/whiteboard-handler/obr.xml b/ipojo/handler/whiteboard/whiteboard-handler/obr.xml deleted file mode 100644 index 2da24fa27a..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/obr.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - -

-

-

- - \ No newline at end of file diff --git a/ipojo/handler/whiteboard/whiteboard-handler/pom.xml b/ipojo/handler/whiteboard/whiteboard-handler/pom.xml deleted file mode 100644 index e6bf2ed888..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/pom.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Apache Felix iPOJO White Board Pattern Handler - org.apache.felix.ipojo.handler.whiteboard - org.apache.felix - 1.6.1-SNAPSHOT - - - iPOJO extension to easily implement a white-board pattern (host). - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/white-board-pattern-handler.html - - - - - org.apache.felix - org.apache.felix.ipojo - 1.6.4 - - - - - - org.apache.felix - maven-bundle-plugin - true - - - ${project.name} - ${project.artifactId} - The Apache Software Foundation - iPOJO White-Board Pattern Handler - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/white-board-pattern-handler.html - - org.apache.felix.ipojo.handler.wbp - - ${project.name} - - - - - org.apache.felix - maven-ipojo-plugin - 1.6.0 - - - - ipojo-bundle - - - metadata.xml - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 1c61161053..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/NOTICE b/ipojo/handler/whiteboard/whiteboard-handler/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java b/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java deleted file mode 100644 index 8e0da46f34..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardManager.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.ipojo.handler.wbp; - -import java.lang.reflect.InvocationTargetException; - -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.util.Callback; -import org.apache.felix.ipojo.util.Tracker; -import org.apache.felix.ipojo.util.TrackerCustomizer; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; - -/** - * Manage a white board pattern. - * @author Felix Project Team - */ -public class WhiteBoardManager implements TrackerCustomizer { - - /** - * The monitored filter. - */ - private Filter m_filter; - - /** - * The onArrival method. - */ - private Callback m_onArrival; - - /** - * The onDeparture method. - */ - private Callback m_onDeparture; - - /** - * The onModify method. - */ - private Callback m_onModification; - - /** - * The service tracker. - */ - private Tracker m_tracker; - - /** - * The attached handler. - */ - private PrimitiveHandler m_handler; - - /** - * Constructor. - * @param handler the attached handler - * @param filter the monitored filter - * @param bind the onArrival method - * @param unbind the onDeparture method - * @param modification the onModify method - */ - public WhiteBoardManager(WhiteBoardPatternHandler handler, Filter filter, String bind, String unbind, String modification) { - m_handler = handler; - m_onArrival = new Callback(bind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager()); - m_onDeparture = new Callback(unbind, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager()); - if (modification != null) { - m_onModification = new Callback(modification, new Class[] {ServiceReference.class}, false, m_handler.getInstanceManager()); - } - m_filter = filter; - m_tracker = new Tracker(handler.getInstanceManager().getContext(), m_filter, this); - } - - - - /** - * Opens the tracker. - */ - public void start() { - // Calling several times open is no-effect. - m_tracker.open(); - } - - /** - * Closes the tracker. - */ - public void stop() { - m_tracker.close(); - } - - /** - * A new service was added to the tracker. - * @param arg0 the service reference. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference) - */ - public void addedService(ServiceReference arg0) { - try { - m_onArrival.call(new Object[] {arg0}); - } catch (NoSuchMethodException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " does not exist in the class", e); - m_handler.getInstanceManager().stop(); - } catch (IllegalAccessException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " cannot be invoked", e); - m_handler.getInstanceManager().stop(); - } catch (InvocationTargetException e) { - m_handler.error("The onArrival method " + m_onArrival.getMethod() + " has thrown an exception", e - .getTargetException()); - } - } - - /** - * A new service is detected. - * @param arg0 the service reference - * @return {@code true} to add the service. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference) - */ - public boolean addingService(ServiceReference arg0) { - return true; - } - - /** - * An existing service was modified. - * @param arg0 the service reference - * @param arg1 the service object (if already get) - * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void modifiedService(ServiceReference arg0, Object arg1) { - if (m_onModification != null) { - try { - m_onModification.call(new Object[] {arg0}); - } catch (NoSuchMethodException e) { - m_handler.error("The onModification method " + m_onModification.getMethod() + " does not exist in the class", e); - m_handler.getInstanceManager().stop(); - } catch (IllegalAccessException e) { - m_handler.error("The onModification method " + m_onModification.getMethod() + " cannot be invoked", e); - m_handler.getInstanceManager().stop(); - } catch (InvocationTargetException e) { - m_handler.error("The onModification method " + m_onModification.getMethod() + " has thrown an exception", e.getTargetException()); - } - } - } - - /** - * A service disappears. - * @param arg0 the service reference - * @param arg1 the service object (if already get) - * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void removedService(ServiceReference arg0, Object arg1) { - try { - m_onDeparture.call(new Object[] {arg0}); - } catch (NoSuchMethodException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " does not exist in the class", e); - m_handler.getInstanceManager().stop(); - } catch (IllegalAccessException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " cannot be invoked", e); - m_handler.getInstanceManager().stop(); - } catch (InvocationTargetException e) { - m_handler.error("The onDeparture method " + m_onDeparture.getMethod() + " has thrown an exception", e.getTargetException()); - } - } - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java b/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java deleted file mode 100644 index 70a880e1fd..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/java/org/apache/felix/ipojo/handler/wbp/WhiteBoardPatternHandler.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.ipojo.handler.wbp; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.InvalidSyntaxException; - -/** - * White board pattern handler. - * This handler aims to automate white board patterns by invoking callback when needed. - * @author Felix Project Team - */ -public class WhiteBoardPatternHandler extends PrimitiveHandler { - - /** - * The handler namespace. - */ - public static final String NAMESPACE = "org.apache.felix.ipojo.whiteboard"; - - /** - * The white board pattern to manage. By default just one. - */ - private List m_managers = new ArrayList(1); - - /** - * Configure method. Parses the metadata to analyze white-board-pattern elements. - * @param elem the component type description - * @param dict the instance description - * @throws ConfigurationException if the description is not valid. - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element elem, Dictionary dict) throws ConfigurationException { - - // There is two way to configure the handler : - // - the wbp elements - // - the whiteboards elements - Element[] elems = elem.getElements("wbp", NAMESPACE); - - if (elems == null || elems.length == 0) { - // Alternative way - Element[] whiteboards = elem.getElements("whiteboards", NAMESPACE); - if (whiteboards == null) { - throw new ConfigurationException("Cannot configure the whiteboard pattern handler - no suitable configuration found"); - } else { - elems = whiteboards[0].getElements("wbp", NAMESPACE); - } - } - - // Last check. - if (elems == null) { - throw new ConfigurationException("Cannot configure the whiteboard pattern handler - no suitable configuration found"); - } - - for (int i = 0; i < elems.length; i++) { - String filter = elems[i].getAttribute("filter"); - String onArrival = elems[i].getAttribute("onArrival"); - String onDeparture = elems[i].getAttribute("onDeparture"); - String onModification = elems[i].getAttribute("onModification"); - - if (filter == null) { - throw new ConfigurationException("The white board pattern element requires a filter attribute"); - } - if (onArrival == null || onDeparture == null) { - throw new ConfigurationException("The white board pattern element requires the onArrival and onDeparture attributes"); - } - - try { - WhiteBoardManager wbm = new WhiteBoardManager(this, getInstanceManager().getContext().createFilter(filter), onArrival, onDeparture, onModification); - m_managers.add(wbm); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("The filter " + filter + " is invalid : " + e); - } - } - - } - - /** - * Start method. - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - } - - - - /** - * Start managers if we're valid. - * @see org.apache.felix.ipojo.Handler#stateChanged(int) - */ - public void stateChanged(int state) { - if (state == ComponentInstance.VALID) { - for (int i = 0; i < m_managers.size(); i++) { - ((WhiteBoardManager) m_managers.get(i)).start(); - } - } - } - - /** - * Stop method. Stops managers. - * @see org.apache.felix.ipojo.Handler#stop() - */ - public void stop() { - for (int i = 0; i < m_managers.size(); i++) { - ((WhiteBoardManager) m_managers.get(i)).stop(); - } - } - -} diff --git a/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd b/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd deleted file mode 100644 index f02afde0a1..0000000000 --- a/ipojo/handler/whiteboard/whiteboard-handler/src/main/resources/whiteboard-pattern.xsd +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Description of the white-board architecture. - - - - Declaring the method to invoke when a matching service arrives. - - - - Declaring the method to invoke when a matching service leaves. - - - - Method called when an injected service reference is modified but stills valid against the filter. - - - - Filter use to discover matching filter. - - - \ No newline at end of file diff --git a/ipojo/junit4osgi/felix-command/LICENSE b/ipojo/junit4osgi/felix-command/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/ipojo/junit4osgi/felix-command/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/ipojo/junit4osgi/felix-command/NOTICE b/ipojo/junit4osgi/felix-command/NOTICE deleted file mode 100644 index 96ef392c6f..0000000000 --- a/ipojo/junit4osgi/felix-command/NOTICE +++ /dev/null @@ -1,28 +0,0 @@ -Apache Felix iPOJO junit4osgi Felix Command -Copyright 2008-2009 The Apache Software Foundation - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -II. Used Software - -This product uses software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -This product uses software developed by -Junit project (http://junit.org) -Licensed under Common Public License 1.0. - -III. License Summary -- Apache License 2.0 -- Common Public License 1.0 - diff --git a/ipojo/junit4osgi/felix-command/doc/changelog.txt b/ipojo/junit4osgi/felix-command/doc/changelog.txt deleted file mode 100644 index 524e88b133..0000000000 --- a/ipojo/junit4osgi/felix-command/doc/changelog.txt +++ /dev/null @@ -1,3 +0,0 @@ -Version 1.0.0 -------------- - * Initial release \ No newline at end of file diff --git a/ipojo/junit4osgi/felix-command/metadata.xml b/ipojo/junit4osgi/felix-command/metadata.xml deleted file mode 100644 index b1524c53c2..0000000000 --- a/ipojo/junit4osgi/felix-command/metadata.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ipojo/junit4osgi/felix-command/pom.xml b/ipojo/junit4osgi/felix-command/pom.xml deleted file mode 100644 index 4e9dca1344..0000000000 --- a/ipojo/junit4osgi/felix-command/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Junit4Osgi-Felix-Command - - org.apache.felix.ipojo.junit4osgi.felix-command - - 1.1.0-SNAPSHOT - - - ${project.groupId} - org.apache.felix.ipojo.junit4osgi - 1.1.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.shell - 1.0.2 - - - junit - junit - 3.8.1 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.4 - 1.4 - - - - org.apache.felix - maven-bundle-plugin - 2.3.5 - true - - - Apache Felix iPOJO OSGi Junit Runner - Felix Command - - ${project.artifactId} - org.apache.felix.ipojo.junit4osgi.command - - META-INF/LICENSE=LICENSE, - META-INF/NOTICE=NOTICE - <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true - - - - - org.apache.felix - bnd-ipojo-plugin - 1.0.0-SNAPSHOT - - - - - org.codehaus.mojo - rat-maven-plugin - - false - true - true - - doc/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - - diff --git a/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java b/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java deleted file mode 100644 index da52feb306..0000000000 --- a/ipojo/junit4osgi/felix-command/src/main/java/org/apache/felix/ipojo/junit4osgi/command/JunitCommand.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.ipojo.junit4osgi.command; - -import java.io.PrintStream; -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; - -import junit.framework.TestCase; -import junit.framework.TestFailure; -import junit.framework.TestResult; -import junit.framework.TestSuite; - -import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner; -import org.apache.felix.shell.Command; - -/** - * Felix shell command. Allow to run tests. - * @author Felix Project Team - */ -public class JunitCommand implements Command { - - /** - * OSGi Junit Runner service. - */ - private OSGiJunitRunner m_runner; - - /** - * Gets the Test names. - * @param list the list of test - * @return the list of test names. - */ - private List getNamesFromTests(List list) { - List names = new ArrayList(list.size()); - for (int i = 0; i < list.size(); i++) { - if (list.get(i) instanceof TestCase) { - names.add(((TestCase) list.get(i)).getName()); - } - if (list.get(i) instanceof TestSuite) { - String name = ((TestSuite) list.get(i)).getName(); - if (name == null) { - name = ((TestSuite) list.get(i)).toString(); - } - names.add(name); - } - } - return names; - } - - /** - * Executes the command. - * @param line the command line - * @param out the output stream - * @param err the error stream - * @see org.apache.felix.shell.Command#execute(java.lang.String, java.io.PrintStream, java.io.PrintStream) - */ - public void execute(String line, PrintStream out, PrintStream err) { - line = line.substring(getName().length()).trim(); - List tr = null; - if (line.equals("all")) { - if (m_runner.getTests() == null) { - err.println("No tests to execute"); - return; - } else { - out.println("Executing " + getNamesFromTests(m_runner.getTests())); - tr = m_runner.run(); - } - } else { - try { - Long bundleId = new Long(line); - if (m_runner.getTests(bundleId.longValue()) == null) { - err.println("No tests to execute"); - return; - } else { - out.println("Executing " + getNamesFromTests(m_runner.getTests(bundleId.longValue()))); - tr = m_runner.run(bundleId.longValue()); - } - } catch (NumberFormatException e) { - err.println("Unable to parse id " + line); - return; - } - } - - ListIterator it = tr.listIterator(); - while (it.hasNext()) { - TestResult result = (TestResult) it.next(); - if (result.failureCount() != 0) { - TestFailure fail = (TestFailure) result.failures().nextElement(); - out.println(fail.trace()); - return; - } - } - - } - - /** - * Gets the command name. - * @return "junit" - * @see org.apache.felix.shell.Command#getName() - */ - public String getName() { - return "junit"; - } - - /** - * Gets a small description of the command. - * @return "launch junit tests" - * @see org.apache.felix.shell.Command#getShortDescription() - */ - public String getShortDescription() { - return "launch junit tests"; - } - - /** - * Gets command usage. - * @return the command usage. - * @see org.apache.felix.shell.Command#getUsage() - */ - public String getUsage() { - return "junit | junit all"; - } - -} diff --git a/ipojo/junit4osgi/immediate-launcher/LICENSE b/ipojo/junit4osgi/immediate-launcher/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/ipojo/junit4osgi/immediate-launcher/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/ipojo/junit4osgi/immediate-launcher/NOTICE b/ipojo/junit4osgi/immediate-launcher/NOTICE deleted file mode 100644 index 986cc712d6..0000000000 --- a/ipojo/junit4osgi/immediate-launcher/NOTICE +++ /dev/null @@ -1,27 +0,0 @@ -Apache Felix iPOJO junit4osgi Immediate Runner -Copyright 2008-2009 The Apache Software Foundation - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -II. Used Software - -This product uses software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -This product uses software developed by -Junit project (http://junit.org) -Licensed under Common Public License 1.0. - -III. License Summary -- Apache License 2.0 -- Common Public License 1.0 diff --git a/ipojo/junit4osgi/immediate-launcher/metadata.xml b/ipojo/junit4osgi/immediate-launcher/metadata.xml deleted file mode 100644 index 9f3da351bb..0000000000 --- a/ipojo/junit4osgi/immediate-launcher/metadata.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ipojo/junit4osgi/immediate-launcher/pom.xml b/ipojo/junit4osgi/immediate-launcher/pom.xml deleted file mode 100644 index 771ddda465..0000000000 --- a/ipojo/junit4osgi/immediate-launcher/pom.xml +++ /dev/null @@ -1,111 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Junit4Osgi-Immediate-Runner - - org.apache.felix.ipojo.junit4osgi.immediate-runner - - 1.1.0-SNAPSHOT - - - ${project.groupId} - org.apache.felix.ipojo.junit4osgi - 1.1.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.shell - 1.0.2 - - - junit - junit - 3.8.1 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.felix - maven-bundle-plugin - 2.3.5 - true - - - Apache Felix iPOJO OSGi Junit Runner - Immediate Runner - - ${project.artifactId} - org.apache.felix.ipojo.junit4osgi.command - - META-INF/LICENSE=LICENSE, - META-INF/NOTICE=NOTICE - <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true - - - - - org.apache.felix - bnd-ipojo-plugin - 1.0.0-SNAPSHOT - - - - - org.codehaus.mojo - rat-maven-plugin - - false - true - true - - doc/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - - diff --git a/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java b/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java deleted file mode 100644 index 1cc0a5960c..0000000000 --- a/ipojo/junit4osgi/immediate-launcher/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ImmediateRunner.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.junit4osgi.command; - -import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner; - -/** - * Junit Immediate runner. - * Executes test when starts. - * @author Felix Project Team - */ -public class ImmediateRunner { - - /** - * OSGi Junit Runner service. - */ - private OSGiJunitRunner m_runner; - - /** - * Start method. - */ - public void start() { - m_runner.run(); - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/LICENSE b/ipojo/junit4osgi/junit4osgi/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/ipojo/junit4osgi/junit4osgi/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/ipojo/junit4osgi/junit4osgi/LICENSE.junit b/ipojo/junit4osgi/junit4osgi/LICENSE.junit deleted file mode 100644 index 4fbc2f92b8..0000000000 --- a/ipojo/junit4osgi/junit4osgi/LICENSE.junit +++ /dev/null @@ -1,86 +0,0 @@ -Common Public License - v 1.0 - -THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT. - -1. DEFINITIONS - -"Contribution" means: - - a) in the case of the initial Contributor, the initial code and documentation distributed under this Agreement, and - b) in the case of each subsequent Contributor: - - i) changes to the Program, and - - ii) additions to the Program; - - where such changes and/or additions to the Program originate from and are distributed by that particular Contributor. A Contribution 'originates' from a Contributor if it was added to the Program by such Contributor itself or anyone acting on such Contributor's behalf. Contributions do not include additions to the Program which: (i) are separate modules of software distributed in conjunction with the Program under their own license agreement, and (ii) are not derivative works of the Program. - -"Contributor" means any person or entity that distributes the Program. - -"Licensed Patents " mean patent claims licensable by a Contributor which are necessarily infringed by the use or sale of its Contribution alone or when combined with the Program. - -"Program" means the Contributions distributed in accordance with this Agreement. - -"Recipient" means anyone who receives the Program under this Agreement, including all Contributors. - -2. GRANT OF RIGHTS - - a) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, distribute and sublicense the Contribution of such Contributor, if any, and such derivative works, in source code and object code form. - - b) Subject to the terms of this Agreement, each Contributor hereby grants Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed Patents to make, use, sell, offer to sell, import and otherwise transfer the Contribution of such Contributor, if any, in source code and object code form. This patent license shall apply to the combination of the Contribution and the Program if, at the time the Contribution is added by the Contributor, such addition of the Contribution causes such combination to be covered by the Licensed Patents. The patent license shall not apply to any other combinations which include the Contribution. No hardware per se is licensed hereunder. - - c) Recipient understands that although each Contributor grants the licenses to its Contributions set forth herein, no assurances are provided by any Contributor that the Program does not infringe the patent or other intellectual property rights of any other entity. Each Contributor disclaims any liability to Recipient for claims brought by any other entity based on infringement of intellectual property rights or otherwise. As a condition to exercising the rights and licenses granted hereunder, each Recipient hereby assumes sole responsibility to secure any other intellectual property rights needed, if any. For example, if a third party patent license is required to allow Recipient to distribute the Program, it is Recipient's responsibility to acquire that license before distributing the Program. - - d) Each Contributor represents that to its knowledge it has sufficient copyright rights in its Contribution, if any, to grant the copyright license set forth in this Agreement. - -3. REQUIREMENTS - -A Contributor may choose to distribute the Program in object code form under its own license agreement, provided that: - - a) it complies with the terms and conditions of this Agreement; and - - b) its license agreement: - - i) effectively disclaims on behalf of all Contributors all warranties and conditions, express and implied, including warranties or conditions of title and non-infringement, and implied warranties or conditions of merchantability and fitness for a particular purpose; - - ii) effectively excludes on behalf of all Contributors all liability for damages, including direct, indirect, special, incidental and consequential damages, such as lost profits; - - iii) states that any provisions which differ from this Agreement are offered by that Contributor alone and not by any other party; and - - iv) states that source code for the Program is available from such Contributor, and informs licensees how to obtain it in a reasonable manner on or through a medium customarily used for software exchange. - -When the Program is made available in source code form: - - a) it must be made available under this Agreement; and - - b) a copy of this Agreement must be included with each copy of the Program. - -Contributors may not remove or alter any copyright notices contained within the Program. - -Each Contributor must identify itself as the originator of its Contribution, if any, in a manner that reasonably allows subsequent Recipients to identify the originator of the Contribution. - -4. COMMERCIAL DISTRIBUTION - -Commercial distributors of software may accept certain responsibilities with respect to end users, business partners and the like. While this license is intended to facilitate the commercial use of the Program, the Contributor who includes the Program in a commercial product offering should do so in a manner which does not create potential liability for other Contributors. Therefore, if a Contributor includes the Program in a commercial product offering, such Contributor ("Commercial Contributor") hereby agrees to defend and indemnify every other Contributor ("Indemnified Contributor") against any losses, damages and costs (collectively "Losses") arising from claims, lawsuits and other legal actions brought by a third party against the Indemnified Contributor to the extent caused by the acts or omissions of such Commercial Contributor in connection with its distribution of the Program in a commercial product offering. The obligations in this section do not apply to any claims or Losses relating to any actual or alleged intellectual property infringement. In order to qualify, an Indemnified Contributor must: a) promptly notify the Commercial Contributor in writing of such claim, and b) allow the Commercial Contributor to control, and cooperate with the Commercial Contributor in, the defense and any related settlement negotiations. The Indemnified Contributor may participate in any such claim at its own expense. - -For example, a Contributor might include the Program in a commercial product offering, Product X. That Contributor is then a Commercial Contributor. If that Commercial Contributor then makes performance claims, or offers warranties related to Product X, those performance claims and warranties are such Commercial Contributor's responsibility alone. Under this section, the Commercial Contributor would have to defend claims against the other Contributors related to those performance claims and warranties, and if a court requires any other Contributor to pay any damages as a result, the Commercial Contributor must pay those damages. - -5. NO WARRANTY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely responsible for determining the appropriateness of using and distributing the Program and assumes all risks associated with its exercise of rights under this Agreement, including but not limited to the risks and costs of program errors, compliance with applicable laws, damage to or loss of data, programs or equipment, and unavailability or interruption of operations. - -6. DISCLAIMER OF LIABILITY - -EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - -7. GENERAL - -If any provision of this Agreement is invalid or unenforceable under applicable law, it shall not affect the validity or enforceability of the remainder of the terms of this Agreement, and without further action by the parties hereto, such provision shall be reformed to the minimum extent necessary to make such provision valid and enforceable. - -If Recipient institutes patent litigation against a Contributor with respect to a patent applicable to software (including a cross-claim or counterclaim in a lawsuit), then any patent licenses granted by that Contributor to such Recipient under this Agreement shall terminate as of the date such litigation is filed. In addition, if Recipient institutes patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Program itself (excluding combinations of the Program with other software or hardware) infringes such Recipient's patent(s), then such Recipient's rights granted under Section 2(b) shall terminate as of the date such litigation is filed. - -All Recipient's rights under this Agreement shall terminate if it fails to comply with any of the material terms or conditions of this Agreement and does not cure such failure in a reasonable period of time after becoming aware of such noncompliance. If all Recipient's rights under this Agreement terminate, Recipient agrees to cease use and distribution of the Program as soon as reasonably practicable. However, Recipient's obligations under this Agreement and any licenses granted by Recipient relating to the Program shall continue and survive. - -Everyone is permitted to copy and distribute copies of this Agreement, but in order to avoid inconsistency the Agreement is copyrighted and may only be modified in the following manner. The Agreement Steward reserves the right to publish new versions (including revisions) of this Agreement from time to time. No one other than the Agreement Steward has the right to modify this Agreement. IBM is the initial Agreement Steward. IBM may assign the responsibility to serve as the Agreement Steward to a suitable separate entity. Each new version of the Agreement will be given a distinguishing version number. The Program (including Contributions) may always be distributed subject to the version of the Agreement under which it was received. In addition, after a new version of the Agreement is published, Contributor may elect to distribute the Program (including its Contributions) under the new version. Except as expressly stated in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to the intellectual property of any Contributor under this Agreement, whether expressly, by implication, estoppel or otherwise. All rights in the Program not expressly granted under this Agreement are reserved. - -This Agreement is governed by the laws of the State of New York and the intellectual property laws of the United States of America. No party to this Agreement will bring a legal action under this Agreement more than one year after the cause of action arose. Each party waives its rights to a jury trial in any resulting litigation. \ No newline at end of file diff --git a/ipojo/junit4osgi/junit4osgi/NOTICE b/ipojo/junit4osgi/junit4osgi/NOTICE deleted file mode 100644 index d696f410fe..0000000000 --- a/ipojo/junit4osgi/junit4osgi/NOTICE +++ /dev/null @@ -1,27 +0,0 @@ -Apache Felix iPOJO junit4osgi Framework -Copyright 2008-2009 The Apache Software Foundation - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product includes software developed by -Junit project (http://junit.org) -Licensed under Common Public License 1.0. - -II. Used Software - -This product uses software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -III. License Summary -- Apache License 2.0 -- Common Public License 1.0 diff --git a/ipojo/junit4osgi/junit4osgi/doc/changelog.txt b/ipojo/junit4osgi/junit4osgi/doc/changelog.txt deleted file mode 100644 index 524e88b133..0000000000 --- a/ipojo/junit4osgi/junit4osgi/doc/changelog.txt +++ /dev/null @@ -1,3 +0,0 @@ -Version 1.0.0 -------------- - * Initial release \ No newline at end of file diff --git a/ipojo/junit4osgi/junit4osgi/metadata.xml b/ipojo/junit4osgi/junit4osgi/metadata.xml deleted file mode 100644 index 045e20cf71..0000000000 --- a/ipojo/junit4osgi/junit4osgi/metadata.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - - - - - diff --git a/ipojo/junit4osgi/junit4osgi/pom.xml b/ipojo/junit4osgi/junit4osgi/pom.xml deleted file mode 100644 index e086c87fb9..0000000000 --- a/ipojo/junit4osgi/junit4osgi/pom.xml +++ /dev/null @@ -1,152 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Junit4Osgi - org.apache.felix.ipojo.junit4osgi - 1.1.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.ipojo - 1.8.0 - - - org.apache.felix - org.apache.felix.ipojo.metadata - 1.4.0 - - - junit - junit - 3.8.1 - - - org.osgi - org.osgi.core - 4.2.0 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.4 - 1.4 - - - - org.apache.felix - maven-bundle-plugin - 2.3.5 - true - - - - Apache Felix iPOJO OSGi Junit Runner - - - ${project.artifactId} - - - org.apache.felix.ipojo.junit4osgi.impl, - org.apache.felix.ipojo.junit4osgi.test, - - - org.apache.felix.ipojo.junit4osgi, - org.apache.felix.ipojo.junit4osgi.helpers, - junit.* - - !javax.swing*, * - - org.apache.felix.ipojo.junit4osgi.test.TestTestCase, - org.apache.felix.ipojo.junit4osgi.test.TestOSGiTestCase, - org.apache.felix.ipojo.junit4osgi.test.TestTestSuite, - org.apache.felix.ipojo.junit4osgi.test.TestOSGiTestSuite, - - - META-INF/LICENSE=LICENSE, - META-INF/LICENSE.junit=LICENSE.junit, - META-INF/NOTICE=NOTICE - - <_plugin> - org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true - - - - - - org.apache.felix - bnd-ipojo-plugin - 1.9.0-SNAPSHOT - - - - - - org.codehaus.mojo - rat-maven-plugin - - false - true - true - - doc/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - error - - - - - diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java deleted file mode 100644 index 9909b6815c..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/Helper.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.junit4osgi; - -import org.osgi.framework.BundleContext; - - -/** - * Helper abstract class. - * Helper objects aim to facilitate Test writing. - * @author Felix Project Team - */ -public abstract class Helper { - - /** - * The bundle context. - */ - protected BundleContext m_context; - - /** - * The OSGi Test case. - */ - protected OSGiTestCase m_testcase; - - /** - * Creates a Helper. - * Registers the helper. - * Sub-classes must initialize the session. - * @param tc the OSGi Test Case - */ - public Helper(OSGiTestCase tc) { - m_testcase = tc; - m_context = m_testcase.getBundleContext(); - tc.addHelper(this); - } - - /** - * Rolls back the session. - */ - public abstract void dispose(); - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java deleted file mode 100644 index 334e3114ae..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiJunitRunner.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.ipojo.junit4osgi; - -import java.io.PrintStream; -import java.util.List; - -import junit.framework.Test; -import junit.framework.TestResult; - -/** - * OSGi Junit Runner. - * @author Felix Project Team - */ -public interface OSGiJunitRunner { - - /** - * Set the output stream of the runner. - * @param ps the print stream. - */ - void setResultPrinter(PrintStream ps); - - /** - * Run the tests. - * @return the list of TestResult. - */ - List/**/ run(); - - /** - * Run the tests from the given bundle. - * @param bundleId the bundle id containing the tests. - * @return the list of the test results. - */ - List/**/ run(long bundleId); - - /** - * Get the list of available test suites. - * @return the list of Test objects. - */ - List/**/ getTests(); - - /** - * Get the tests from the given bundle. - * @param bundleId the bundle id. - * @return the list of Test contained in the given bundle. - */ - List/**/ getTests(long bundleId); - - /** - * Run the given test. - * @param test the test to execute. - * @return the result. - */ - TestResult run(Test test); - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java deleted file mode 100644 index 9599974c48..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestCase.java +++ /dev/null @@ -1,782 +0,0 @@ -/* - * 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.ipojo.junit4osgi; - -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.osgi.service.packageadmin.PackageAdmin; - -/** - * OSGi Test Case. - * Allows the injection of the bundle context. - * - * @author Felix Project Team - */ -public class OSGiTestCase extends TestCase { - - /** - * The bundle context. - */ - protected BundleContext context; - - /** - * List of get references. - */ - private List m_references = new ArrayList(); - - /** - * List of helpers. - */ - private List m_helpers = new ArrayList(); - - /** - * Gets the Bundle Context. - * @return the bundle context. - */ - public BundleContext getContext() { - return context; - } - - /** - * Add an helper. - * This method is called by the {@link Helper#Helper(OSGiTestCase)} - * method. - * @param helper the helper object. - */ - public void addHelper(Helper helper) { - m_helpers.add(helper); - } - - /** - * Extends runBare to release (unget) services after the teardown. - * @throws Throwable when an error occurs. - * @see junit.framework.TestCase#runBare() - */ - public void runBare() throws Throwable { - setUp(); - try { - runTest(); - } finally { - tearDown(); - // Stop Helpers - for (int i = 0; i < m_helpers.size(); i++) { - ((Helper) m_helpers.get(i)).dispose(); - } - // Unget services - for (int i = 0; i < m_references.size(); i++) { - context.ungetService((ServiceReference) m_references.get(i)); - } - m_references.clear(); - } - - } - - public void setBundleContext(BundleContext bc) { - context = bc; - } - - public BundleContext getBundleContext() { - return context; - } - - /** - * Checks that the given string is contained in the given array. - * @param message the assert point message - * @param array the String array - * @param txt the String to search - */ - public static void assertContains(String message, String[] array, String txt) { - for (int i = 0; i < array.length; i++) { - if (array[i].equals(txt)) { - return; - } - } - fail(formatContainsMessage(message, array, txt)); - } - - /** - * Checks that the given integer is contained in the given array. - * @param message the assert point message - * @param array the byte array - * @param num the number to search - */ - public static void assertContains(String message, byte[] array, int num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Byte[] bytes = new Byte[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Byte(array[i]); - } - fail(formatContainsMessage(message, bytes, new Integer(num))); - } - - /** - * Checks that the given integer is contained in the given array. - * @param message the assert point message - * @param array the short array - * @param num the number to search - */ - public static void assertContains(String message, short[] array, int num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Short[] bytes = new Short[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Short(array[i]); - } - fail(formatContainsMessage(message, bytes, new Integer(num))); - } - - /** - * Checks that the given integer is contained in the given array. - * @param message the assert point message - * @param array the integer array - * @param num the number to search - */ - public static void assertContains(String message, int[] array, int num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Integer[] bytes = new Integer[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Integer(array[i]); - } - fail(formatContainsMessage(message, bytes, new Integer(num))); - } - - /** - * Checks that the given long is contained in the given array. - * @param message the assert point message - * @param array the long array - * @param num the number to search - */ - public static void assertContains(String message, long[] array, long num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Long[] bytes = new Long[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Long(array[i]); - } - fail(formatContainsMessage(message, bytes, new Long(num))); - } - - /** - * Checks that the given float is contained in the given array. - * @param message the assert point message - * @param array the float array - * @param num the number to search - */ - public static void assertContains(String message, float[] array, float num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Float[] bytes = new Float[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Float(array[i]); - } - fail(formatContainsMessage(message, bytes, new Float(num))); - } - - /** - * Checks that the given double is contained in the given array. - * @param message the assert point message - * @param array the double array - * @param num the number to search - */ - public static void assertContains(String message, double[] array, double num) { - for (int i = 0; i < array.length; i++) { - if (array[i] == num) { - return; - } - } - Double[] bytes = new Double[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Double(array[i]); - } - fail(formatContainsMessage(message, bytes, new Double(num))); - } - - /** - * Checks that the given character is contained in the given array. - * @param message the assert point message - * @param array the character array - * @param character the character to search - */ - public static void assertContains(String message, char[] array, char character) { - for (int i = 0; i < array.length; i++) { - if (array[i] == character) { - return; - } - } - Character[] bytes = new Character[array.length]; - for (int i = 0; i < array.length; i++) { - bytes[i] = new Character(array[i]); - } - fail(formatContainsMessage(message, bytes, new Character(character))); - } - - /** - * Asserts that two doubles are equal. If they are not an - * AssertionFailedError is thrown with the given message. - * @param message the assert point message - * @param expected the expected double - * @param actual the received double - */ - public static void assertEquals(String message, double expected, - double actual) { - if (expected != actual) { - fail(formatEqualsMessage(message, new Double(expected), new Double( - actual))); - } - } - - /** - * Asserts that two objects are not equal. If they are an - * AssertionFailedError is thrown with the given message. - * @param message the assert point message - * @param o1 the unexpected object - * @param o2 the received object - */ - public static void assertNotEquals(String message, Object o1, Object o2) { - if (o1.equals(o2)) { - fail(formatNotEqualsMessage(message, o1, o2)); - } - } - - /** - * Checks that the given string is contained in the given array. - * @param string the String to search - * @param array the String array - * @return true if the array contains the string - */ - public static boolean contains(String string, String[] array) { - for (int i = 0; array != null && i < array.length; i++) { - if (array[i] != null && array[i].equals(string)) { - return true; - } - } - return false; - } - - /** - * Checks that the given integer is contained in the given array. - * @param value the number to search - * @param array the integer array - * @return true if the array contains the value - */ - public static boolean contains(int value, int[] array) { - for (int i = 0; array != null && i < array.length; i++) { - if (array[i] == value) { - return true; - } - } - return false; - } - - /** - * Formats a failure message for 'equality' tests. - * @param message the assertion point message - * @param expected the expected value - * @param actual the received value - * @return the computed message - */ - private static String formatEqualsMessage(String message, Object expected, - Object actual) { - String formatted = ""; - if (message != null) { - formatted = message + " "; - } - return formatted + "expected:<" + expected + "> but was:<" + actual - + ">"; - } - - /** - * Formats a failure message for 'un-equality' tests. - * @param message the assertion point message - * @param o1 the unexpected value - * @param o2 the received value - * @return the computed message - */ - private static String formatNotEqualsMessage(String message, Object o1, - Object o2) { - String formatted = ""; - if (message != null) { - formatted = message + " "; - } - return formatted + "o1:<" + o1 + "> is equals to o2:<" + o2 + ">"; - } - - /** - * Formats a failure message for 'contains' tests. - * @param message the assertion point message - * @param array the array - * @param txt the looked value - * @return the computed message - */ - private static String formatContainsMessage(String message, Object[] array, - Object txt) { - String formatted = ""; - if (message != null) { - formatted = message + " "; - } - - String arr = null; - for (int i = 0; i < array.length; i++) { - if (arr == null) { - arr = "[" + array[i]; - } else { - arr += "," + array[i]; - } - } - arr += "]"; - - return formatted + "array:" + arr + " does not contains:<" + txt + ">"; - } - - /** - * Returns the service object of a service provided by the specified bundle, - * offering the specified interface and matching the given filter. - * - * @param bundle the bundle from which the service is searched. - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return the service object provided by the specified bundle, offering the - * specified interface and matching the given filter. - */ - public static Object getServiceObject(Bundle bundle, String itf, - String filter) { - ServiceReference ref = getServiceReference(bundle, itf, filter); - if (ref != null) { - return bundle.getBundleContext().getService(ref); - } else { - return null; - } - } - - /** - * Returns the service objects of the services provided by the specified - * bundle, offering the specified interface and matching the given filter. - * - * @param bundle the bundle from which services are searched. - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return the service objects provided by the specified bundle, offering - * the specified interface and matching the given filter. - */ - public static Object[] getServiceObjects(Bundle bundle, String itf, - String filter) { - ServiceReference[] refs = getServiceReferences(bundle, itf, filter); - if (refs != null) { - Object[] list = new Object[refs.length]; - for (int i = 0; i < refs.length; i++) { - list[i] = bundle.getBundleContext().getService(refs[i]); - } - return list; - } else { - return new Object[0]; - } - } - - /** - * Returns the service reference of a service provided by the specified - * bundle, offering the specified interface and matching the given filter. - * - * @param bundle the bundle from which the service is searched. - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return a service reference provided by the specified bundle, offering - * the specified interface and matching the given filter. If no - * service is found, {@code null} is returned. - */ - public static ServiceReference getServiceReference(Bundle bundle, - String itf, String filter) { - ServiceReference[] refs = getServiceReferences(bundle, itf, filter); - if (refs.length != 0) { - return refs[0]; - } else { - // No service found - return null; - } - } - - /** - * Checks if the service is available. - * @param itf the service interface - * @return true if the service is available, false - * otherwise. - */ - public boolean isServiceAvailable(String itf) { - ServiceReference ref = getServiceReference(itf, null); - return ref != null; - } - - /** - * Checks if the service is available. - * @param itf the service interface - * @param pid the service pid - * @return true if the service is available, false - * otherwise. - */ - public boolean isServiceAvailableByPID(String itf, String pid) { - ServiceReference ref = getServiceReferenceByPID(itf, pid); - return ref != null; - } - - /** - * Returns the service reference of the service provided by the specified - * bundle, offering the specified interface and having the given persistent - * ID. - * - * @param bundle the bundle from which the service is searched. - * @param itf the interface provided by the searched service. - * @param pid the persistent ID of the searched service. - * @return a service provided by the specified bundle, offering the - * specified interface and having the given persistent ID. - */ - public static ServiceReference getServiceReferenceByPID(Bundle bundle, - String itf, String pid) { - String filter = "(" + "service.pid" + "=" + pid + ")"; - ServiceReference[] refs = getServiceReferences(bundle, itf, filter); - if (refs == null) { - return null; - } else if (refs.length == 1) { - return refs[0]; - } else { - throw new IllegalStateException( - "A service lookup by PID returned several providers (" - + refs.length + ")" + " for " + itf + " with pid=" - + pid); - } - } - - /** - * Returns the service reference of all the services provided in the - * specified bundle, offering the specified interface and matching the given - * filter. - * - * @param bundle the bundle from which services are searched. - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return all the service references provided in the specified bundle, - * offering the specified interface and matching the given filter. - * If no service matches, an empty array is returned. - */ - public static ServiceReference[] getServiceReferences(Bundle bundle, - String itf, String filter) { - ServiceReference[] refs = null; - try { - // Get all the service references - refs = bundle.getBundleContext().getServiceReferences(itf, filter); - } catch (InvalidSyntaxException e) { - throw new IllegalArgumentException( - "Cannot get service references: " + e.getMessage()); - } - if (refs == null) { - return new ServiceReference[0]; - } else { - return refs; - } - } - - /** - * Returns the service object of a service provided by the local bundle, - * offering the specified interface and matching the given filter. - * - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return the service object provided by the local bundle, offering the - * specified interface and matching the given filter. - */ - public Object getServiceObject(String itf, String filter) { - ServiceReference ref = getServiceReference(itf, filter); - if (ref != null) { - m_references.add(ref); - return context.getService(ref); - } else { - return null; - } - } - - /** - * Returns the service object associated with this service reference. - * - * @param ref service reference - * @return the service object. - */ - public Object getServiceObject(ServiceReference ref) { - if (ref != null) { - m_references.add(ref); - return context.getService(ref); - } else { - return null; - } - } - - /** - * Returns the service objects of the services provided by the local bundle, - * offering the specified interface and matching the given filter. - * - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return the service objects provided by the local bundle, offering the - * specified interface and matching the given filter. - */ - public Object[] getServiceObjects(String itf, String filter) { - ServiceReference[] refs = getServiceReferences(itf, filter); - if (refs != null) { - Object[] list = new Object[refs.length]; - for (int i = 0; i < refs.length; i++) { - m_references.add(refs[i]); - list[i] = context.getService(refs[i]); - } - return list; - } else { - return new Object[0]; - } - } - - /** - * Returns the service reference of a service provided by the local bundle, - * offering the specified interface and matching the given filter. - * - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return a service reference provided by the local bundle, offering the - * specified interface and matching the given filter. If no service - * is found, {@code null} is returned. - */ - public ServiceReference getServiceReference(String itf, String filter) { - return getServiceReference(context.getBundle(), itf, filter); - } - - /** - * Returns the service reference of a service provided offering the - * specified interface. - * - * @param itf the interface provided by the searched service. - * @return a service reference provided by the local bundle, offering the - * specified interface and matching the given filter. If no service - * is found, {@code null} is returned. - */ - public ServiceReference getServiceReference(String itf) { - return getServiceReference(context.getBundle(), itf, null); - } - - /** - * Returns the service reference of the service provided by the local - * bundle, offering the specified interface and having the given persistent - * ID. - * - * @param itf the interface provided by the searched service. - * @param pid the persistent ID of the searched service. - * @return a service provided by the local bundle, offering the specified - * interface and having the given persistent ID. - */ - public ServiceReference getServiceReferenceByPID(String itf, String pid) { - return getServiceReferenceByPID(context.getBundle(), itf, pid); - } - - /** - * Returns the service reference of all the services provided in the local - * bundle, offering the specified interface and matching the given filter. - * - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return all the service references provided in the local bundle, offering - * the specified interface and matching the given filter. If no - * service matches, an empty array is returned. - */ - public ServiceReference[] getServiceReferences(String itf, String filter) { - return getServiceReferences(context.getBundle(), itf, filter); - } - - /** - * Gets the package admin exposed by the framework. - * Fails if the package admin is not available. - * @return the package admin service. - */ - public PackageAdmin getPackageAdmin() { - PackageAdmin pa = (PackageAdmin) getServiceObject(PackageAdmin.class.getName(), null); - if (pa == null) { - fail("No package admin available"); - } - return pa; - } - - /** - * Refresh the packages. - * Fails if the package admin service is not available. - */ - public void refresh() { - getPackageAdmin().refreshPackages(null); - } - - /** - * Waits for a service. Fails on timeout. - * If timeout is set to 0, it sets the timeout to 10s. - * @param itf the service interface - * @param filter the filter - * @param timeout the timeout - */ - public void waitForService(String itf, String filter, long timeout) { - if (timeout == 0) { - timeout = 10000; // Default 10 secondes. - } - ServiceReference[] refs = getServiceReferences(itf, filter); - long begin = System.currentTimeMillis(); - if (refs.length != 0) { - return; - } else { - while(refs.length == 0) { - try { - Thread.sleep(5); - } catch (InterruptedException e) { - // Interrupted - } - long now = System.currentTimeMillis(); - - if ((now - begin) > timeout) { - fail("Timeout ... no services matching with the request after " + timeout + "ms"); - } - refs = getServiceReferences(itf, filter); - } - } - } - - - /** - * Installs a bundle. - * Fails if the bundle cannot be installed. - * Be aware that you have to uninstall the bundle yourself. - * @param url bundle url - * @return the installed bundle - */ - public Bundle installBundle(String url) { - try { - return context.installBundle(url); - } catch (BundleException e) { - fail("Cannot install the bundle " + url + " : " + e.getMessage()); - } - return null; // Can not happen - } - - /** - * Installs a bundle. - * Fails if the bundle cannot be installed. - * Be aware that you have to uninstall the bundle yourself. - * @param url bundle url - * @param stream input stream containing the bundle - * @return the installed bundle - */ - public Bundle installBundle(String url, InputStream stream) { - try { - return context.installBundle(url, stream); - } catch (BundleException e) { - fail("Cannot install the bundle " + url + " : " + e.getMessage()); - } - return null; // Can not happen - } - - /** - * Installs and starts a bundle. - * Fails if the bundle cannot be installed or an error occurs - * during startup. Be aware that you have to uninstall the bundle - * yourself. - * @param url the bundle url - * @return the Bundle object. - */ - public Bundle installAndStart(String url) { - Bundle bundle = installBundle(url); - try { - bundle.start(); - } catch (BundleException e) { - fail("Cannot start the bundle " + url + " : " + e.getMessage()); - } - return bundle; - } - - /** - * Installs and starts a bundle. - * Fails if the bundle cannot be installed or an error occurs - * during startup. Be aware that you have to uninstall the bundle - * yourself. - * @param url the bundle url - * @param stream input stream containing the bundle - * @return the Bundle object. - */ - public Bundle installAndStart(String url, InputStream stream) { - Bundle bundle = installBundle(url, stream); - try { - bundle.start(); - } catch (BundleException e) { - fail("Cannot start the bundle " + url + " : " + e.getMessage()); - } - return bundle; - } - - /** - * Get the bundle by its id. - * @param bundleId the bundle id. - * @return the bundle with the given id. - */ - public Bundle getBundle(long bundleId) { - return context.getBundle(bundleId); - } - - /** - * Gets a bundle by its symbolic name. - * Fails if no bundle matches. - * @param name the symbolic name of the bundle - * @return the bundle object. - */ - public Bundle getBundle(String name) { - Bundle[] bundles = context.getBundles(); - for (int i = 0; i < bundles.length; i++) { - if (name.equals(bundles[i].getSymbolicName())) { - return bundles[i]; - } - } - fail("No bundles with the given symbolic name " + name); - return null; // should not happen - } - - - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java deleted file mode 100644 index 581c14a0eb..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/OSGiTestSuite.java +++ /dev/null @@ -1,127 +0,0 @@ -/* - * 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.ipojo.junit4osgi; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestResult; -import junit.framework.TestSuite; - -import org.osgi.framework.BundleContext; - -/** - * OSGi Test Suite. - * Allow the injection of the bundle context. - * @author Felix Project Team - */ -public class OSGiTestSuite extends TestSuite { - - /** - * The bundle context of the bundle containing - * the test suite. - */ - protected BundleContext m_context; - - /** - * Creates a OSGiTestSuite. - * @param clazz the class - * @param bc the bundle context - * @see TestSuite#TestSuite(Class) - */ - public OSGiTestSuite(Class clazz, BundleContext bc) { - super(clazz); - m_context = bc; - } - - /** - * Creates a OSGiTestSuite. - * @param bc the bundle context - * @see TestSuite#TestSuite() - */ - public OSGiTestSuite(BundleContext bc) { - super(); - m_context = bc; - } - - /** - * Creates a OSGiTestSuite. - * @param name the name - * @param bc the bundle context - * @see TestSuite#TestSuite(String) - */ - public OSGiTestSuite(String name, BundleContext bc) { - super(name); - m_context = bc; - } - - /** - * Creates a OSGiTestSuite. - * @param clazz the class - * @param name the name - * @param bc the bundle context - * @see TestSuite#TestSuite(Class, String) - */ - public OSGiTestSuite(Class clazz, String name, BundleContext bc) { - super(clazz, name); - m_context = bc; - } - - /** - * Set the bundle context. - * @param bc the bundle context to use. - */ - public void setBundleContext(BundleContext bc) { - m_context = bc; - } - - /** - * Adds the tests from the given class to the suite. - * @param testClass the class to add - */ - public void addTestSuite(Class testClass) { - if (OSGiTestCase.class.isAssignableFrom(testClass)) { - addTest(new OSGiTestSuite(testClass, m_context)); - } else if (TestCase.class.isAssignableFrom(testClass)) { - addTest(new TestSuite(testClass)); - } else { - System.out.println("Error : the " + testClass + " is not a valid test class"); - } - } - - /** - * Executes the given {@link Test} with the - * given {@link TestResult}. - * @param test the test - * @param result the test result. - * @see junit.framework.TestSuite#runTest(junit.framework.Test, junit.framework.TestResult) - */ - public void runTest(Test test, TestResult result) { - if (test instanceof OSGiTestSuite) { - ((OSGiTestSuite) test).m_context = m_context; - test.run(result); - } else if (test instanceof OSGiTestCase) { - ((OSGiTestCase) test).setBundleContext(m_context); - test.run(result); - } else { - test.run(result); - } - - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java deleted file mode 100644 index 791fcfd39b..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/helpers/IPOJOHelper.java +++ /dev/null @@ -1,737 +0,0 @@ -/* - * 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.ipojo.junit4osgi.helpers; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.junit4osgi.Helper; -import org.apache.felix.ipojo.junit4osgi.OSGiTestCase; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.ManagedServiceFactory; - -/** - * iPOJO Helper. - * This helper helps getting {@link Factory}, and managing - * {@link ComponentInstance}. - * @author Felix Project Team - */ -public class IPOJOHelper extends Helper { - - /** - * The bundle context. - */ - private BundleContext m_context; - /** - * The test case. - */ - private OSGiTestCase m_testcase; - - /** - * List of instances. - */ - private List m_instances; - - /** - * Creates a IPOJOHelper. - * @param tc the OSGi Test Case - */ - public IPOJOHelper(OSGiTestCase tc) { - super(tc); - m_testcase = tc; - m_context = m_testcase.getBundleContext(); - m_instances = new ArrayList(); - } - - /** - * Disposes created instances. - * @see org.apache.felix.ipojo.junit4osgi.Helper#dispose() - */ - public void dispose() { - for (int i = 0; i < m_instances.size(); i++) { - ((ComponentInstance) m_instances.get(i)).dispose(); - } - m_instances.clear(); - } - - /** - * Gets a created instance from the instance name. - * @param name the instance name. - * @return the created {@link ComponentInstance} or null - * if the instance was not created during the session. - */ - public ComponentInstance getInstanceByName(String name) { - for (int i = 0; i < m_instances.size(); i++) { - if (((ComponentInstance) m_instances.get(i)).getInstanceName() - .equals(name)) { - return (ComponentInstance) m_instances.get(i); - } - } - return null; - } - - /** - * Creates a new component instance with the given name (and empty - * configuration), from the factory specified in the given bundle. - * - * @param bundle the bundle from which the component factory is defined. - * @param factoryName the name of the component factory, defined in the - * specified bundle. - * @param instanceName the name of the component instance to create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance(Bundle bundle, - String factoryName, String instanceName) { - - // Create the instance configuration - Properties configuration = new Properties(); - configuration.put("instance.name", instanceName); - - return createComponentInstance(bundle, factoryName, configuration); - } - - /** - * Creates a new component instance with the given configuration, from the - * factory specified in the given bundle. - * - * @param bundle the bundle from which the component factory is defined. - * @param factoryName the name of the component factory, defined in the - * specified bundle. - * @param configuration the configuration of the component instance to - * create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance(Bundle bundle, - String factoryName, Dictionary configuration) { - - // Retrieve the component factory. - Factory fact = getFactory(bundle, factoryName); - - if (fact == null) { - // Factory not found... - throw new IllegalArgumentException( - "Cannot find the component factory (" + factoryName - + ") in the specified bundle (" - + bundle.getSymbolicName() + ")."); - } - - try { - return fact.createComponentInstance(configuration); - } catch (Exception e) { - throw new IllegalArgumentException( - "Cannot create the component instance with the given configuration:" - + e.getMessage()); - } - } - - /** - * Creates a new component instance with the given name and configuration, - * from the factory specified in the given bundle. - * - * @param bundle the bundle from which the component factory is defined. - * @param factoryName the name of the component factory, defined in the - * specified bundle. - * @param instanceName the name of the component instance to create. - * @param configuration the configuration of the instance to create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance(Bundle bundle, - String factoryName, String instanceName, Dictionary configuration) { - - // Add the instance name to the configuration - configuration.put("instance.name", instanceName); - - return createComponentInstance(bundle, factoryName, configuration); - } - - /** - * Creates a new component instance with the given name (and an empty - * configuration), from the factory specified in the given service context. - * - * @param serviceContext the service context in which the component factory - * service is registered. - * @param factoryName the name of the component factory, defined in the - * specified service context. - * @param instanceName the name of the component instance to create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance( - ServiceContext serviceContext, String factoryName, - String instanceName) { - - // Create the instance configuration - Properties configuration = new Properties(); - configuration.put("instance.name", instanceName); - - return createComponentInstance(serviceContext, factoryName, - configuration); - } - - /** - * Creates a new component instance with the given name and configuration, - * from the factory specified in the given service context. - * - * @param serviceContext the service context in which the component factory - * service is registered. - * @param factoryName the name of the component factory, defined in the - * specified service context. - * @param configuration the configuration of the instance to create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance( - ServiceContext serviceContext, String factoryName, - Dictionary configuration) { - - // Retrieve the component factory. - Factory fact = getFactory(serviceContext, factoryName); - - if (fact == null) { - // Factory not found... - throw new IllegalArgumentException( - "Cannot find the component factory (" + factoryName - + ") in the specified service context."); - } - - try { - return fact.createComponentInstance(configuration); - } catch (Exception e) { - throw new IllegalArgumentException( - "Cannot create the component instance with the given configuration: " - + e.getMessage()); - } - } - - /** - * Creates a new component instance with the given name and configuration, - * from the factory specified in the given service context. - * - * @param serviceContext the service context in which the component factory - * service is registered. - * @param factoryName the name of the component factory, defined in the - * specified service context. - * @param instanceName the name of the component instance to create. - * @param configuration the configuration of the instance to create. - * @return the newly created component instance. - */ - public static ComponentInstance createComponentInstance( - ServiceContext serviceContext, String factoryName, - String instanceName, Dictionary configuration) { - - // Add the instance name to the configuration - configuration.put("instance.name", instanceName); - - return createComponentInstance(serviceContext, factoryName, - configuration); - } - - /** - * Creates a new component instance with the given name (and empty - * configuration), from the factory specified in the local bundle. - * - * @param factoryName the name of the component factory, defined in the - * local bundle. - * @param instanceName the name of the component instance to create. - * @return the newly created component instance. - */ - public ComponentInstance createComponentInstance(String factoryName, - String instanceName) { - ComponentInstance ci = createComponentInstance(m_context.getBundle(), - factoryName, instanceName); - m_instances.add(ci); - return ci; - } - - /** - * Creates a new component instance with the given configuration, from the - * factory specified in the local bundle. - * - * @param factoryName the name of the component factory, in the local - * bundle. - * @param configuration the configuration of the component instance to - * create. - * @return the newly created component instance. - */ - public ComponentInstance createComponentInstance(String factoryName, - Dictionary configuration) { - ComponentInstance ci = createComponentInstance(m_context.getBundle(), - factoryName, configuration); - m_instances.add(ci); - return ci; - } - - /** - * Creates a new component instance with no configuration, from the factory - * specified in the local bundle. - * - * @param factoryName the name of the component factory, in the local - * bundle. - * @return the newly created component instance. - */ - public ComponentInstance createComponentInstance(String factoryName) { - ComponentInstance ci = createComponentInstance(m_context.getBundle(), - factoryName, (Dictionary) null); - m_instances.add(ci); - return ci; - } - - /** - * Creates a new component instance with the given name and configuration, - * from the factory specified in the given bundle. - * - * @param factoryName the name of the component factory, defined in the - * specified bundle. - * @param instanceName the name of the component instance to create. - * @param configuration the configuration of the instance to create. - * @return the newly created component instance. - */ - public ComponentInstance createComponentInstance(String factoryName, - String instanceName, Dictionary configuration) { - ComponentInstance ci = createComponentInstance(m_context.getBundle(), - factoryName, instanceName, configuration); - m_instances.add(ci); - return ci; - } - - /** - * Returns the component factory with the given name in the local bundle. - * - * @param factoryName the name of the factory to retrieve. - * @return the component factory with the given name in the local bundle, or - * {@code null} if not found. - */ - public Factory getFactory(String factoryName) { - return getFactory(m_context.getBundle(), factoryName); - } - - /** - * Returns the handler factory with the given name in the local bundle. - * - * @param factoryName the name of the handler factory to retrieve. - * @return the handler factory with the given name in the local bundle, or - * {@code null} if not found. - */ - public HandlerFactory getHandlerFactory(String factoryName) { - return getHandlerFactory(m_context.getBundle(), factoryName); - } - - /** - * Returns the metadata description of the component defined in this bundle. - * - * @param component the name of the locally defined component. - * @return the metadata description of the component with the given name, - * defined in this given bundle, or {@code null} if not found. - */ - public Element getMetadata(String component) { - return getMetadata(m_context.getBundle(), component); - } - - /** - * Returns the component factory with the given name in the given bundle. - * - * @param bundle the bundle from which the component factory is defined. - * @param factoryName the name of the defined factory. - * @return the component factory with the given name in the given bundle, or - * {@code null} if not found. - */ - public static Factory getFactory(Bundle bundle, String factoryName) { - ServiceReference[] refs; - try { - // Retrieves the component factories services in the bundle. - refs = bundle.getBundleContext().getServiceReferences( - Factory.class.getName(), - "(factory.name=" + factoryName + ")"); - if (refs != null) { - return (Factory) bundle.getBundleContext().getService(refs[0]); - } - - // Factory not found... - return null; - - } catch (InvalidSyntaxException e) { - throw new IllegalArgumentException( - "Cannot get the component factory services: " - + e.getMessage()); - } - } - - /** - * Returns the component factory with the given name, registered in the - * given service context. - * - * @param serviceContext the service context in which the factory service is - * defined. - * @param factoryName the name of the factory. - * @return the component factory with the given name, registered in the - * given service context. - */ - public static Factory getFactory(ServiceContext serviceContext, - String factoryName) { - ServiceReference[] refs; - try { - // Retrieves the component factories services in the service - // context. - refs = serviceContext.getServiceReferences(Factory.class.getName(), - "(factory.name=" + factoryName + ")"); - if (refs != null) { - return (Factory) serviceContext.getService(refs[0]); - } - return null; - - } catch (InvalidSyntaxException e) { - System.err.println("Cannot get the factory " + factoryName + " : " - + e.getMessage()); - return null; - } - } - - /** - * Returns the handler factory with the given name in the given bundle. - * - * @param bundle the bundle from which the handler factory is defined. - * @param factoryName the name of the handler factory to retrieve. - * @return the handler factory with the given name in the given bundle, or - * {@code null} if not found. - */ - public static HandlerFactory getHandlerFactory(Bundle bundle, - String factoryName) { - ServiceReference[] refs; - try { - // Retrieves the handler factories services in the bundle. - refs = bundle.getBundleContext().getServiceReferences( - HandlerFactory.class.getName(), - "(" + Handler.HANDLER_NAME_PROPERTY + "=" + factoryName - + ")"); - if (refs != null) { - return (HandlerFactory) bundle.getBundleContext().getService( - refs[0]); - } - - // Factory not found... - return null; - } catch (InvalidSyntaxException e) { - throw new IllegalArgumentException( - "Cannot get the handler factory services: " - + e.getMessage()); - } - } - - /** - * Returns the metadata description of the component with the given name, - * defined in the given bundle. - * - * @param bundle the bundle from which the component is defined. - * @param component the name of the defined component. - * @return the metadata description of the component with the given name, - * defined in the given bundle, or {@code null} if not found. - */ - public static Element getMetadata(Bundle bundle, String component) { - - // Retrieves the component description from the bundle's manifest. - String elem = (String) bundle.getHeaders().get("iPOJO-Components"); - if (elem == null) { - throw new IllegalArgumentException( - "Cannot find iPOJO-Components descriptor in the specified bundle (" - + bundle.getSymbolicName() - + "). Not an iPOJO bundle."); - } - - // Parses the retrieved description and find the component with the - // given name. - try { - Element element = ManifestMetadataParser.parseHeaderMetadata(elem); - Element[] childs = element.getElements("component"); - for (int i = 0; i < childs.length; i++) { - String name = childs[i].getAttribute("name"); - String clazz = childs[i].getAttribute("classname"); - if (name != null && name.equalsIgnoreCase(component)) { - return childs[i]; - } - if (clazz.equalsIgnoreCase(component)) { - return childs[i]; - } - } - - // Component not found... - return null; - - } catch (ParseException e) { - throw new IllegalStateException( - "Cannot parse the components from specified bundle (" - + bundle.getSymbolicName() + "): " + e.getMessage()); - } - } - - /** - * Returns the service object of a service registered in the specified - * service context, offering the specified interface and matching the given - * filter. - * - * @param serviceContext the service context in which the service is - * searched. - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return the service object provided by the specified bundle, offering the - * specified interface and matching the given filter. - */ - public static Object getServiceObject(ServiceContext serviceContext, - String itf, String filter) { - ServiceReference ref = getServiceReference(serviceContext, itf, filter); - if (ref != null) { - return serviceContext.getService(ref); - } else { - return null; - } - } - - /** - * Returns the service objects of the services registered in the specified - * service context, offering the specified interface and matching the given - * filter. - * - * @param serviceContext the service context in which services are searched. - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return the service objects provided by the specified bundle, offering - * the specified interface and matching the given filter. - */ - public static Object[] getServiceObjects(ServiceContext serviceContext, - String itf, String filter) { - ServiceReference[] refs = getServiceReferences(serviceContext, itf, - filter); - if (refs != null) { - Object[] list = new Object[refs.length]; - for (int i = 0; i < refs.length; i++) { - list[i] = serviceContext.getService(refs[i]); - } - return list; - } else { - return new Object[0]; - } - } - - /** - * Returns the service reference of a service registered in the specified - * service context, offering the specified interface and matching the given - * filter. - * - * @param serviceContext the service context in which services are searched. - * @param itf the interface provided by the searched service. - * @param filter an additional filter (can be {@code null}). - * @return a service reference registered in the specified service context, - * offering the specified interface and matching the given filter. - * If no service is found, {@code null} is returned. - */ - public static ServiceReference getServiceReference( - ServiceContext serviceContext, String itf, String filter) { - ServiceReference[] refs = getServiceReferences(serviceContext, itf, - filter); - if (refs.length != 0) { - return refs[0]; - } else { - // No service found - return null; - } - } - - /** - * Returns the service reference of the service registered in the specified - * service context, offering the specified interface and having the given - * persistent ID. - * - * @param serviceContext the service context in which services are searched. - * @param itf the interface provided by the searched service. - * @param pid the persistent ID of the searched service. - * @return a service registered in the specified service context, offering - * the specified interface and having the given persistent ID. - */ - public static ServiceReference getServiceReferenceByPID( - ServiceContext serviceContext, String itf, String pid) { - String filter = "(" + "service.pid" + "=" + pid + ")"; - ServiceReference[] refs = getServiceReferences(serviceContext, itf, - filter); - if (refs == null) { - return null; - } else if (refs.length == 1) { - return refs[0]; - } else { - throw new IllegalStateException( - "A service lookup by PID returned several providers (" - + refs.length + ")" + " for " + itf + " with pid=" - + pid); - } - } - - /** - * Returns the service reference of all the services registered in the - * specified service context, offering the specified interface and matching - * the given filter. - * - * @param serviceContext the service context in which services are searched. - * @param itf the interface provided by the searched services. - * @param filter an additional filter (can be {@code null}). - * @return all the service references registered in the specified service - * context, offering the specified interface and matching the given - * filter. If no service matches, an empty array is returned. - */ - public static ServiceReference[] getServiceReferences( - ServiceContext serviceContext, String itf, String filter) { - ServiceReference[] refs = null; - try { - // Get all the service references - refs = serviceContext.getServiceReferences(itf, filter); - } catch (InvalidSyntaxException e) { - throw new IllegalArgumentException( - "Cannot get service references: " + e.getMessage()); - } - if (refs == null) { - return new ServiceReference[0]; - } else { - return refs; - } - } - - /** - * Returns the service reference of a service registered in the specified - * service context, offering the specified interface and having the given - * name. - * - * @param serviceContext the service context in which services are searched. - * @param itf the interface provided by the searched service. - * @param name the name of the searched service. - * @return a service registered in the specified service context, offering - * the specified interface and having the given name. - */ - public static ServiceReference getServiceReferenceByName( - ServiceContext serviceContext, String itf, String name) { - String filter = null; - if (itf.equals(Factory.class.getName()) - || itf.equals(ManagedServiceFactory.class.getName())) { - filter = "(" + "factory.name" + "=" + name + ")"; - } else if (itf.equals(Architecture.class.getName())) { - filter = "(" + "architecture.instance" + "=" + name + ")"; - } else { - filter = "(" + "instance.name" + "=" + name + ")"; - } - return getServiceReference(serviceContext, itf, filter); - } - - /** - * Checks the availability of a service inside the given service context. - * @param sc the service context - * @param itf the service interface to found - * @return true if the service is available in the service - * context, false otherwise. - */ - public static boolean isServiceAvailable(ServiceContext sc, String itf) { - ServiceReference ref = getServiceReference(sc, itf, null); - return ref != null; - } - - /** - * Checks the availability of a service inside the given service context. - * @param sc the service context - * @param itf the service interface to found - * @param name the service provider name - * @return true if the service is available in the service - * context, false otherwise. - */ - public static boolean isServiceAvailableByName(ServiceContext sc, - String itf, String name) { - ServiceReference ref = getServiceReferenceByName(sc, itf, name); - return ref != null; - } - - /** - * Checks the availability of a service inside the given service context. - * @param sc the service context - * @param itf the service interface to found - * @param pid the pid of the service - * @return true if the service is available in the service - * context, false otherwise. - */ - public static boolean isServiceAvailableByPID(ServiceContext sc, - String itf, String pid) { - ServiceReference ref = getServiceReferenceByPID(sc, itf, pid); - return ref != null; - } - - /** - * Returns the service reference of a service provided by the specified - * bundle, offering the specified interface and having the given name. - * - * @param bundle the bundle from which the service is searched. - * @param itf the interface provided by the searched service. - * @param name the name of the searched service. - * @return a service provided by the specified bundle, offering the - * specified interface and having the given name. - */ - public static ServiceReference getServiceReferenceByName(Bundle bundle, - String itf, String name) { - String filter = null; - if (itf.equals(Factory.class.getName()) - || itf.equals(ManagedServiceFactory.class.getName())) { - filter = "(" + "factory.name" + "=" + name + ")"; - } else if (itf.equals(Architecture.class.getName())) { - filter = "(" + "architecture.instance" + "=" + name + ")"; - } else { - filter = "(" + "instance.name" + "=" + name + ")"; - } - return OSGiTestCase.getServiceReference(bundle, itf, filter); - } - - /** - * Returns the service reference of a service provided by the local bundle, - * offering the specified interface and having the given name. - * - * @param itf the interface provided by the searched service. - * @param name the name of the searched service. - * @return a service provided by the specified bundle, offering the - * specified interface and having the given name. - */ - public ServiceReference getServiceReferenceByName(String itf, String name) { - return getServiceReferenceByName(m_context.getBundle(), itf, name); - } - - /** - * Checks if the service is available. - * @param itf the service interface - * @param name the service provider name - * @return true if the service is available, false - * otherwise. - */ - public boolean isServiceAvailableByName(String itf, String name) { - ServiceReference ref = getServiceReferenceByName(itf, name); - return ref != null; - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java deleted file mode 100644 index 45c928ef21..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/JunitExtender.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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.ipojo.junit4osgi.impl; - -import java.io.PrintStream; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import junit.framework.Test; -import junit.framework.TestResult; -import junit.framework.TestSuite; - -import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner; -import org.apache.felix.ipojo.junit4osgi.OSGiTestCase; -import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.service.log.LogService; - -/** - * Detect test suite from installed bundles. - * @author Felix Project Team - */ -public class JunitExtender implements OSGiJunitRunner { - - /** - * Suite method name. - */ - public static final String SUITE_METHODNAME = "suite"; - - /** - * List of found suites (Bundle-> List of Class). - */ - private Map/*>*/ m_suites = new HashMap/*>*/(); - - /** - * The result printer. - * By default, prints result on {@link System#out} - */ - private ResultPrinter m_printer = new ResultPrinter(System.out); - - /** - * The log service used to log messages. - * If not provided, a default implementation - * printing messages on the console is used. - */ - private LogService m_log; - - /** - * A new matching bundle arrives. - * @param bundle the matching bundle - * @param header the looked header value - */ - void onBundleArrival(Bundle bundle, String header) { - String[] tss = ParseUtils.split(header, ","); - for (int i = 0; i < tss.length; i++) { - try { - if (tss[i].length() != 0) { - m_log.log(LogService.LOG_INFO, "Loading " + tss[i]); - Class/**/ clazz = bundle.loadClass(tss[i].trim()); - addTestSuite(bundle, clazz); - } - } catch (ClassNotFoundException e) { - m_log.log(LogService.LOG_ERROR, "The test suite " + tss[i] + " is not in the bundle " + bundle.getBundleId() + " : " + e.getMessage()); - } - } - } - - /** - * Adds a test suite. - * @param bundle the bundle declaring the test suite. - * @param test the test class. - */ - private synchronized void addTestSuite(Bundle bundle, Class/**/ test) { - List/**/ list = (List) m_suites.get(bundle); - if (list == null) { - list = new ArrayList/**/(); - list.add(test); - m_suites.put(bundle, list); - } else { - list.add(test); - } - } - - /** - * Removes the test suites provided by the given bundles. - * @param bundle the leaving bundles. - */ - private synchronized void removeTestSuites(Bundle bundle) { - List list = (List) m_suites.remove(bundle); - m_log.log(LogService.LOG_INFO, "Unload test suites " + list); - } - - /** - * A matching bundle is leaving. - * @param bundle the leaving bundle. - */ - void onBundleDeparture(Bundle bundle) { - removeTestSuites(bundle); - } - - /** - * Set the result printer. - * @param pw the stream to use. - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#setResultPrinter(java.io.PrintStream) - */ - public void setResultPrinter(PrintStream pw) { - m_printer = new ResultPrinter(pw); - } - - /** - * Runs tests. - * @return the list of {@link TestResult} - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run() - */ - public synchronized List/**/ run() { - List/**/ results = new ArrayList/**/(m_suites.size()); - Iterator/*>>*/ it = m_suites.entrySet().iterator(); - while (it.hasNext()) { - Entry/*>*/ entry = (Entry) it.next(); - Bundle bundle = (Bundle) entry.getKey(); - List/**/ list = (List) m_suites.get(bundle); - for (int i = 0; i < list.size(); i++) { - Test test = createTestFromClass((Class) list.get(i), bundle); - TestResult tr = doRun(test); - results.add(tr); - } - } - return results; - } - - /** - * Internal methods executing tests. - * @param test the test to execute - * @return the result - */ - private TestResult doRun(Test test) { - TestResult result = new TestResult(); - result.addListener(m_printer); - long startTime = System.currentTimeMillis(); - - test.run(result); - - long endTime = System.currentTimeMillis(); - long runTime = endTime - startTime; - m_printer.print(result, runTime); - - return result; - } - - /** - * Creates a {@link Test} object from the - * given class from the given bundle. - * This method creates {@link OSGiTestCase} and - * {@link OSGiTestSuite} when required. - * @param clazz the class - * @param bundle the bundle - * @return the resulting Test object. - */ - private Test createTestFromClass(Class/**/ clazz, Bundle bundle) { - Method suiteMethod = null; - boolean bc = false; - try { - suiteMethod = clazz.getMethod(SUITE_METHODNAME, new Class[0]); - } catch (Exception e) { - // try to use a suite method receiving a bundle context - try { - suiteMethod = clazz.getMethod(SUITE_METHODNAME, new Class[] { BundleContext.class }); - bc = true; - } catch (Exception e2) { - // try to extract a test suite automatically - if (OSGiTestSuite.class.isAssignableFrom(clazz)) { - OSGiTestSuite ts = new OSGiTestSuite(clazz, getBundleContext(bundle)); - return ts; - } else if (OSGiTestCase.class.isAssignableFrom(clazz)) { - OSGiTestSuite ts = new OSGiTestSuite(clazz, getBundleContext(bundle)); - return ts; - } else { - return new TestSuite(clazz); - } - } - } - - if (!Modifier.isStatic(suiteMethod.getModifiers())) { - m_log.log(LogService.LOG_ERROR, "Suite() method must be static"); - return null; - } - Test test = null; - try { - if (bc) { - test = (Test) suiteMethod.invoke(null, new Object[] { getBundleContext(bundle) }); // static method injection the bundle context - } else { - test = (Test) suiteMethod.invoke(null, (Object[]) new Class[0]); // static method - } - } catch (InvocationTargetException e) { - m_log.log(LogService.LOG_ERROR, "Failed to invoke suite():" + e.getTargetException().toString()); - return null; - } catch (IllegalAccessException e) { - m_log.log(LogService.LOG_ERROR, "Failed to invoke suite():" + e.toString()); - return null; - } - - return test; - } - - /** - * Gets the list of {@link Test}. - * @return the list of {@link Test} - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#getTests() - */ - public synchronized List/**/ getTests() { - List/**/ results = new ArrayList/**/(); - Iterator/*>>*/ it = m_suites.entrySet().iterator(); - while (it.hasNext()) { - Entry/*>*/ entry = (Entry) it.next(); - Bundle bundle = (Bundle) entry.getKey(); - List/**/ list = (List) m_suites.get(bundle); - for (int i = 0; i < list.size(); i++) { - Test test = createTestFromClass((Class) list.get(i), bundle); - results.add(test); - } - } - return results; - } - - /** - * Runs the given tests. - * @param test the test to execute - * @return the result - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run(junit.framework.Test) - */ - public TestResult run(Test test) { - return doRun(test); - } - - /** - * Gets the list of {@link Test} from the bundle (specified - * by using the bundle id). - * @param bundleId the bundle id - * @return the list of {@link Test} declared in this bundle. - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#getTests(long) - */ - public synchronized List/**/ getTests(long bundleId) { - Iterator/*>>*/ it = m_suites.entrySet().iterator(); - while (it.hasNext()) { - Entry/*>*/ entry = (Entry) it.next(); - Bundle bundle = (Bundle) entry.getKey(); - if (bundle.getBundleId() == bundleId) { - List/**/ results = new ArrayList/**/(); - List/**/ list = (List) m_suites.get(bundle); - for (int i = 0; i < list.size(); i++) { - Test test = createTestFromClass((Class) list.get(i), bundle); - results.add(test); - } - return results; - } - } - return null; - } - - /** - * Runs the tests declared in the bundle - * (specified by the bundle id). - * @param bundleId the bundle id - * @return the List of {@link TestResult} - * @see org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner#run(long) - */ - public synchronized List/**/ run(long bundleId) { - Iterator/*>>*/ it = m_suites.entrySet().iterator(); - while (it.hasNext()) { - Entry/*>*/ entry = (Entry) it.next(); - Bundle bundle = (Bundle) entry.getKey(); - if (bundle.getBundleId() == bundleId) { - List/**/ results = new ArrayList/**/(); - List/**/ list = (List) m_suites.get(bundle); - for (int i = 0; i < list.size(); i++) { - Test test = createTestFromClass((Class) list.get(i), bundle); - TestResult tr = doRun(test); - results.add(tr); - } - return results; - } - } - return null; - } - - /** - * Stop method. - * Clears test suites. - */ - public synchronized void stopping() { - m_log.log(LogService.LOG_INFO, "Cleaning test suites ..."); - m_suites.clear(); - } - - /** - * Start method. - */ - public void starting() { - m_log.log(LogService.LOG_INFO, "Junit Extender starting ..."); - } - - /** - * Helper method analyzing the {@link Bundle} object - * to get the {@link BundleContext} object. - * @param bundle the Bundle - * @return the BundleContext of null if - * the BundleContext cannot be collected. - */ - private BundleContext getBundleContext(Bundle bundle) { - if (bundle == null) { return null; } - - // getBundleContext (OSGi 4.1) - Method meth = null; - try { - meth = bundle.getClass().getMethod("getBundleContext", new Class[0]); - } catch (SecurityException e) { - // Nothing do to, will try the Equinox method - } catch (NoSuchMethodException e) { - // Nothing do to, will try the Equinox method - } - - // try Equinox getContext if not found. - if (meth == null) { - try { - meth = bundle.getClass().getMethod("getContext", new Class[0]); - } catch (SecurityException e) { - // Nothing do to, will try field inspection - } catch (NoSuchMethodException e) { - // Nothing do to, will try field inspection - } - } - - if (meth != null) { - if (! meth.isAccessible()) { - meth.setAccessible(true); - } - try { - return (BundleContext) meth.invoke(bundle, new Object[0]); - } catch (IllegalArgumentException e) { - m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e); - return null; - } catch (IllegalAccessException e) { - m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e); - return null; - } catch (InvocationTargetException e) { - m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by invoking " + meth.getName(), e); - return null; - } - } - - // Else : Field inspection (KF and Prosyst) - Field[] fields = bundle.getClass().getDeclaredFields(); - for (int i = 0; i < fields.length; i++) { - if (BundleContext.class.isAssignableFrom(fields[i].getType())) { - if (! fields[i].isAccessible()) { - fields[i].setAccessible(true); - } - try { - return (BundleContext) fields[i].get(bundle); - } catch (IllegalArgumentException e) { - m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by reflecting on " + fields[i].getName(), e); - return null; - } catch (IllegalAccessException e) { - m_log.log(LogService.LOG_ERROR, "Cannot get the BundleContext by reflecting on " + fields[i].getName(), e); - return null; - } - } - } - m_log.log(LogService.LOG_ERROR, "Cannot find the BundleContext for " + bundle.getSymbolicName(), null); - return null; - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java deleted file mode 100644 index 71afd825c0..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/LogServiceImpl.java +++ /dev/null @@ -1,107 +0,0 @@ -/* - * 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.ipojo.junit4osgi.impl; - -import org.osgi.framework.ServiceReference; -import org.osgi.service.log.LogService; - -/** - * Log Service default implementation. - * @author Felix Project Team - */ -public class LogServiceImpl implements LogService { - - /** - * Creates a message. - * @param level the log level - * @param msg the message - * @param exception the thrown exception - * @return the computed message - */ - private String computeLogMessage(int level, String msg, Throwable exception) { - String message = null; - switch (level) { - case LogService.LOG_DEBUG: - message = "[DEBUG] " + msg; - break; - case LogService.LOG_ERROR: - message = "[ERROR] " + msg; - break; - case LogService.LOG_INFO: - message = "[INFO] " + msg; - break; - case LogService.LOG_WARNING: - message = "[WARNING] " + msg; - break; - default: - break; - } - - if (exception != null) { - message = message + " : " + exception.getMessage(); - } - - return message; - } - - /** - * Logs a message. - * @param arg0 the log level - * @param arg1 the message - * @see org.osgi.service.log.LogService#log(int, java.lang.String) - */ - public void log(int arg0, String arg1) { - System.err.println(computeLogMessage(arg0, arg1, null)); - } - - /** - * Logs a message. - * @param arg0 the log level - * @param arg1 the message - * @param arg2 the thrown exception - * @see org.osgi.service.log.LogService#log(int, java.lang.String) - */ - public void log(int arg0, String arg1, Throwable arg2) { - System.err.println(computeLogMessage(arg0, arg1, arg2)); - } - - /** - * Logs a message. - * @param arg0 the service reference - * @param arg1 the log level - * @param arg2 the message - * @see org.osgi.service.log.LogService#log(ServiceReference, int, String) - */ - public void log(ServiceReference arg0, int arg1, String arg2) { - System.err.println(computeLogMessage(arg1, arg2, null)); - } - - /** - * Logs a message. - * @param arg0 the service reference - * @param arg1 the log level - * @param arg2 the message - * @param arg3 the thrown exception - * @see org.osgi.service.log.LogService#log(ServiceReference, int, String, Throwable) - */ - public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3) { - System.err.println(computeLogMessage(arg1, arg2, arg3)); - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java deleted file mode 100644 index 906658b34e..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/impl/ResultPrinter.java +++ /dev/null @@ -1,227 +0,0 @@ -/* - * 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.ipojo.junit4osgi.impl; - -import java.io.PrintStream; -import java.text.NumberFormat; -import java.util.Enumeration; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestFailure; -import junit.framework.TestListener; -import junit.framework.TestResult; -import junit.runner.BaseTestRunner; - -/** - * Result Printer. - * @author Felix Project Team - */ -public class ResultPrinter implements TestListener { - /** - * the writer. - */ - PrintStream m_fWriter; - - /** - * The column . - */ - int m_fColumn = 0; - - /** - * Creates a ResultPrinter. - * @param writer the printer - */ - public ResultPrinter(PrintStream writer) { - m_fWriter = writer; - } - - /** - * Prints the result. - * @param result the test result - * @param runTime the test duration - */ - synchronized void print(TestResult result, long runTime) { - printHeader(runTime); - printErrors(result); - printFailures(result); - printFooter(result); - } - - /** - * Prints message wiating for prompt. - */ - void printWaitPrompt() { - getWriter().println(); - getWriter().println(" to continue"); - } - - /* - * Internal methods - */ - - /** - * Prints the result header. - * @param runTime the test execution duration - */ - protected void printHeader(long runTime) { - getWriter().println(); - getWriter().println("Time: " + elapsedTimeAsString(runTime)); - } - - /** - * Prints the errors. - * @param result the test result - */ - protected void printErrors(TestResult result) { - printDefects(result.errors(), result.errorCount(), "error"); - } - - /** - * Prints failures. - * @param result the test result - */ - protected void printFailures(TestResult result) { - printDefects(result.failures(), result.failureCount(), "failure"); - } - - /** - * Prints failures. - * @param booBoos the failures - * @param count the number of failures - * @param type the type - */ - protected void printDefects(Enumeration/**/ booBoos, int count, String type) { - if (count == 0) { - return; - } - - if (count == 1) { - getWriter().println("There was " + count + " " + type + ":"); - } else { - getWriter().println("There were " + count + " " + type + "s:"); - } - - for (int i = 1; booBoos.hasMoreElements(); i++) { - printDefect((TestFailure) booBoos.nextElement(), i); - } - } - - /** - * Prints a failure. - * @param booBoo the failure - * @param count the count - */ - public void printDefect(TestFailure booBoo, int count) { // only public for testing purposes - printDefectHeader(booBoo, count); - printDefectTrace(booBoo); - } - - /** - * Prints defect header. - * @param booBoo the failure - * @param count the count - */ - protected void printDefectHeader(TestFailure booBoo, int count) { - // I feel like making this a println, then adding a line giving the throwable a chance to print something - // before we get to the stack trace. - getWriter().print(count + ") " + booBoo.failedTest()); - } - - /** - * Prints the stack trace. - * @param booBoo the failure - */ - protected void printDefectTrace(TestFailure booBoo) { - getWriter().print(BaseTestRunner.getFilteredTrace(booBoo.trace())); - } - - /** - * Prints the footer. - * @param result the test result. - */ - protected void printFooter(TestResult result) { - if (result.wasSuccessful()) { - getWriter().println(); - getWriter().print("OK"); - getWriter().println(" (" + result.runCount() + " test" + (result.runCount() == 1 ? "" : "s") + ")"); - - } else { - getWriter().println(); - getWriter().println("FAILURES!!!"); - getWriter().println("Tests run: " + result.runCount() + ", Failures: " + result.failureCount() + ", Errors: " + result.errorCount()); - } - getWriter().println(); - } - - /** - * Returns the formatted string of the elapsed time. - * @param runTime the elapsed time - * @return the elapsed time. - */ - protected String elapsedTimeAsString(long runTime) { - return NumberFormat.getInstance().format((double) runTime / 1000); - } - - public PrintStream getWriter() { - return m_fWriter; - } - - /** - * Adds an error. - * @param test the test in error. - * @param t the thrown error - * @see junit.framework.TestListener#addError(Test, Throwable) - */ - public void addError(Test test, Throwable t) { - getWriter().print("E"); - } - - /** - * Adds a failure. - * @param test the failing test. - * @param t the thrown failure - * @see junit.framework.TestListener#addFailure(Test, AssertionFailedError) - */ - public void addFailure(Test test, AssertionFailedError t) { - getWriter().print("F"); - } - - /** - * A test ends. - * (do nothing) - * @param test the ending test - * @see junit.framework.TestListener#endTest(Test) - */ - public void endTest(Test test) { } - - /** - * A test starts. - * @param test the starting test - * @see junit.framework.TestListener#startTest(Test) - */ - public void startTest(Test test) { - getWriter().print("."); - if (m_fColumn++ >= 40) { - getWriter().println(); - m_fColumn = 0; - } - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java deleted file mode 100644 index 9d59e00f1c..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.junit4osgi.test; - -import org.apache.felix.ipojo.junit4osgi.OSGiTestCase; - -/** - * Simple OSGi Test Case. - * @author Felix Project Team - */ -public class TestOSGiTestCase extends OSGiTestCase { - - /** - * Test. - */ - public void test1() { - System.out.println("Test BC"); - assertNotNull("Test bundle context", getContext()); - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java deleted file mode 100644 index 746a017b26..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestOSGiTestSuite.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.junit4osgi.test; - -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.apache.felix.ipojo.junit4osgi.OSGiTestSuite; -import org.osgi.framework.BundleContext; - -/** - * Simple OSGi Test suite. - * @author Felix Project Team - */ -public class TestOSGiTestSuite extends TestSuite { - - /** - * Suite method. - * @param bc the bundle context - * @return the Test Suite. - */ - public static Test suite(BundleContext bc) { - TestSuite ts = new TestSuite(); - ts.setName("Test OSGi suite() method"); - ts.addTestSuite(TestTestCase.class); - OSGiTestSuite ots = new OSGiTestSuite(TestOSGiTestCase.class, bc); - ots.setBundleContext(bc); - ts.addTest(ots); - return ts; - } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java deleted file mode 100644 index c2f0ae4a86..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestCase.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.junit4osgi.test; - -import junit.framework.TestCase; - -/** - * Simple Test Case. - * @author Felix Project Team - */ -public class TestTestCase extends TestCase { - - /** - * test1. - */ - public void test1() { } - - /** - * test2. - */ - public void test2() { } - - /** - * test3. - */ - public void test3() { } - - /** - * test4. - */ - public void test4() { } - -} diff --git a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java b/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java deleted file mode 100644 index d559ed927d..0000000000 --- a/ipojo/junit4osgi/junit4osgi/src/main/java/org/apache/felix/ipojo/junit4osgi/test/TestTestSuite.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.junit4osgi.test; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * Simple OSGi Test Suite. - * @author Felix Project Team - */ -public class TestTestSuite extends TestSuite { - - /** - * Suite method. - * @return the test suite. - */ - public static Test suite() { - TestSuite ts = new TestSuite(); - ts.setName("Test suite() method"); - ts.addTestSuite(TestTestCase.class); - return ts; - } - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE b/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE b/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE deleted file mode 100644 index 657444e8de..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/NOTICE +++ /dev/null @@ -1,31 +0,0 @@ -Apache Felix iPOJO junit4osgi Maven Plugin -Copyright 2008-2009 The Apache Software Foundation - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -II. Used Software - -This product uses software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -This product uses software developed by -Junit project (http://junit.org) -Licensed under Common Public License 1.0. - -This product uses software developed at -The Codehaus (http://www.codehaus.org) -Licensed under the Apache License 2.0. - -III. License Summary -- Apache License 2.0 -- Common Public License 1.0 diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt b/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt deleted file mode 100644 index 524e88b133..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/doc/changelog.txt +++ /dev/null @@ -1,3 +0,0 @@ -Version 1.0.0 -------------- - * Initial release \ No newline at end of file diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml b/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml deleted file mode 100644 index 785248c4e3..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/pom.xml +++ /dev/null @@ -1,113 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - maven-junit4osgi-plugin - maven-plugin - 1.1.0-SNAPSHOT - Junit4OSGi Maven Plugin - - - junit - junit - 3.8.1 - - - org.apache.felix - org.apache.felix.framework - 4.0.3 - - - org.apache.maven - maven-artifact - 2.0.7 - - - org.apache.maven - maven-project - 2.0.7 - - - org.apache.maven - maven-model - 2.0.7 - - - org.apache.maven - maven-plugin-api - 2.0.7 - - - org.apache.felix - org.apache.felix.ipojo - 1.9.0-SNAPSHOT - - - org.apache.felix - org.apache.felix.ipojo.handler.extender - 1.4.0 - - - org.apache.felix - org.apache.felix.ipojo.junit4osgi - 1.1.0-SNAPSHOT - - - net.sourceforge.cobertura - cobertura - 1.9 - - - org.osgi - org.osgi.core - 4.2.0 - - - - - - org.codehaus.mojo - rat-maven-plugin - - false - true - true - - doc/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java deleted file mode 100644 index 35194034f2..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Installer.java +++ /dev/null @@ -1,207 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.List; -import java.util.jar.JarFile; - -import org.apache.maven.artifact.Artifact; -import org.apache.maven.project.MavenProject; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; - -/** - * Bundle Activator installing bundles in the embedded OSGi. - * Installed bundles are the junit4osgi framework, the required bundle and the artifact bundle (if enable). - * Bundles are installed from the local maven repository. - * @author Felix Project Team - */ -public class Installer implements BundleActivator { - - /** - * The list of artifact containing bundles for the junit4osgi framework. - */ - private List m_artifacts; - - /** - * The current maven project. - */ - private MavenProject m_project; - - /** - * Flag enabling/disabling the deployment of the current - * project artifact. - */ - private boolean m_deployCurrent; - - /** - * List of bundle URLs to install. - */ - private List m_bundles; - - - /** - * Creates a Installer. - * @param artifacts the list of artifact containing bundles for the junit4osgi framework. - * @param bundles the list of bundle URLs to install - * @param project the current maven project - * @param deployCurrentArtifact flag enabling/disabling the deployment of the current project artifact - */ - public Installer(List artifacts, List bundles, MavenProject project, boolean deployCurrentArtifact) { - this.m_artifacts = artifacts; - this.m_project = project; - m_deployCurrent = deployCurrentArtifact; - this.m_bundles = bundles; - } - - /** - * Installs and starts the iPOJO bundle. - * @param context the bundle context. - * @throws BundleException when the bundle cannot be installed or started correctly - */ - private void installIPOJO(BundleContext context) throws BundleException { - String path = getUrlByArtifactId("org.apache.felix.ipojo").toString(); - Bundle bundle = context.installBundle(path); - bundle.start(); - } - - /** - * Installs and starts the Junit4OSGi bundle. - * @param context the bundle context. - * @throws BundleException when the bundle cannot be installed or started correctly - */ - private void installJunit(BundleContext context) throws BundleException { - String path = getUrlByArtifactId("org.apache.felix.ipojo.junit4osgi").toString(); - Bundle bundle = context.installBundle(path); - bundle.start(); - } - - /** - * Installs and starts the iPOJO Extender Handler bundle. - * @param context the bundle context. - * @throws BundleException when the bundle cannot be installed or started correctly - */ - private void installExtender(BundleContext context) throws BundleException { - String path = getUrlByArtifactId("org.apache.felix.ipojo.handler.extender").toString(); - Bundle bundle = context.installBundle(path); - bundle.start(); - } - - /** - * Installs and Starts required bundles. - * @param context the bundle context used to deploy bundles. - * @throws BundleException when a bundle cannot be installed or started correctly - */ - private void deployBundles(BundleContext context) throws BundleException { - for (int i = 0; i < m_bundles.size(); i++) { - URL url = (URL) m_bundles.get(i); - Bundle bundle = context.installBundle(url.toString()); - bundle.start(); - } - } - - /** - * Gets the bundle URL from the artifact list. - * @param id the dependency id. - * @return the bundle URL or null if the URL cannot - * be found. - */ - private URL getUrlByArtifactId(String id) { - for (int i = 0; i < m_artifacts.size(); i++) { - Artifact artifact = (Artifact) m_artifacts.get(i); - if (artifact.getArtifactId().equals(id)) { - try { - return artifact.getFile().toURL(); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - } - } - return null; - } - - /** - * Deploys the current bundle if enable. - * @param context the bundle context - * @throws BundleException when the bundle cannot be installed or started correctly. - */ - private void deployProjectArtifact(BundleContext context) - throws BundleException { - if (!m_deployCurrent) { - return; - } - - File file = m_project.getArtifact().getFile(); - try { - if (file.exists()) { - if (file.getName().endsWith("jar")) { - JarFile jar = new JarFile(file); - if (jar.getManifest().getMainAttributes().getValue("Bundle-ManifestVersion") != null) { - Bundle bundle = context.installBundle(file.toURL().toString()); - bundle.start(); - } else { - System.err.println("The current artifact " + file.getName() + " is not a valid bundle"); - } - } else { - System.err.println("The current artifact " + file.getName() + " is not a Jar file."); - } - } else { - System.err.println("The current artifact " + file.getName() + " does not exist."); - } - } catch (Exception e) { - throw new BundleException("The current project artifact cannot be installed (" + e.getMessage() + ")"); - } - - - } - - - /** - * Start bundles. - * @param context the bundle context. - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext context) { - try { - installIPOJO(context); - installExtender(context); - installJunit(context); - deployBundles(context); - deployProjectArtifact(context); - } catch (BundleException e) { - System.err.println("Cannot start the framework : " + e.getMessage()); - return; - } - } - - /** - * Stopping methods. - * @param context the bundle context. - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext context) { - // Do nothing. - } - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java deleted file mode 100644 index 7bd7c86295..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Junit4osgiPlugin.java +++ /dev/null @@ -1,755 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.File; -import java.io.PrintStream; -import java.lang.reflect.Method; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.jar.JarFile; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestFailure; -import junit.framework.TestListener; -import junit.framework.TestResult; - -import org.apache.felix.framework.Felix; -import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner; -import org.apache.felix.ipojo.junit4osgi.plugin.log.LogServiceImpl; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoFailureException; -import org.apache.maven.project.MavenProject; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -/** - * Goal starting Felix and executing junit4osgi tests. - * - * @goal test - * @phase integration-test - * @requiresDependencyResolution runtime - * @author Felix Project Team - * - */ -public class Junit4osgiPlugin extends AbstractMojo { - - /** - * The Maven project. - * - * @parameter expression="${project}" - * @required - * @readonly - */ - private MavenProject m_project; - - /** - * Dependencies of the current plugin. - * @parameter expression="${plugin.artifacts}" - */ - private java.util.List m_pluginArtifacts; - - /** - * Base directory where all reports are written to. - * - * @parameter expression="${project.build.directory}/surefire-reports" - */ - private File m_reportsDirectory; - - /** - * Base directory where all reports are written to. - * - * @parameter expression="${project.build.directory}" - */ - private File m_targetDir; - - /** - * Must the current artifact be deployed? - * - * @parameter expression="${deployProjectArtifact}" default-value="true" - */ - private boolean m_deployProjectArtifact; - - /** - * Required bundles. - * - * @parameter - */ - private List bundles; - - /** - * Felix configuration. - * - * @parameter - */ - private Map configuration; - - /** - * Enables / Disables the log service provided by the plugin. - * - * @parameter expression="${logService}" default-value="true" - */ - private boolean m_logEnable; - - /** - * Number of executed test case. - */ - private int m_total; - - /** - * Number of failing test case. - */ - private int m_totalFailures; - - /** - * Number of test case in error . - */ - private int m_totalErrors; - - /** - * Test results in error. - */ - private List m_errors = new ArrayList(); - - /** - * Failing test results. - */ - private List m_failures = new ArrayList(); - - /** - * Test results. - */ - private List m_results = new ArrayList(); - - /** - * Log Service exposed by the plug-in framework. - */ - private LogServiceImpl m_logService; - - /** - * Set this to 'true' to bypass unit tests entirely. Its use is NOT RECOMMENDED, especially if you - * enable it using the "maven.test.skip" property, because maven.test.skip disables both running the - * tests and compiling the tests. Consider using the skipTests parameter instead. - * - * @parameter expression="${maven.test.skip}" - */ - private boolean skip; - - /** - * Set this to true to ignore a failure during testing. Its use is NOT RECOMMENDED, but quite convenient on - * occasion. - * - * @parameter expression="${maven.test.failure.ignore}" - */ - private boolean testFailureIgnore; - - /** - * Set this to avoid printing test execution trace on System.out and System.err. This will be written in the - * reports. - * @parameter - */ - private boolean hideOutputs; - - /** - * Felix configuration. - */ - private Map felixConf; - - - /** - * Executes the plug-in. - * @throws MojoFailureException when the test execution failed. - * @see org.apache.maven.plugin.AbstractMojo#execute() - */ - public void execute() throws MojoFailureException { - - if (skip) { - getLog().info("Tests are skipped"); - return; - } - - - List bundles = parseBundleList(); - bundles.addAll(getTestBundle()); - - List activators = new ArrayList(); - m_logService = new LogServiceImpl(); - if (m_logEnable) { // Starts the log service if enabled - activators.add(m_logService); - } else { - getLog().info("Log Service disabled"); - } - activators.add(new Installer(m_pluginArtifacts, bundles, m_project, m_deployProjectArtifact)); - felixConf = new HashMap(); - felixConf.put("felix.systembundle.activators", activators); - felixConf.put("org.osgi.framework.storage.clean", "onFirstInit"); - felixConf.put("ipojo.log.level", "WARNING"); - // Use a boot delagation to share classes between the host and the embedded Felix. - // The cobertura package is used during code coverage collection - //felixConf.put("org.osgi.framework.bootdelegation", "net.sourceforge.cobertura.coveragedata"); - felixConf.put("org.osgi.framework.system.packages.extra", "org.osgi.service.log;version=1.3, junit.framework;version=1.3"); - - //felixConf.put("org.osgi.framework.system.packages.extra", "org.osgi.service.log, junit.framework"); - - felixConf.put("org.osgi.framework.storage", m_targetDir.getAbsolutePath() + "/felix-cache"); - - felixConf.put(Constants.FRAMEWORK_BUNDLE_PARENT, Constants.FRAMEWORK_BUNDLE_PARENT_FRAMEWORK); - - if (configuration != null) { - felixConf.putAll(configuration); - // Check boot delegation -// String bd = (String) felixConf.get("org.osgi.framework.bootdelegation"); -//// if (bd.indexOf("junit.framework") == -1) { -//// bd.concat(", junit.framework"); -//// } -//// if (bd.indexOf("org.osgi.service.log") == -1) { -//// bd.concat(", org.osgi.service.log"); -//// } -// if (bd.indexOf("net.sourceforge.cobertura.coveragedata") == -1) { -// bd.concat(", net.sourceforge.cobertura.coveragedata"); -// } - } - - System.out.println(""); - System.out.println("-------------------------------------------------------"); - System.out.println(" T E S T S"); - System.out.println("-------------------------------------------------------"); - - Felix felix = new Felix(felixConf); - try { - felix.start(); - } catch (BundleException e) { - e.printStackTrace(); - } - - getLog().info("Felix started - Waiting for stability"); - - waitForStability(felix.getBundleContext()); - - getLog().info("Bundle Stability Reached - Waiting for runner service"); - - Object runner = waitForRunnerService(felix.getBundleContext()); - - if (runner == null) { - throw new MojoFailureException("Cannot intialize the testing framework"); - } - - getLog().info("Runner Service available"); - - invokeRun(runner, felix.getBundleContext()); - - try { - felix.stop(); - felix.waitForStop(5000); - // Delete felix-cache - File cache = new File(m_targetDir.getAbsolutePath() + "/felix-cache"); - cache.delete(); - } catch (Exception e) { - getLog().error(e); - } - - if (m_totalErrors > 0 || m_totalFailures > 0) { - if (! testFailureIgnore) { - throw new MojoFailureException("There are test failures. \n\n" - + "Please refer to " + m_reportsDirectory.getAbsolutePath() - + " for the individual test results."); - } else { - getLog().warn("There are test failures. \n\n" - + "Please refer to " + m_reportsDirectory.getAbsolutePath() - + " for the individual test results."); - } - } - - } - - /** - * Waits for stability: - *

    - *
  • all bundles are activated - *
  • service count is stable - *
- * If the stability can't be reached after a specified time, - * the method throws a {@link MojoFailureException}. - * @param context the bundle context - * @throws MojoFailureException when the stability can't be reach after a several attempts. - */ - private void waitForStability(BundleContext context) throws MojoFailureException { - // Wait for bundle initialization. - boolean bundleStability = getBundleStability(context); - int count = 0; - while (!bundleStability && count < 500) { - try { - Thread.sleep(5); - } catch (InterruptedException e) { - // Interrupted - } - count++; - bundleStability = getBundleStability(context); - } - - if (count == 500) { - getLog().error("Bundle stability isn't reached after 500 tries"); - dumpBundles(context); - throw new MojoFailureException("Cannot reach the bundle stability"); - } - - //DEBUG - Bundle[] bundles = context.getBundles(); - getLog().debug("Bundles List"); - for (int i = 0; i < bundles.length; i++) { - getLog().debug(bundles[i].getSymbolicName() + " - " + bundles[i].getVersion() + " - " + bundles[i].getState()); - } - getLog().debug("--------------"); - // END DEBUG - - boolean serviceStability = false; - count = 0; - int count1 = 0; - int count2 = 0; - while (! serviceStability && count < 500) { - try { - ServiceReference[] refs = context.getServiceReferences((String) null, null); - count1 = refs.length; - Thread.sleep(500); - refs = context.getServiceReferences((String) null, null); - count2 = refs.length; - serviceStability = count1 == count2; - } catch (Exception e) { - getLog().error(e); - serviceStability = false; - // Nothing to do, while recheck the condition - } - count++; - } - - if (count == 500) { - getLog().error("Service stability isn't reached after 500 tries (" + count1 + " != " + count2); - dumpBundles(context); - throw new MojoFailureException("Cannot reach the service stability"); - } - - try { - ServiceReference[] refs = context.getServiceReferences((String) null, null); - getLog().debug("Service List"); - for (int i = 0; i < refs.length; i++) { - String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS); - List list = Arrays.asList(itfs); - if (list.contains("org.apache.felix.ipojo.architecture.Architecture")) { - getLog().debug(list.toString() + " - " + refs[i].getProperty("architecture.instance")); - } else { - getLog().debug(list.toString()); - } - } - getLog().debug("--------------"); - } catch (Exception e) {} - - } - - /** - * Are bundle stables. - * @param bc the bundle context - * @return true if every bundles are activated. - */ - private boolean getBundleStability(BundleContext bc) { - boolean stability = true; - Bundle[] bundles = bc.getBundles(); - for (int i = 0; i < bundles.length; i++) { - stability = stability && (bundles[i].getState() == Bundle.ACTIVE); - } - return stability; - } - - /** - * Computes the URL list of bundles to install from - * the bundles parameter. - * @return the list of url of bundles to install. - */ - private List parseBundleList() { - List toDeploy = new ArrayList(); - if (bundles == null) { - return toDeploy; - } - for (int i = 0; i < bundles.size(); i++) { - String bundle = (String) bundles.get(i); - try { - URL url = new URL(bundle); - toDeploy.add(url); - } catch (MalformedURLException e) { - // Not a valid url, - getLog().error(bundle + " is not a valid url, bundle ignored"); - } - } - - return toDeploy; - } - - /** - * Computes the URL list of bundles to install from - * test scoped dependencies. - * @return the list of url of bundles to install. - */ - private List getTestBundle() { - List toDeploy = new ArrayList(); - Set dependencies = m_project.getDependencyArtifacts(); - for (Iterator artifactIterator = dependencies.iterator(); artifactIterator.hasNext();) { - Artifact artifact = (Artifact) artifactIterator.next(); - if (artifact.getScope() != null) { // Select not null scope... [Select every bundles with a scope TEST, COMPILE and RUNTIME] - File file = artifact.getFile(); - try { - if (file.exists()) { - if (file.getName().endsWith("jar") && ! file.getName().startsWith("org.apache.felix.ipojo-")) { - JarFile jar = new JarFile(file); - if (jar.getManifest().getMainAttributes().getValue("Bundle-ManifestVersion") != null) { - toDeploy.add(file.toURI().toURL()); - } - } // else { -// getLog().info("The artifact " + artifact.getFile().getName() + " is not a Jar file."); -// } - } else { - getLog().info("The artifact " + artifact.getFile().getName() + " does not exist."); - } - } catch (Exception e) { - getLog().error(file + " is not a valid bundle, this artifact is ignored"); - } - } - } - return toDeploy; - } - - /** - * Waits until the {@link OSGiJunitRunner} service - * is published. - * @param bc the bundle context - * @return the {@link OSGiJunitRunner} service object. - */ - private Object waitForRunnerService(BundleContext bc) { - ServiceReference ref = bc.getServiceReference(org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner.class.getName()); - int count = 0; - while (ref == null && count < 1000) { - try { - Thread.sleep(5); - count++; - } catch (InterruptedException e) { - // Nothing to do - } - ref = bc.getServiceReference(org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner.class.getName()); - } - if (ref != null) { - return bc.getService(ref); - } - getLog().error("Junit Runner service unavailable"); - - dumpServices(bc); - - return null; - } - - /** - * Executes tests by using reflection. - * @param runner the {@link OSGiJunitRunner} service object - * @param bc the bundle context - */ - private void invokeRun(Object runner, BundleContext bc) { - Method getTest; - - try { - getTest = runner.getClass().getMethod("getTests", new Class[0]); - List tests = (List) getTest.invoke(runner, new Object[0]); - Method run = getRunMethod(runner); - for (int i = 0; i < tests.size(); i++) { - executeTest(runner, (Test) tests.get(i), run, bc); - } - System.out.println("\nResults :"); - if (m_failures.size() > 0) { - System.out.println("\nFailed tests:"); - for (int i = 0; i < m_failures.size(); i++) { - TestResult tr = (TestResult) m_failures.get(i); - Enumeration e = tr.failures(); - while (e.hasMoreElements()) { - TestFailure tf = (TestFailure) e.nextElement(); - System.out.println(" " + tf.toString()); - } - } - } - - if (m_failures.size() > 0) { - System.out.println("\nTests in error:"); - for (int i = 0; i < m_errors.size(); i++) { - TestResult tr = (TestResult) m_errors.get(i); - Enumeration e = tr.errors(); - while (e.hasMoreElements()) { - TestFailure tf = (TestFailure) e.nextElement(); - System.out.println(" " + tf.toString()); - } - } - } - - System.out.println("\nTests run: " + m_total + ", Failures: " + m_totalFailures + ", Errors:" + m_totalErrors + "\n"); - } catch (Exception e) { - getLog().error(e); - } - } - - /** - * Gets the {@link OSGiJunitRunner#run(long)} method from the - * {@link OSGiJunitRunner} service object. - * @param runner the {@link OSGiJunitRunner} service object. - * @return the Method object for the run method. - */ - private Method getRunMethod(Object runner) { - Method[] methods = runner.getClass().getMethods(); - for (int i = 0; i < methods.length; i++) { - if (methods[i].getName().equals("run") - && methods[i].getParameterTypes().length == 1 - && ! methods[i].getParameterTypes()[0].equals(Long.TYPE)) { - return methods[i]; - } - } - getLog().error("Cannot find the run method"); - return null; - } - - /** - * Computes the name of the given test. - * This method calls the {@link TestCase#getName()} - * method by reflection. If no success, invokes the - * {@link Object#toString()} method. - * @param test the test object. - * @return the name of the given test. - */ - private String getTestName(Object test) { - try { - Method getName = test.getClass().getMethod("getName", new Class[0]); - String name = (String) getName.invoke(test, new Object[0]); - if (name == null) { - name = test.toString(); - } - return name; - } catch (Exception e) { - getLog().error(e); - return null; - } - - } - - /** - * Executes the given test. - * @param runner the {@link OSGiJunitRunner} service object - * @param test the test to run - * @param run the {@link OSGiJunitRunner#run(long)} method - * @param bc the bundle context - */ - private void executeTest(Object runner, Test test, Method run, - BundleContext bc) { - try { - XMLReport report = new XMLReport(); - String name = getTestName(test); - System.out.println("Running " + name); - - TestResult tr = new TestResult(); - tr.addListener(new ResultListener(report)); - test.run(tr); - m_results.add(tr); - - if (tr.wasSuccessful()) { - System.out.println("Tests run: " - + tr.runCount() - + ", Failures: " - + tr.failureCount() - + ", Errors: " - + tr.errorCount() - + ", Time elapsed: " - + report.elapsedTimeAsString(report.m_endTime - - report.m_endTime) + " sec"); - } else { - System.out.println("Tests run: " - + tr.runCount() - + ", Failures: " - + tr.failureCount() - + ", Errors: " - + tr.errorCount() - + ", Time elapsed: " - + report.elapsedTimeAsString(report.m_endTime - - report.m_endTime) + " sec <<< FAILURE!"); - if (tr.errorCount() > 0) { - m_errors.add(tr); - } - if (tr.failureCount() > 0) { - m_failures.add(tr); - } - } - - m_total += tr.runCount(); - m_totalFailures += tr.failureCount(); - m_totalErrors += tr.errorCount(); - - report.generateReport(test, tr, m_reportsDirectory, bc, felixConf); - - } catch (Exception e) { - getLog().error(e); - } - - } - - /** - * Prints the bundle list. - * @param bc the bundle context. - */ - public void dumpBundles(BundleContext bc) { - getLog().info("Bundles:"); - Bundle[] bundles = bc.getBundles(); - for (int i = 0; i < bundles.length; i++) { - getLog().info(bundles[i].getSymbolicName() + " - " + bundles[i].getState()); - } - } - - /** - * Prints the service list. - * @param bc the bundle context. - */ - public void dumpServices(BundleContext bc) { - getLog().info("Services:"); - ServiceReference[] refs = null; - try { - refs = bc.getAllServiceReferences(null, null); - } catch (InvalidSyntaxException e) { - e.printStackTrace(); - } - for (int i = 0; i < refs.length; i++) { - String[] itfs = (String[]) refs[i].getProperty(Constants.OBJECTCLASS); - String bundle = refs[i].getBundle().getSymbolicName(); - getLog().info(bundle + " : " + Arrays.toString(itfs)); - } - } - - public LogServiceImpl getLogService() { - return m_logService; - } - - - private class ResultListener implements TestListener { - - /** - * The XML Report. - */ - private XMLReport m_report; - - /** - * Check if the test has failed or thrown an - * error. - */ - private boolean m_abort; - - /** - * Backup of the {@link System#out} stream. - */ - private PrintStream m_outBackup = System.out; - - /** - * Backup of the {@link System#err} stream. - */ - private PrintStream m_errBackup = System.err; - - /** - * The output stream used during the test execution. - */ - private StringOutputStream m_out = new StringOutputStream(); - - /** - * The error stream used during the test execution. - */ - private StringOutputStream m_err = new StringOutputStream();; - - /** - * Creates a ResultListener. - * @param report the XML report - */ - public ResultListener(XMLReport report) { - this.m_report = report; - } - - /** - * An error occurs during the test execution. - * @param test the test in error - * @param throwable the thrown error - * @see junit.framework.TestListener#addError(junit.framework.Test, java.lang.Throwable) - */ - public void addError(Test test, Throwable throwable) { - m_report.testError(test, throwable, m_out.toString(), m_err.toString(), getLogService().getLoggedMessages()); - m_abort = true; - } - - /** - * An failure occurs during the test execution. - * @param test the failing test - * @param assertionfailederror the failure - * @see junit.framework.TestListener#addFailure(junit.framework.Test, junit.framework.AssertionFailedError) - */ - public void addFailure(Test test, - AssertionFailedError assertionfailederror) { - m_report.testFailed(test, assertionfailederror, m_out.toString(), m_err.toString(), getLogService().getLoggedMessages()); - m_abort = true; - - } - - /** - * The test ends. - * @param test the test - * @see junit.framework.TestListener#endTest(junit.framework.Test) - */ - public void endTest(Test test) { - if (!m_abort) { - m_report.testSucceeded(test); - } - System.setErr(m_errBackup); - System.setOut(m_outBackup); - getLogService().reset(); - } - - /** - * The test starts. - * @param test the test - * @see junit.framework.TestListener#startTest(junit.framework.Test) - */ - public void startTest(Test test) { - m_abort = false; - m_report.testStarting(); - System.setErr(new ReportPrintStream(m_err,m_errBackup, hideOutputs)); - System.setOut(new ReportPrintStream(m_out, m_outBackup, hideOutputs)); - getLogService().enableOutputStream(); - } - - } - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java deleted file mode 100644 index 16ab48b034..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/Report.java +++ /dev/null @@ -1,239 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.text.NumberFormat; -import java.util.ArrayList; -import java.util.List; -import java.util.Locale; - -import junit.framework.Test; - -import org.codehaus.plexus.util.StringUtils; - -/** - * Test report. - * This class is provides the basics to support several output format. - * @author Felix Project Team - */ -public class Report { - - /** - * New line constant. - */ - protected static final String NL = System.getProperty("line.separator"); - - /** - * Number of ran tests. - */ - protected int m_completedCount; - - /** - * Number of errors. - */ - protected int m_errorsCount; - - /** - * Number of failures. - */ - protected int m_failuresCount; - - - /** - * Time at the beginning of the test execution. - */ - protected long m_startTime; - - /** - * Time at the end of the test execution. - */ - protected long m_endTime; - - /** - * Failing tests. - */ - private List m_failureSources = new ArrayList(); - - /** - * Tests in error. - */ - private List m_errorSources = new ArrayList(); - - /** - * Double format. - */ - private NumberFormat m_numberFormat = NumberFormat.getInstance(Locale.US); - - /** - * Gets failing tests. - * @return the list of failing tests. - */ - public List getFailureSources() { - return this.m_failureSources; - } - - /** - * Gets tests in error. - * @return the list of test throwing unexpected exceptions - */ - public List getErrorSources() { - return this.m_errorSources; - } - - /** - * Callback called when a test starts. - */ - public void testStarting() { - m_startTime = System.currentTimeMillis(); - } - - /** - * Callback called when a test ends successfully. - */ - public void testSucceeded() { - endTest(); - } - - /** - * Callback called when a test throws an unexpected error. - * @param test the test in error. - */ - public void testError(Test test) { - ++m_errorsCount; - m_errorSources.add(test.toString()); - endTest(); - } - - /** - * Callback called when a test fails. - * @param test the failing test. - */ - public void testFailed(Test test) { - ++m_failuresCount; - m_failureSources.add(test.toString()); - endTest(); - } - - /** - * Callback called when a test ends. - * This method handles common action when a test ends. - */ - private void endTest() { - ++m_completedCount; - - m_endTime = System.currentTimeMillis(); - - if (m_startTime == 0) { - m_startTime = m_endTime; - } - } - - - public int getNumErrors() { - return m_errorsCount; - } - - public int getNumFailures() { - return m_failuresCount; - } - - public int getNumTests() { - return m_completedCount; - } - - /** - * Reset the report. - */ - public void reset() { - m_errorsCount = 0; - - m_failuresCount = 0; - - m_completedCount = 0; - - this.m_failureSources = new ArrayList(); - - this.m_errorSources = new ArrayList(); - - } - - - /** - * Returns the formatted String to display the given double. - * @param runTime the elapsed time - * @return the String displaying the elapsed time - */ - protected String elapsedTimeAsString(long runTime) { - return m_numberFormat.format((double) runTime / 1000); - } - - /** - * Returns the stack trace as String. - * @param test the test - * @param e the exception - * @return stack trace as string. - */ - protected String getStackTrace(Test test, Throwable e) { - - if (e == null) { - return ""; - } - - StringWriter w = new StringWriter(); - if (e != null) { - e.printStackTrace(new PrintWriter(w)); - w.flush(); - } - String text = w.toString(); - String marker = "at " + test.toString(); - - String[] lines = StringUtils.split(text, "\n"); - int lastLine = lines.length - 1; - int causedByLine = -1; - // skip first - for (int i = 1; i < lines.length; i++) { - String line = lines[i].trim(); - if (line.startsWith(marker)) { - lastLine = i; - } else if (line.startsWith("Caused by")) { - causedByLine = i; - break; - } - } - - StringBuffer trace = new StringBuffer(); - for (int i = 0; i <= lastLine; i++) { - trace.append(lines[i]); - trace.append("\n"); - } - - if (causedByLine != -1) { - for (int i = causedByLine; i < lines.length; i++) { - trace.append(lines[i]); - trace.append("\n"); - } - } - return trace.toString(); - } - - - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java deleted file mode 100644 index 97e8fd399b..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/ReportPrintStream.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.OutputStream; -import java.io.PrintStream; - -/** - * Print stream dispatching on a given one and storing written data - * in a output stream. - * @author Felix Project Team - */ -public class ReportPrintStream extends PrintStream { - - private PrintStream m_stream; - - private boolean m_duplicate; - - public ReportPrintStream(OutputStream out, PrintStream def, boolean hideOutput) { - super(out); - m_stream = def; - m_duplicate = ! hideOutput; - } - - public void println() { - if (m_duplicate) { m_stream.println(); } - super.println(); - } - - - public void println(boolean x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(char x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(char[] x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(double x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(float x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(int x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - - public void println(long x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(Object x) { - if (m_duplicate) { m_stream.println(x); } - super.println(x); - } - - - public void println(String s) { - if (m_duplicate) { m_stream.println(s); } - super.println(s); - } - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java deleted file mode 100644 index fa0a1f7bae..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/StringOutputStream.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.OutputStream; -import java.io.Serializable; - -/** - * Provides an OutputStream to an internal String. Internally converts bytes to - * a Strings and stores them in an internal StringBuffer. - * @author Felix Project Team - */ -public class StringOutputStream extends OutputStream implements Serializable { - - /** - * Id. - */ - private static final long serialVersionUID = -5912060965986156224L; - - /** - * The internal destination StringBuffer. - */ - protected StringBuffer m_buffer = null; - - /** - * Creates new StringOutputStream, makes a new internal StringBuffer. - */ - public StringOutputStream() { - super(); - m_buffer = new StringBuffer(); - } - - /** - * Returns the content of the internal StringBuffer as a String, the result - * of all writing to this OutputStream. - * - * @return returns the content of the internal StringBuffer - */ - public String toString() { - return m_buffer.toString(); - } - - /** - * Sets the internal StringBuffer to null. - */ - public void close() { - m_buffer = null; - - } - - /** - * Writes and appends a byte array to StringOutputStream. - * - * @param b the byte array - * @param off the byte array starting index - * @param len the number of bytes from byte array to write to the stream - */ - public void write(byte[] b, int off, int len) { - if ((off < 0) || (len < 0) || (off + len) > b.length) { - throw new IndexOutOfBoundsException( - "StringOutputStream.write: Parameters out of bounds."); - } - byte[] bytes = new byte[len]; - for (int i = 0; i < len; i++) { - bytes[i] = b[off]; - off++; - } - m_buffer.append(toCharArray(bytes)); - } - - /** - * Writes and appends a single byte to StringOutputStream. - * - * @param b the byte as an int to add - */ - public void write(int b) { - m_buffer.append((char) b); - } - - /** - * Writes and appends a String to StringOutputStream. - * - * @param s the String to add - */ - public void write(String s) { - m_buffer.append(s); - } - - /** - * Converts byte array to char array. - * @param barr input byte array - * @return the char array corresponding to the - * given byte array - */ - public static char[] toCharArray(byte[] barr) { - if (barr == null) { - return null; - } - char[] carr = new char[barr.length]; - for (int i = 0; i < barr.length; i++) { - carr[i] = (char) barr[i]; - } - return carr; - } -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java deleted file mode 100644 index 9e2632eb43..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/XMLReport.java +++ /dev/null @@ -1,359 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileOutputStream; -import java.io.OutputStreamWriter; -import java.io.PrintWriter; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; - -import junit.framework.Test; -import junit.framework.TestResult; - -import org.codehaus.plexus.util.IOUtil; -import org.codehaus.plexus.util.xml.PrettyPrintXMLWriter; -import org.codehaus.plexus.util.xml.Xpp3Dom; -import org.codehaus.plexus.util.xml.Xpp3DomWriter; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -/** - * This class generates test result as XML files compatible with Surefire. - * @author Felix Project Team - */ -public class XMLReport extends Report { - - /** - * List of results. - */ - private List m_results = new ArrayList(); - - /** - * A test ends successfully. - * @param test the test executed successfully. - */ - public void testSucceeded(Test test) { - super.testSucceeded(); - - long runTime = this.m_endTime - this.m_startTime; - - Xpp3Dom testCase = createTestElement(test, runTime); - - m_results.add(testCase); - } - - /** - * A test throws an unexpected errors. - * @param test the test in error - * @param e the thrown exception - * @param out the output messages printed during the test execution - * @param err the error messages printed during the test execution - * @param log the messages logged during the test execution - */ - public void testError(Test test, Throwable e, String out, String err, String log) { - super.testError(test); - - writeTestProblems(test, e, "error", out, err, log); - } - - /** - * A test fails. - * @param test the failing test - * @param e the thrown failure - * @param out the output messages printed during the test execution - * @param err the error messages printed during the test execution - * @param log the messages logged during the test execution - */ - public void testFailed(Test test, Throwable e, String out, String err, String log) { - super.testFailed(test); - - writeTestProblems(test, e, "failure", out, err, log); - } - - /** - * Utility method writing failed and in error test result in the report. - * @param test the test - * @param e the thrown error - * @param name type of failure ("error" or "failure") - * @param out the output messages printed during the test execution - * @param err the error messages printed during the test execution - * @param log the messages logged during the test execution - */ - private void writeTestProblems(Test test, Throwable e, String name, String out, String err, String log) { - - long runTime = m_endTime - m_startTime; - - Xpp3Dom testCase = createTestElement(test, runTime); - - Xpp3Dom element = createElement(testCase, name); - - String stackTrace = getStackTrace(test, e); - - Throwable t = e; - - if (t != null) { - - String message = t.getMessage(); - - if (message != null) { - element.setAttribute("message", message); - - element.setAttribute("type", - stackTrace.indexOf(":") > -1 ? stackTrace.substring(0, - stackTrace.indexOf(":")) : stackTrace); - } else { - element.setAttribute("type", new StringTokenizer(stackTrace) - .nextToken()); - } - } - - if (stackTrace != null) { - element.setValue(stackTrace); - } - - addOutputStreamElement(out, "system-out", testCase); - - addOutputStreamElement(err, "system-err", testCase); - - if (log != null) { - addOutputStreamElement(log, "log-service", testCase); - } - - m_results.add(testCase); - } - - /** - * Generates the XML reports. - * @param test the test - * @param tr the test result - * @param reportsDirectory the directory in which reports are created. - * @param bc the bundle context (to get installed bundles) - * @param configuration the Felix configuration - * @throws Exception when the XML report cannot be generated correctly - */ - public void generateReport(Test test, TestResult tr, File reportsDirectory, - BundleContext bc, Map configuration) throws Exception { - long runTime = this.m_endTime - this.m_startTime; - - Xpp3Dom testSuite = createTestSuiteElement(test, runTime); - - showProperties(testSuite, bc, configuration); - - testSuite.setAttribute("tests", String.valueOf(tr.runCount())); - - testSuite.setAttribute("errors", String.valueOf(tr.errorCount())); - - testSuite.setAttribute("failures", String.valueOf(tr.failureCount())); - - for (Iterator i = m_results.iterator(); i.hasNext();) { - Xpp3Dom testcase = (Xpp3Dom) i.next(); - testSuite.addChild(testcase); - } - - File reportFile = new File(reportsDirectory, "TEST-" - + getReportName(test).replace(' ', '_') + ".xml"); - - File reportDir = reportFile.getParentFile(); - - reportDir.mkdirs(); - - PrintWriter writer = null; - - try { - writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter( - new FileOutputStream(reportFile), "UTF-8"))); - - writer.write("" + NL); - - Xpp3DomWriter.write(new PrettyPrintXMLWriter(writer), testSuite); - } catch (UnsupportedEncodingException e) { - throw new Exception("Unable to use UTF-8 encoding", e); - } catch (FileNotFoundException e) { - throw new Exception("Unable to create file: " + e.getMessage(), e); - } finally { - IOUtil.close(writer); - } - } - - /** - * Creates a XML test case element. - * @param test the test - * @param runTime the elapsed time to execute the test. - * @return the XML element describing the given test. - */ - private Xpp3Dom createTestElement(Test test, long runTime) { - Xpp3Dom testCase = new Xpp3Dom("testcase"); - testCase.setAttribute("name", getReportName(test)); - double time = (double) runTime / (double) 1000; - testCase.setAttribute("time", Double.toString(time)); - testCase.setAttribute("classname", test.getClass().getName()); - return testCase; - } - - /** - * Creates a XML test suite element. - * @param test the test - * @param runTime the elapsed time to execute the test suite. - * @return the XML element describing the given test suite. - */ - private Xpp3Dom createTestSuiteElement(Test test, long runTime) { - Xpp3Dom testCase = new Xpp3Dom("testsuite"); - testCase.setAttribute("name", getReportName(test)); - testCase.setAttribute("time", Long.toString(runTime)); - return testCase; - } - - /** - * Computes report name. - * @param test the test - * @return the report name - */ - private static String getReportName(Test test) { - String report = test.toString(); - - if (report.indexOf("(") > 0) { - report = report.substring(0, report.indexOf("(")); - } - return report; - } - - /** - * Creates an XML element. - * @param element the parent element - * @param name the name of the element to create - * @return the resulting XML tree. - */ - private Xpp3Dom createElement(Xpp3Dom element, String name) { - Xpp3Dom component = new Xpp3Dom(name); - - element.addChild(component); - - return component; - } - - /** - * Adds system properties to the XML report. - * This method also adds installed bundles. - * @param testSuite the XML element. - * @param bc the bundle context - * @param configuration the configuration of the underlying OSGi platform - */ - private void showProperties(Xpp3Dom testSuite, BundleContext bc, Map configuration) { - Xpp3Dom properties = createElement(testSuite, "properties"); - - Properties systemProperties = System.getProperties(); - - if (systemProperties != null) { - Enumeration propertyKeys = systemProperties.propertyNames(); - - while (propertyKeys.hasMoreElements()) { - String key = (String) propertyKeys.nextElement(); - - String value = systemProperties.getProperty(key); - - if (value == null) { - value = "null"; - } - - Xpp3Dom property = createElement(properties, "property"); - - property.setAttribute("name", key); - - property.setAttribute("value", value); - - } - } - - if (configuration != null) { - Iterator it = configuration.keySet().iterator(); - - while (it.hasNext()) { - String key = (String) it.next(); - - Object obj = (Object) configuration.get(key); - String value = null; - if (obj == null) { - value = "null"; - } else if (obj instanceof String) { - value = (String) obj; - } else { - value = obj.toString(); - } - - Xpp3Dom property = createElement(properties, "property"); - - property.setAttribute("name", key); - - property.setAttribute("value", value); - - } - } - - Xpp3Dom bundle = createElement(properties, "property"); - Bundle[] bundles = bc.getBundles(); - for (int i = 0; i < bundles.length; i++) { - String sn = bundles[i].getSymbolicName(); - String state = "UNKNOWN"; - switch (bundles[i].getState()) { - case Bundle.ACTIVE: - state = "ACTIVE"; - break; - case Bundle.INSTALLED: - state = "INSTALLED"; - break; - case Bundle.RESOLVED: - state = "RESOLVED"; - break; - case Bundle.UNINSTALLED: - state = "UNINSTALLED"; - break; - default: - break; - } - bundle.setAttribute("name", "bundle-" + sn); - bundle.setAttribute("value", state); - } - - } - - /** - * Adds messages written during the test execution in the - * XML tree. - * @param stdOut the messages - * @param name the name of the stream (out, error, log) - * @param testCase the XML tree - */ - private void addOutputStreamElement(String stdOut, String name, - Xpp3Dom testCase) { - if (stdOut != null && stdOut.trim().length() > 0) { - createElement(testCase, name).setValue(stdOut); - } - } - -} diff --git a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java b/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java deleted file mode 100644 index bb795ac5bb..0000000000 --- a/ipojo/junit4osgi/maven-junit4osgi-plugin/src/main/java/org/apache/felix/ipojo/junit4osgi/plugin/log/LogServiceImpl.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * 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.ipojo.junit4osgi.plugin.log; - -import org.apache.felix.ipojo.junit4osgi.plugin.StringOutputStream; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.service.log.LogService; - -/** - * An implementation of the log service to collect logged messages. - * This service implementation is also {@link BundleActivator} and is - * activated when the embedded OSGi platform starts. - * @author Felix Project Team - */ -public class LogServiceImpl implements LogService, BundleActivator { - - /** - * Default output stream (not collected). - */ - private StringOutputStream m_defaultStream; - - /** - * Collected output stream. - */ - private StringOutputStream m_outputStream; - - /** - * Creates the log service object. - */ - public LogServiceImpl() { - m_defaultStream = new StringOutputStream(); - } - - /** - * Enables the log messages collection. - */ - public void enableOutputStream() { - m_outputStream = new StringOutputStream(); - } - - /** - * Get collected log messages. - * @return the String containing the logged messages. - */ - public String getLoggedMessages() { - return m_outputStream.toString(); - } - - /** - * Re-initializes the collected message list. - */ - public void reset() { - m_outputStream = null; - } - - /** - * Logs a message. - * @param arg0 the log level - * @param arg1 the message - * @see org.osgi.service.log.LogService#log(int, java.lang.String) - */ - public void log(int arg0, String arg1) { - write(computeLogMessage(arg0, arg1, null)); - } - - /** - * Logs a message with an attached exception. - * @param arg0 the log level - * @param arg1 the message - * @param arg2 the associated exception - * @see org.osgi.service.log.LogService#log(int, java.lang.String, java.lang.Throwable) - */ - public void log(int arg0, String arg1, Throwable arg2) { - write(computeLogMessage(arg0, arg1, arg2)); - } - - /** - * Logs a message raised by the given service reference. - * @param arg0 the service reference - * @param arg1 the log level - * @param arg2 the message - * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String) - */ - public void log(ServiceReference arg0, int arg1, String arg2) { - write(computeLogMessage(arg1, arg2, null)); - } - - /** - * Logs a message raised by the given service reference - * associated with an exception. - * @param arg0 the service reference - * @param arg1 the log level - * @param arg2 the message - * @param arg3 the exception - * @see org.osgi.service.log.LogService#log(org.osgi.framework.ServiceReference, int, java.lang.String) - */ - public void log(ServiceReference arg0, int arg1, String arg2, Throwable arg3) { - write(computeLogMessage(arg1, arg2, arg3)); - } - - /** - * Computes the string from the message. - * @param level the log level - * @param msg the message - * @param exception the exception (can be null - * @return the resulting String - */ - private String computeLogMessage(int level, String msg, Throwable exception) { - String message = null; - switch (level) { - case LogService.LOG_DEBUG: - message = "[DEBUG] " + msg; - break; - case LogService.LOG_ERROR: - message = "[ERROR] " + msg; - break; - case LogService.LOG_INFO: - message = "[INFO] " + msg; - break; - case LogService.LOG_WARNING: - message = "[WARNING] " + msg; - break; - default: - break; - } - - if (exception != null) { - message = message + " : " + exception.getMessage() + "\n"; - } - - return message; - } - - /** - * Writes the given message in the adequate output stream. - * @param log the message - */ - public void write(String log) { - if (m_outputStream != null) { - m_outputStream.write(log); - } else { - m_defaultStream.write(log); - } - } - - /** - * Stars the log service implementation: - * Registers the service. - * @param bc the bundle context. - * @throws Exception should not happen. - * @see org.osgi.framework.BundleActivator#start(org.osgi.framework.BundleContext) - */ - public void start(BundleContext bc) throws Exception { - bc.registerService(LogService.class.getName(), this, null); - } - - /** - * Stops the log service implementation. - * Does nothing. - * @param arg0 the bundle context - * @throws Exception should not happen. - * @see org.osgi.framework.BundleActivator#stop(org.osgi.framework.BundleContext) - */ - public void stop(BundleContext arg0) throws Exception { - // Nothing to do. - - } - -} diff --git a/ipojo/junit4osgi/pom.xml b/ipojo/junit4osgi/pom.xml deleted file mode 100644 index 72457e9499..0000000000 --- a/ipojo/junit4osgi/pom.xml +++ /dev/null @@ -1,59 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - Junit4OSGi - org.apache.felix - 1.1.0-SNAPSHOT - Apache Felix iPOJO Junit4OSGi - pom - - - junit4osgi - felix-command - maven-junit4osgi-plugin - immediate-launcher - - - - - java5 - - 1.5 - - - swing-runner - - - - java6 - - 1.6 - - - swing-runner - - - - diff --git a/ipojo/junit4osgi/swing-runner/LICENSE b/ipojo/junit4osgi/swing-runner/LICENSE deleted file mode 100644 index d645695673..0000000000 --- a/ipojo/junit4osgi/swing-runner/LICENSE +++ /dev/null @@ -1,202 +0,0 @@ - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - - APPENDIX: How to apply the Apache License to your work. - - To apply the Apache License to your work, attach the following - boilerplate notice, with the fields enclosed by brackets "[]" - replaced with your own identifying information. (Don't include - the brackets!) The text should be enclosed in the appropriate - comment syntax for the file format. We also recommend that a - file or class name and description of purpose be included on the - same "printed page" as the copyright notice for easier - identification within third-party archives. - - Copyright [yyyy] [name of copyright owner] - - Licensed 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. diff --git a/ipojo/junit4osgi/swing-runner/NOTICE b/ipojo/junit4osgi/swing-runner/NOTICE deleted file mode 100644 index 18acb796b7..0000000000 --- a/ipojo/junit4osgi/swing-runner/NOTICE +++ /dev/null @@ -1,27 +0,0 @@ -Apache Felix iPOJO junit4osgi Swing Runner -Copyright 2008-2009 The Apache Software Foundation - -I. Included Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -II. Used Software - -This product uses software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -This product uses software developed by -Junit project (http://junit.org) -Licensed under Common Public License 1.0. - -III. License Summary -- Apache License 2.0 -- Common Public License 1.0 diff --git a/ipojo/junit4osgi/swing-runner/doc/changelog.txt b/ipojo/junit4osgi/swing-runner/doc/changelog.txt deleted file mode 100644 index 524e88b133..0000000000 --- a/ipojo/junit4osgi/swing-runner/doc/changelog.txt +++ /dev/null @@ -1,3 +0,0 @@ -Version 1.0.0 -------------- - * Initial release \ No newline at end of file diff --git a/ipojo/junit4osgi/swing-runner/metadata.xml b/ipojo/junit4osgi/swing-runner/metadata.xml deleted file mode 100644 index 958bfc48b9..0000000000 --- a/ipojo/junit4osgi/swing-runner/metadata.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ipojo/junit4osgi/swing-runner/pom.xml b/ipojo/junit4osgi/swing-runner/pom.xml deleted file mode 100644 index 0716a0a6e9..0000000000 --- a/ipojo/junit4osgi/swing-runner/pom.xml +++ /dev/null @@ -1,104 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - - 4.0.0 - bundle - Junit4Osgi-Swing-GUI - org.apache.felix.ipojo.junit4osgi.swing-gui - 1.1.0-SNAPSHOT - - - ${project.groupId} - org.apache.felix.ipojo.junit4osgi - 1.1.0-SNAPSHOT - - - junit - junit - 3.8.1 - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.apache.felix - maven-bundle-plugin - 2.3.5 - true - - - Apache Felix iPOJO OSGi Junit Runner - Swing Gui - ${project.artifactId} - org.apache.felix.ipojo.junit4osgi.command - - org.osgi.framework;version=1.3,* - - <_plugin>org.apache.felix.ipojo.bnd.PojoizationPlugin;metadata=${basedir}/metadata.xml;use-local-schemas=true - - - - - org.apache.felix - bnd-ipojo-plugin - 1.0.0-SNAPSHOT - - - - - org.codehaus.mojo - rat-maven-plugin - - false - true - true - - doc/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - - - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - error - - - - - diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java deleted file mode 100644 index 3370f1a1ff..0000000000 --- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultCellRenderer.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.ipojo.junit4osgi.command; - -import java.awt.Color; -import java.awt.Component; - -import javax.swing.JTable; -import javax.swing.table.DefaultTableCellRenderer; - -/** - * Test result renderer. - * @author Felix Project Team - */ -public class ResultCellRenderer extends DefaultTableCellRenderer { - - /** - * UUID. - */ - private static final long serialVersionUID = 1L; - - /** - * Renderer method. - * @param table the table - * @param value the value - * @param isSelected is the cell selected - * @param hasFocus has the cell the focus - * @param row the cell row - * @param column the cell column - * @return the resulting component - * @see javax.swing.table.DefaultTableCellRenderer#getTableCellRendererComponent(javax.swing.JTable, java.lang.Object, boolean, boolean, int, int) - */ - public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { - Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column); - - ResultTableModel results = (ResultTableModel) table.getModel(); - String status = (String) results.getValueAt(row, column); - if (status.equals(ResultTableModel.SUCCESS)) { - c.setForeground(Color.GREEN); - setToolTipText(results.getMessage(row, column)); - } - if (status.equals(ResultTableModel.FAILURE)) { - c.setForeground(Color.ORANGE); - setToolTipText(results.getMessage(row, column)); - } - if (status.equals(ResultTableModel.ERROR)) { - c.setForeground(Color.RED); - setToolTipText(results.getMessage(row, column)); - } - - return c; - } -} diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java deleted file mode 100644 index bf457ba383..0000000000 --- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/ResultTableModel.java +++ /dev/null @@ -1,278 +0,0 @@ -/* - * 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.ipojo.junit4osgi.command; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.table.AbstractTableModel; - -import junit.framework.AssertionFailedError; -import junit.framework.Test; - -/** - * Result Table Model. - * Store the results of executed tests. - * @author Felix Project Team - */ -public class ResultTableModel extends AbstractTableModel { - - /** - * Success String. - */ - public static final String SUCCESS = "success"; - - /** - * Failure String. - */ - public static final String FAILURE = "failure"; - - /** - * Error String. - */ - public static final String ERROR = "error"; - - /** - * UUDI. - */ - private static final long serialVersionUID = 1L; - - /** - * List of results. - */ - private List m_results = new ArrayList(); - - public int getRowCount() { - return m_results.size(); - } - - public int getColumnCount() { - return 2; - } - - /** - * Adds a failing test. - * @param t the test - * @param e the assertion error - */ - public void addTest(Test t, AssertionFailedError e) { - TestRecord rec = new TestRecord(t, e); - m_results.add(rec); - fireTableDataChanged(); - } - - /** - * Adds a test in error. - * @param t the test - * @param e the thrown error - */ - public void addTest(Test t, Throwable e) { - TestRecord rec = new TestRecord(t, e); - m_results.add(rec); - fireTableDataChanged(); - } - - /** - * Adds a sucessfull test. - * @param t the test - */ - public void addTest(Test t) { - if (!contains(t)) { - TestRecord rec = new TestRecord(t); - m_results.add(rec); - fireTableDataChanged(); - } - } - - public int getTestCount() { - return m_results.size(); - } - - /** - * Gets the number of success. - * @return the number of success - */ - public int getSucess() { - int count = 0; - for (TestRecord test : m_results) { - if (test.m_wasSucessFull) { - count++; - } - } - return count; - } - - /** - * Gets the number of errors. - * @return the number of errors - */ - public int getErrors() { - int count = 0; - for (TestRecord test : m_results) { - if (test.m_error != null) { - count++; - } - } - return count; - } - - /** - * Gets the number of failures. - * @return the number of failures - */ - public int getFailures() { - int count = 0; - for (TestRecord test : m_results) { - if (test.m_failure != null) { - count++; - } - } - return count; - } - - - /** - * Does the result list contains the given test. - * @param t the test - * @return true if the list contains the test. - */ - private boolean contains(Test t) { - for (TestRecord test : m_results) { - if (test.m_test.equals(t)) { return true; } - } - return false; - } - - /** - * Clear the list. - */ - public void clear() { - m_results.clear(); - fireTableDataChanged(); - } - - /** - * Get the Object placed in the JTable. - * @param rowIndex the row - * @param columnIndex the column - * @return the object - * @see javax.swing.table.TableModel#getValueAt(int, int) - */ - public Object getValueAt(int rowIndex, int columnIndex) { - if (columnIndex == 0) { return m_results.get(rowIndex).m_test; } - if (columnIndex == 1) { - TestRecord tr = m_results.get(rowIndex); - if (tr.m_wasSucessFull) { return SUCCESS; } - if (tr.m_failure != null) { return FAILURE; } - if (tr.m_error != null) { return ERROR; } - } - return null; - } - - /** - * Gets column names. - * @param column the column - * @return the column name - * @see javax.swing.table.AbstractTableModel#getColumnName(int) - */ - public String getColumnName(int column) { - if (column == 0) { return "Test"; } - - if (column == 1) { return "Status"; } - - return null; - } - - /** - * Gets the message. - * @param row the row - * @param column the column - * @return the message for this cell - */ - public String getMessage(int row, int column) { - if (row == -1) { return null; } - TestRecord rec = m_results.get(row); - if (rec.m_wasSucessFull) { return "The test " + rec.m_test + " was executed sucessfully."; } - if (rec.m_failure != null) { return "The test " + rec.m_test + " has failed : \n" + rec.m_failure.getMessage(); } - if (rec.m_error != null) { - String message = "The test " + rec.m_test + " has thrown an error : \n" + rec.m_error.getMessage(); - StringWriter sw = new StringWriter(); - rec.m_error.printStackTrace(new PrintWriter(sw)); - message += "\n" + sw.toString(); - return message; - } - return ""; - } - - private class TestRecord { - /** - * Was the test successful? - */ - private boolean m_wasSucessFull; - - /** - * The test. - */ - private Test m_test; - - /** - * The failure. - */ - private AssertionFailedError m_failure; - - /** - * The error. - */ - private Throwable m_error; - - /** - * Creates a TestRecord. - * @param t the test - * @param e the failure - */ - public TestRecord(Test t, AssertionFailedError e) { - m_test = t; - m_wasSucessFull = false; - m_failure = e; - } - - /** - * Creates a TestRecord. - * @param t the test - * @param e the error - */ - public TestRecord(Test t, Throwable e) { - m_test = t; - m_wasSucessFull = false; - m_error = e; - } - - /** - * Creates a TestRecord. - * @param t the test - */ - public TestRecord(Test t) { - m_test = t; - m_wasSucessFull = true; - } - } - -} diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form deleted file mode 100644 index d7fc05038d..0000000000 --- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.form +++ /dev/null @@ -1,317 +0,0 @@ - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java deleted file mode 100644 index ed5133debb..0000000000 --- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/SwingRunner.java +++ /dev/null @@ -1,543 +0,0 @@ -package org.apache.felix.ipojo.junit4osgi.command; -/* - * 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. - */ - - -import junit.framework.AssertionFailedError; -import junit.framework.Test; -import junit.framework.TestResult; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.junit4osgi.OSGiJunitRunner; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleEvent; -import org.osgi.framework.BundleListener; - -import javax.swing.*; -import javax.swing.table.TableColumn; -import java.awt.*; -import java.util.ArrayList; -import java.util.List; - -/** - * Swing Runner for Junit4Osgi. - * - * @author Felix Project Team - */ -public class SwingRunner extends javax.swing.JFrame implements BundleListener { - - /** - * UUID. - */ - private static final long serialVersionUID = 1L; - - /** - * Bundle context (to register the bundle listener). - */ - private BundleContext m_context; - - /** - * OSGi Junit Runner Service. - */ - private OSGiJunitRunner m_runner; - - /** - * State variable describing if we are executing tests. - */ - private boolean m_running = false; - - - // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.JButton btnSearch; - private javax.swing.JButton m_allButton; - private javax.swing.JButton m_executeButton; - private javax.swing.JLabel m_executedResults; - private javax.swing.JScrollPane m_message; - private javax.swing.JTextArea m_messageArea; - private javax.swing.JButton m_ok; - private javax.swing.JProgressBar m_progress; - private javax.swing.JDialog m_resultDialog; - private javax.swing.JScrollPane m_resultScroll; - private javax.swing.JTable m_resultTable; - private javax.swing.JPanel m_statusBar; - private javax.swing.JList m_suiteList; - private javax.swing.JScrollPane m_suiteScroll; - private javax.swing.JTextField txtSearchTest; - // End of variables declaration//GEN-END:variables - - - public SwingRunner(BundleContext bc) { - m_running = false; - m_context = bc; - } - - - private void internalInitComponents() { - initComponents(); - } - - - - /** - * Start method. - */ - public void start() { - internalInitComponents(); - setVisible(true); - m_resultDialog.setVisible(false); - refreshSuites(); - m_context.addBundleListener(this); - m_executedResults.setText(" \t No executed tests"); - m_progress.setIndeterminate(false); - m_progress.setMaximum(100); - m_progress.setValue(100); - - TableColumn column = null; - for (int i = 0; i < m_resultTable.getColumnCount(); i++) { - column = m_resultTable.getColumnModel().getColumn(i); - if (i == 0) { - column.setPreferredWidth(350); // first column is bigger - } else { - column.setPreferredWidth(50); - column.setCellRenderer(new ResultCellRenderer()); - } - } - } - - - - /** - * Stop method. - */ - public void stop() { - m_context.removeBundleListener(this); - dispose(); - } - - - /** - * Refresh the list of available test suites. - */ - @SuppressWarnings("unchecked") - private void refreshSuites() { - - String textToSearch = txtSearchTest.getText(); - List tests = m_runner.getTests(); - - TestListModel lm = (TestListModel) m_suiteList.getModel(); - lm.clear(); - - for (Test test : tests) { - String testName = test.toString(); - if (textToSearch != null && !textToSearch.trim().equals("")) { - if (testName.toLowerCase().indexOf(textToSearch.toLowerCase()) != -1) { - - lm.addTest(test); - } - } else { - // found all - lm.addTest(test); - - } - } - - //getInstanceManager().onExit(this, "refreshSuites", null); - } - - /** - * This method is called from within the constructor to - * initialize the form. - * WARNING: Do NOT modify this code. The content of this method is - * always regenerated by the Form Editor. - */ - // //GEN-BEGIN:initComponents - private void initComponents() { - - m_resultDialog = new javax.swing.JDialog(); - m_message = new javax.swing.JScrollPane(); - m_messageArea = new javax.swing.JTextArea(); - m_ok = new javax.swing.JButton(); - m_statusBar = new javax.swing.JPanel(); - m_progress = new javax.swing.JProgressBar(); - m_executeButton = new javax.swing.JButton(); - m_allButton = new javax.swing.JButton(); - m_suiteScroll = new javax.swing.JScrollPane(); - m_suiteList = new javax.swing.JList(); - m_resultScroll = new javax.swing.JScrollPane(); - m_resultTable = new javax.swing.JTable(); - m_executedResults = new javax.swing.JLabel(); - txtSearchTest = new javax.swing.JTextField(); - btnSearch = new javax.swing.JButton(); - - m_resultDialog.setDefaultCloseOperation(javax.swing.WindowConstants.DO_NOTHING_ON_CLOSE); - m_resultDialog.setMinimumSize(new java.awt.Dimension(1024, 600)); - m_resultDialog.addWindowListener(new java.awt.event.WindowAdapter() { - public void windowClosed(java.awt.event.WindowEvent evt) { - onDialogClosed(evt); - } - - public void windowClosing(java.awt.event.WindowEvent evt) { - onDialogClosed(evt); - } - }); - - m_message.setBorder(null); - m_message.setMinimumSize(new java.awt.Dimension(300, 202)); - m_message.setPreferredSize(new java.awt.Dimension(300, 202)); - - m_messageArea.setBackground(javax.swing.UIManager.getDefaults().getColor("Panel.background")); - m_messageArea.setColumns(20); - m_messageArea.setEditable(false); - m_messageArea.setLineWrap(true); - m_messageArea.setRows(5); - m_messageArea.setWrapStyleWord(true); - m_messageArea.setMinimumSize(new java.awt.Dimension(300, 250)); - m_messageArea.setPreferredSize(new java.awt.Dimension(250, 200)); - m_message.setViewportView(m_messageArea); - - m_resultDialog.getContentPane().add(m_message, java.awt.BorderLayout.CENTER); - - m_ok.setText("Ok"); - m_ok.setPreferredSize(new java.awt.Dimension(120, 23)); - m_ok.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - okActionPerformed(evt); - } - }); - m_resultDialog.getContentPane().add(m_ok, java.awt.BorderLayout.SOUTH); - - setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE); - setTitle("Junit Runner"); - setMinimumSize(null); - - m_progress.setIndeterminate(true); - m_progress.setMinimumSize(null); - m_progress.setPreferredSize(null); - - javax.swing.GroupLayout m_statusBarLayout = new javax.swing.GroupLayout(m_statusBar); - m_statusBar.setLayout(m_statusBarLayout); - m_statusBarLayout.setHorizontalGroup( - m_statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(m_progress, javax.swing.GroupLayout.DEFAULT_SIZE, 466, Short.MAX_VALUE) - ); - m_statusBarLayout.setVerticalGroup( - m_statusBarLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(m_statusBarLayout.createSequentialGroup() - .addComponent(m_progress, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - ); - - m_executeButton.setText("Execute"); - m_executeButton.setMaximumSize(new java.awt.Dimension(90, 23)); - m_executeButton.setMinimumSize(new java.awt.Dimension(90, 23)); - m_executeButton.setPreferredSize(new java.awt.Dimension(100, 23)); - m_executeButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - executeButtonActionPerformed(evt); - } - }); - - m_allButton.setText("Select All"); - m_allButton.setMaximumSize(new java.awt.Dimension(90, 23)); - m_allButton.setMinimumSize(new java.awt.Dimension(90, 23)); - m_allButton.setPreferredSize(new java.awt.Dimension(100, 23)); - m_allButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - allButtonActionPerformed(evt); - } - }); - - m_suiteScroll.setAutoscrolls(true); - - m_suiteList.setModel(new TestListModel()); - m_suiteList.setMaximumSize(null); - m_suiteList.setMinimumSize(null); - m_suiteList.setPreferredSize(null); - m_suiteScroll.setViewportView(m_suiteList); - - m_resultScroll.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS); - - m_resultTable.setAutoCreateRowSorter(true); - m_resultTable.setFont(new java.awt.Font("Tahoma", 0, 10)); // NOI18N - m_resultTable.setModel(new ResultTableModel()); - m_resultTable.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_ALL_COLUMNS); - m_resultTable.setMaximumSize(null); - m_resultTable.setMinimumSize(null); - m_resultTable.setPreferredSize(null); - m_resultTable.addMouseListener(new java.awt.event.MouseAdapter() { - public void mouseClicked(java.awt.event.MouseEvent evt) { - resultTableMouseClicked(evt); - } - }); - m_resultScroll.setViewportView(m_resultTable); - - m_executedResults.setText("aaaaaaaaaaaaaaa"); - m_executedResults.setPreferredSize(null); - - btnSearch.setText("Search"); - btnSearch.setMaximumSize(new java.awt.Dimension(90, 23)); - btnSearch.setMinimumSize(new java.awt.Dimension(90, 23)); - btnSearch.setPreferredSize(new java.awt.Dimension(100, 23)); - btnSearch.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - btnSearchActionPerformed(evt); - } - }); - - javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane()); - getContentPane().setLayout(layout); - layout.setHorizontalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(m_resultScroll, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 598, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addComponent(m_statusBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(m_executedResults, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(txtSearchTest, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(m_suiteScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 492, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(m_executeButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(m_allButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(btnSearch, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(txtSearchTest, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(btnSearch, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addComponent(m_allButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(m_executeButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(m_suiteScroll, javax.swing.GroupLayout.DEFAULT_SIZE, 152, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(m_resultScroll, javax.swing.GroupLayout.PREFERRED_SIZE, 415, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(m_executedResults, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(m_statusBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) - ); - - pack(); - }// //GEN-END:initComponents - - - /** - * Execute button action. - * - * @param evt : event. - */ - private void executeButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_executeButtonActionPerformed - if (m_running) { - return; - } - // Collect selected test. - int[] indices = m_suiteList.getSelectedIndices(); - List list = new ArrayList(indices.length); - TestListModel model = (TestListModel) m_suiteList.getModel(); - for (int i = 0; i < indices.length; i++) { - list.add(model.getTestElementAt(indices[i])); - } - setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR)); - executeTest(list); - }//GEN-LAST:event_m_executeButtonActionPerformed - - /** - * All button action. - * - * @param evt : event. - */ - private void allButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_allButtonActionPerformed - int max = m_suiteList.getModel().getSize(); - int[] indices = new int[max]; - for (int i = 0; i < max; i++) { - indices[i] = i; - } - m_suiteList.setSelectedIndices(indices); - }//GEN-LAST:event_m_allButtonActionPerformed - - /** - * Listener on table click. - * - * @param evt : event. - */ - private void resultTableMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_m_resultTableMouseClicked - Point p = evt.getPoint(); - int row = m_resultTable.rowAtPoint(p); - int col = m_resultTable.columnAtPoint(p); - ResultTableModel model = (ResultTableModel) m_resultTable.getModel(); - String message = model.getMessage(row, col); - if (message != null) { - setEnabled(false); - m_resultDialog.setTitle("Test Report"); - m_messageArea.setText(message); - m_resultDialog.setVisible(true); - } - }//GEN-LAST:event_m_resultTableMouseClicked - - /** - * Ok button action. - * - * @param evt : event. - */ - private void okActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_m_okActionPerformed - m_resultDialog.setVisible(false); - setEnabled(true); - }//GEN-LAST:event_m_okActionPerformed - - /** - * Listener when the test report is closed. - * - * @param evt : event. - */ - private void onDialogClosed(java.awt.event.WindowEvent evt) { - m_resultDialog.setVisible(false); - setEnabled(true); - } - - - private void btnSearchActionPerformed(java.awt.event.ActionEvent evt) { - refreshSuites(); - - } - - /** - * Execute method. - * - * @param list : list of test to execute. - */ - private void executeTest(final List list) { - Runnable thread = new Runnable() { - public void run() { - ResultTableModel model = (ResultTableModel) m_resultTable.getModel(); - m_running = true; - m_executeButton.setText("Running..."); - m_progress.setIndeterminate(true); - model.clear(); - for (int i = 0; i < list.size(); i++) { - TestResult tr = new TestResult(); - tr.addListener(new MyTestListener()); - list.get(i).run(tr); - } - m_running = false; - m_progress.setIndeterminate(false); - m_progress.setMaximum(100); - m_progress.setValue(100); - m_executeButton.setText("Execute"); - computeExecutedTest(); - setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR)); - } - - }; - new Thread(thread).start(); - } - - /** - * Compute executed tests. - * (Status bar message) - */ - private void computeExecutedTest() { - ResultTableModel results = (ResultTableModel) m_resultTable.getModel(); - String m = " \t "; - m += results.getTestCount() + " tests executed / "; - m += results.getSucess() + " success / "; - m += results.getFailures() + " failures / "; - m += results.getErrors() + " errors "; - m_executedResults.setText(m); - } - - private class MyTestListener implements junit.framework.TestListener { - /** - * Table model. - */ - ResultTableModel m_model = (ResultTableModel) m_resultTable.getModel(); - - /** - * Add an error. - * - * @param arg0 : test which throws an error. - * @param arg1 : thrown exception. - * @see junit.framework.TestListener#addError(junit.framework.Test, Throwable) - */ - public void addError(Test arg0, Throwable arg1) { - m_model.addTest(arg0, arg1); - adjustScroll(); - } - - /** - * Add a failure. - * - * @param arg0 : failing test. - * @param arg1 : thrown failure. - * @see junit.framework.TestListener#addError(junit.framework.Test, Throwable) - */ - public void addFailure(Test arg0, AssertionFailedError arg1) { - m_model.addTest(arg0, arg1); - adjustScroll(); - } - - /** - * End of a test. - * - * @param arg0 : test. - * @see junit.framework.TestListener#endTest(junit.framework.Test) - */ - public void endTest(Test arg0) { - m_model.addTest(arg0); - adjustScroll(); - } - - /** - * Start of a test. - * - * @param arg0 : test. - * @see junit.framework.TestListener#startTest(junit.framework.Test) - */ - public void startTest(Test arg0) { - // Nothing to do here. - } - - /** - * Adjust the scrolling bar of the result table. - */ - private void adjustScroll() { - JScrollBar bar = m_resultScroll.getVerticalScrollBar(); - if ((bar != null) && (bar.isVisible())) { - bar.setValue(Integer.MAX_VALUE); - } - } - - } - - - public void bundleChanged(BundleEvent bundleevent) { - refreshSuites(); - - } - -} \ No newline at end of file diff --git a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java b/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java deleted file mode 100644 index 3232dade1c..0000000000 --- a/ipojo/junit4osgi/swing-runner/src/main/java/org/apache/felix/ipojo/junit4osgi/command/TestListModel.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.ipojo.junit4osgi.command; - -import java.util.ArrayList; -import java.util.List; -import javax.swing.AbstractListModel; -import junit.framework.Test; - -/** - * Test Suite list model. - * @author Felix Project Team - */ -public class TestListModel extends AbstractListModel { - - /** - * Id. - */ - private static final long serialVersionUID = 1L; - - /** - * List of {@link TestRecord}. - */ - private List m_list = new ArrayList(); - - /** - * Gets the element placed at the given index. - * @param index the index - * @return the element placed at the given index - * or null if no element at this index - * @see javax.swing.ListModel#getElementAt(int) - */ - public Object getElementAt(int index) { - if (index >= m_list.size()) { - return null; - } else { - return m_list.get(index).m_name; - } - } - - /** - * Gets the test object placed at the given index. - * @param index the index - * @return the test object placed at the given index - */ - public Test getTestElementAt(int index) { - return m_list.get(index).m_test; - } - - /** - * Adds a test. - * @param test the test to add - */ - public void addTest(Test test) { - synchronized (this) { - TestRecord tr = new TestRecord(); - tr.m_test = test; - tr.m_name = test.toString(); - m_list.add(tr); - } - fireContentsChanged(this, m_list.size() - 1, m_list.size() - 1); - } - - /** - * Removes a test. - * @param test the test to remove - */ - public void removeTest(Test test) { - int index = 1; - synchronized (this) { - for (TestRecord t : m_list) { - if (t.m_test.equals(test)) { - index = m_list.indexOf(t); - m_list.remove(t); - return; - } - } - } - - if (index != -1) { - fireContentsChanged(this, index, index); - } - } - - /** - * Clears the list. - */ - public void clear() { - m_list.clear(); - } - - private class TestRecord { - /** - * The test. - */ - public Test m_test; - - /** - * The test name. - */ - public String m_name; - } - - /** - * Gets the list size. - * @return the list size. - * @see javax.swing.ListModel#getSize() - */ - public int getSize() { - return m_list.size(); - } - -} diff --git a/ipojo/manipulator/annotations/changelog.txt b/ipojo/manipulator/annotations/changelog.txt deleted file mode 100644 index fec2deaa24..0000000000 --- a/ipojo/manipulator/annotations/changelog.txt +++ /dev/null @@ -1,225 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from 1.8.6 to 1.10.0 ----------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3843] - ClassCastException when listing service properties of a non-ComponentFactory Factory service - * [FELIX-3895] - iPOJO instance is not shown (with the "arch" commands) if constructor is failing - * [FELIX-3896] - Null reference are injected with @Bind(optional=false) method on iPOJO components - * [FELIX-3918] - iPOJO Logger cannot be dynamically configured on Equinox and KF - * [FELIX-3919] - iPOJO Proxies strategy cannot be configured dynamically on Equinox and KF - * [FELIX-3920] - Creation Strategy does not work on KF3 - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4041] - Properties starting with . should not be propagated - * [FELIX-4048] - @Requires handler does not fail when no specification can be found - * [FELIX-4053] - Avoid @StaticServiceProperty to be used on classes - * [FELIX-4054] - Use current factory version to generate instance name if required - -** Improvement - * [FELIX-3860] - factories and instances iPOJO gogo commands should show the "public=false" instances/factories - * [FELIX-3932] - Allow dependency filter's to get context-source variables - * [FELIX-4040] - Implement config admin support to handle binding location properly - * [FELIX-4045] - Chain Exceptions when possible - -** New Feature - * [FELIX-4034] - Instance configuration DSL - -** Task - * [FELIX-3892] - Upgrade runtime codebase to Java 5 - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3948] - Define a new extender model - * [FELIX-3978] - Check that we don't use java 6+ API - -** Wish - * [FELIX-3926] - Provide metadata for the Extender namespace - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3742] - Implementing class fails to load unless super interface's (interface extended by implemented interface) package is imported. - * [FELIX-3789] - Deadlock due to synchronization on INSTANCE_NAME - * [FELIX-3819] - The export directive of iPOJO is wrong - -Changes from the 1.8.2 to 1.8.4 --------------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3500] - InstanceManager concurrency issue: "A methodID cannot be associated with a method from the POJO class" - * [FELIX-3501] - IPojo FactoryStateListener doesn't get notified while stopping factory - * [FELIX-3545] - Memory leak when unregistering a component used by an aggregate dependency with an unbind callback - * [FELIX-3548] - Concurrent access during startup - * [FELIX-3567] - iPOJO Configuration Handler should not reuse the dictionary object from the configuration admin - * [FELIX-3576] - iPOJO fails when using constructor injection and expecting BundleContext in ctor - * [FELIX-3599] - Problem with 'subservice action="instantiate"' in ipojo composite - * [FELIX-3621] - Two dimensional array as argument to a method in a component - * [FELIX-3672] - Potential Concurrent Modification Exception when a bundle is stopped - -** Improvement - * [FELIX-3560] - Extensions to IPojo's Factory and ComponentInstance documentation for custom handlers - -Changes from the 1.8.0 to 1.8.2 -------------------------------- -** Improvement - * [FELIX-3380] - minor javadoc corrections in @Temporal annotation - -Changes from the 1.6.4 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2568] - Rename Transactionnal to Transactional - -** Improvement - * [FELIX-1428] - Constructor injection of Configuration properties - * [FELIX-2620] - Change iPojo annotation parameters to follow java naming conventions - * [FELIX-2621] - Rename annotations to remove collisions - * [FELIX-2622] - Support static service properties that are not mirrored into fields - * [FELIX-2624] - Support multiple whiteboards using annotations - * [FELIX-2630] - Rename @Component attributes to follow the java naming conventions - * [FELIX-2631] - Rename @Publisher and @Subscriber attributes to follow the java naming conventions - * [FELIX-2633] - Rename JMX annotations - * [FELIX-2634] - Rename the @Publisher annotation into @Publishes annotation to avoid collision - * [FELIX-2666] - Rename the temporal handler annotation to avoid collision - * [FELIX-2742] - Constructor injection of service dependencies - -Changes from the 1.6.2 to 1.6.4 -------------------------------- -** Improvement - * [FELIX-2420] - Enum support for @Property annotation - * [FELIX-2461] - Allow specifying the targeted service interface in the @ServiceController - -Changes from the 1.6.0 to 1.6.2 -------------------------------- -** Improvement - * [FELIX-2296] - Access to ServiceReference in iPOJO service. - -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Bug - * [FELIX-1557] - Cosmetic change of the Bundle-Name and Bundle-SymbolicName in iPOJO annotations. - -** Improvement - * [FELIX-1426] - Service injection with Dynamic Proxies - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - -** New Feature - * [FELIX-2132] - Provides a way to control service exposition from the implementation class - -** Wish - * [FELIX-1940] - Add @Instance annotation to declare instances without metadata.xml - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1319] - Issue in the metadata overriding analysis in iPOJO annotations - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-825] - Provide annotation for iPojo JMX Handler - * [FELIX-834] - Provide Annotations for the extender, whiteboard and event admin handlers - -** Bug - * [FELIX-867] - iPOJO @ServiceProperty can target method - * [FELIX-868] - iPOJO @Component don't support factory methods - - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * [FELIX-627] - Temporal dependency annotation - - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/manipulator/annotations/pom.xml b/ipojo/manipulator/annotations/pom.xml deleted file mode 100644 index 895618e757..0000000000 --- a/ipojo/manipulator/annotations/pom.xml +++ /dev/null @@ -1,57 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - org.apache.felix.ipojo.annotations - 1.13.1-SNAPSHOT - Apache Felix iPOJO Annotations - - - iPOJO Annotation pack. contained annotations are used to define iPOJO component type. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/how-to-use-ipojo-annotations.html - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - - diff --git a/ipojo/manipulator/annotations/src/main/appended-resources/NOTICE b/ipojo/manipulator/annotations/src/main/appended-resources/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java deleted file mode 100644 index 51042e9092..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Bind.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; -import java.util.Comparator; - -/** - * This annotation declares a bind method. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Bind { - - /** - * Set the dependency filter. - * Default : no filter - */ - String filter() default ""; - - /** - * Set if the dependency is an aggregate dependency. - * Default : false - */ - boolean aggregate() default false; - - /** - * Set if the dependency is optional. - * Default : false - */ - boolean optional() default false; - - /** - * Set the required specification. - * Default : no specification, will be deduced. - */ - Class specification() default Object.class; - - /** - * Set the dependency id. - * Default : empty - */ - String id() default ""; - - /** - * Set the binding policy. - * Acceptable policies are dynamic, static and dynamic-priority. - * Default: dynamic. - */ - BindingPolicy policy() default BindingPolicy.DYNAMIC; - - /** - * Set the comparator. - * The indicated class must implement {@link Comparator} - */ - Class comparator() default Comparator.class; - - /** - * Set the from attribute. - */ - String from() default ""; - - /** - * Set to true if the service dependency is injected - * as a proxy. - * Default: true - */ - boolean proxy() default true; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java deleted file mode 100644 index 6b8670118c..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/BindingPolicy.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.annotations; - -/** -* Binding policies supported by iPOJO. -*/ -public enum BindingPolicy { - DYNAMIC, - STATIC, - DYNAMIC_PRIORITY; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java deleted file mode 100644 index a38245dfa8..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Component.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Declares a component type (needed to create instances of the component). - * This annotation is mandatory to declares an iPOJO component. - * - * Its usual to find it on top of class definition: - *
- *     {@code @Component}
- *     public class MyComponent {
- *         // ...
- *     }
- * 
- * - * But, it is also possible to have it associated to a - * {@linkplain org.apache.felix.ipojo.annotations.Stereotype stereotyped} annotation definition: - *
- *     {@code @Component}
- *     {@linkplain org.apache.felix.ipojo.annotations.Instantiate @Instantiate}
- *     {@linkplain org.apache.felix.ipojo.annotations.Stereotype @Stereotype}
- *     public @interface AutoInstantiatedComponent {
- *         // ...
- *     }
- * 
- * - *

See also

- * - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Component { - - /** - * Set if the component type is public. - * @see #publicFactory() - * @deprecated renamed to publicFactory. - */ - boolean public_factory() default true; - - /** - * Set if the component type is public or private (defaults to public). - * A private factory does not expose a {@code Factory} service. - * Only instances declared in the same bundle are created. - *
-     *     {@code @Component(publicFactory = false)}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- * Default: {@literal true} - */ - boolean publicFactory() default true; - - /** - * Set the component type name. - *
-     *     {@code @Component(name = "my-component")}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- * Default : implementation class name. - */ - String name() default ""; - - /** - * Enable / Disable the architecture exposition (no {@code Architecture} - * service will be exposed for component's instances). - *
-     *     {@code @Component(architecture = false)}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- * Default : {@literal true} - */ - boolean architecture() default true; - - /** - * Set if the component is immediate. - * By default, iPOJO tries to be as lazy as possible and will create the POJO instance at the last possible time. - * Notice this setting is only effective when the component provides a service ({@linkplain org.apache.felix.ipojo.annotations.Provides @Provides}). - *
-     *     {@code @Component(immediate = true)}
-     *     {@linkplain org.apache.felix.ipojo.annotations.Provides @Provides}
-     *     public class MyComponent implements MyService {
-     *         // ...
-     *     }
-     * 
- * Default : {@literal false} - */ - boolean immediate() default false; - - /** - * Enable or disable the configuration propagation to service properties. - *
-     *     {@code @Component(propagation = false)}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- * default: {@literal true} - */ - boolean propagation() default true; - - /** - * Set the Managed Service PID for Configuration Admin. - * default no PID (i.e. the managed service will not be exposed). - *
-     *     {@code @Component(managedservice = "my.Pid")}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- */ - String managedservice() default ""; - - /** - * Set the factory-method, if the pojo has to be created - * from a static method. The specified method must be a static - * method and return a pojo object. - * By default, iPOJO uses the 'regular' constructor. - * @see #factoryMethod() - * @deprecated now is called factoryMethod. - */ - String factory_method() default ""; - - /** - * Set the factory-method, if the pojo has to be created - * from a static method. The specified method must be a static - * method and return a pojo object. - * By default, iPOJO uses the 'regular' constructor. - *
-     *     {@code @Component(factoryMethod = "createInstance")}
-     *     public class MyComponent {
-     *         // ...
-     *         public static MyComponent createInstance() {
-     *             return new MyComponent("some static configuration");
-     *         }
-     *     }
-     * 
- */ - String factoryMethod() default ""; - - /** - * Set the version of the component type. - *
-     *     {@code @Component(version = "1.3")}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- */ - String version() default ""; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java deleted file mode 100644 index 383583de16..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Context.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * Injects the bundle context object. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE, ElementType.PARAMETER, ElementType.FIELD}) -public @interface Context { - - /** - * Sets which bundle context object needs to be injected. - */ - public Source value() default Source.COMPONENT; - - /** - * Lists the different injectable bundle context. - */ - public enum Source { - /** - * The bundle context from the bundle declaring the component. Generally, - * it's the bundle containing the implementation class. - */ - COMPONENT, - - /** - * The bundle context from the bundle declaring the instance. - */ - INSTANCE - } - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java deleted file mode 100644 index babcf013fe..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Controller.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a lifecycle controller. - * - *
- *     {@code @Component}
- *     public class MyComponent {
- *         // ...
- *         {@code @Controller}
- *         private boolean controller;
- *
- *         public void aMethod() {
- *             // Invalidate the instance
- *             controller = false;
- *         }
- *
- *         public void anotherMethod() {
- *             // Validate the instance again
- *             controller = true;
- *         }
- *     }
- * 
- - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface Controller { - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java deleted file mode 100644 index b3fa77774d..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Handler.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a handler. - * This annotation is mandatory to declares an iPOJO handler. - *
- *     {@code @Handler}(
- *         name = "my-handler",
- *         namespace = "com.acme.foo"
- *     )
- *     public class MyHandler extends PrimitiveHandler {
- *         // ...
- *     }
- * 
- - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Handler { - - /** - * Name of the handler (required). - */ - String name(); - - /** - * Namespace of the handler (required). - */ - String namespace(); - - /** - * Start-level of the handler. - * Default: 1. - */ - int level() default 1; - - /** - * Enable / Disable the architecture exposition. - * Default : {@literal false} - */ - boolean architecture() default false; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java deleted file mode 100644 index f18f4c4ca1..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerBinding.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A @{@link HandlerBinding} bind its annotated type to a given handler. - * - * The handler name is specified as parameter using the {@literal 'namespace:name'} format (qualified name). - * - *
- *     // Namespace and name will be inferred from the annotation's package name.
- *     @HandlerBinding()
- *     public @interface Foo {}
- *
- *     // No namespace declared, default will be used ('org.apache.felix.ipojo')
- *     @HandlerBinding("foo")
- *     public @interface Foo {}
- *
- *     // Namespace will be 'com.acme' and name: 'foo'
- *     @HandlerBinding("com.acme:foo")
- *     public @interface Foo {}
- *
- *     // Provided namespace and value (for the name) will be used
- *     @HandlerBinding(namespace = "com.acme", value = "foo")
- *     public @interface Foo {}
- * 
- * - * @author Felix Project Team - */ -@Target(ElementType.ANNOTATION_TYPE) -@Retention(RetentionPolicy.CLASS) -public @interface HandlerBinding { - String DEFAULT = "#"; - - /** - * Defines the handler's namespace. Must be used in correlation with the {@literal value} attribute. - *
-     *     @HandlerBinding(namespace = "com.acme", value = "foo")
-     *     public @interface Foo {}
-     * 
- */ - String namespace() default DEFAULT; - - /** - * When used without the {@literal namespace} attribute, defines both the namespace + name - * of a handler in a short notation (if no namespace can be found in the parameter - no ':' separator - fallback - * on iPOJO's default namespace): - * - *
-     *     @HandlerBinding("com.acme:foo")
-     *     public @interface Foo {}
-     * 
- * - * When used with the {@literal namespace} attribute, holds the name of the handler (without - * its namespace part): - * - *
-     *     @HandlerBinding(namesapce = "com.acme", value = "foo")
-     *     public @interface Foo {}
-     * 
- */ - String value() default DEFAULT; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java deleted file mode 100644 index 1191d47704..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/HandlerDeclaration.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation is used to configure a handler through XML (as in {@literal metadata.xml}). - *
- *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
- *     {@code @HandlerDeclaration("")}
- *     public class MyComponent {
- *         // ...
- *     }
- * 
- * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface HandlerDeclaration { - - /** - * The content of this attribute represents the XML - * that would be used in the metadata.xml. - * It must be a root XML Element, namespaces are allowed and so for child elements. - */ - String value(); -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java deleted file mode 100644 index ceb4171770..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Ignore.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A @{@link Ignore} annotation mark its annotated type to be ignored by the iPOJO manipulator. - * This is handy when the annotation could be recognized as a "custom annotation handler" (contains {@literal ".ipojo."} - * or {@literal ".handler."} in its package name) but in fact is not a handler annotation at all. - * - *
- *     package com.acme.ipojo.handler;
- *     @Ignore
- *     public @interface Foo {}
- * 
- * - * @author Felix Project Team - */ -@Target(ElementType.ANNOTATION_TYPE) -@Retention(RetentionPolicy.CLASS) -public @interface Ignore {} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java deleted file mode 100644 index 87d9201519..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Instantiate.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation is used to create an 'empty' instance of the - * current component type. - * - * Notice that all mandatory properties should have a default value, otherwise - * configuration is declared unacceptable and the instance creation fails. - * - *
- *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
- *     {@code @Instantiate}
- *     public class MyComponent {
- *         // ...
- *     }
- * 
- * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Instantiate { - - /** - * Optional attribute to set the instance name. - * Default: unique generated name - *
-     *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
-     *     {@code @Instantiate("my-default-component")}
-     *     public class MyComponent {
-     *         // ...
-     *     }
-     * 
- */ - String name() default ""; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java deleted file mode 100644 index 0dfac8c84f..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Invalidate.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares an invalidate callback. - * - *
- *     {@code @Invalidate}
- *     public void stop() {
- *         // Code executed when instances are becoming invalid
- *     }
- * 
- * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Invalidate { - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java deleted file mode 100644 index ea8bd5a7dd..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Modified.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; -import java.util.Comparator; - -/** - * This annotation declares a modify method. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Modified { - - /** - * Set the dependency filter. - * Default : no filter - */ - String filter() default ""; - - /** - * Set if the dependency is an aggregate dependency. - * Default : false - */ - boolean aggregate() default false; - - - /** - * Set if the dependency is optional. - * Default : false - */ - boolean optional() default false; - - /** - * Set the required specification. - * Default : empty (try to discover). - */ - String specification() default ""; - - /** - * Set the dependency id. - * Default : empty. - */ - String id() default ""; - - /** - * Set the binding policy. - * Acceptable policies are dynamic, static and dynamic-priority. - * Default: dynamic. - */ - BindingPolicy policy() default BindingPolicy.DYNAMIC; - - /** - * Set the comparator. - * The indicated class must implement {@link Comparator} - */ - Class comparator() default Comparator.class; - - /** - * Set the from attribute. - */ - String from() default ""; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java deleted file mode 100644 index 0319439cff..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostRegistration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - - -/** - * Declares a method to be notified after service registration is effective. - * - *
- *     {@code @PostRegistration}
- *     public void registered(ServiceReference reference) {
- *         // Called after the service publication
- *     }
- * 
- * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Provides - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface PostRegistration { - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java deleted file mode 100644 index 50f70408c6..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/PostUnregistration.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - - -/** - * Declares a method to be notified after service un-registration is effective. - * - *
- *     {@code @PostUnregistration}
- *     public void unregistered(ServiceReference reference) {
- *         // Called after the service un-publication
- *     }
- * 
- * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Provides - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface PostUnregistration { - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java deleted file mode 100644 index 9af34cb7f8..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Property.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a component property. - * It can target both fields and methods. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) -public @interface Property { - - /** - * Set property name. - * Default : empty - */ - String name() default ""; - - /** - * Set property value. - * Default : empty - */ - String value() default ""; - - /** - * Is the property mandatory? - * Default: false - */ - boolean mandatory() default false; - - /** - * Is the property immutable? - * Default: false - */ - boolean immutable() default false; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java deleted file mode 100644 index d0f06eef8d..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Provides.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares that the component instances will provide a service. - * - *
- *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
- *     {@code @Provides}
- *     public class MyComponent implements Service {
- *         // ...
- *     }
- * 
- * @author Felix Project Team -*/ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Provides { - - /** - * Set the provided specifications. - * It can be used to force the exposed service to use an implementation class - * (not an interface) as specification. - * Default : all implemented interfaces - * - *
-     *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
-     *     {@code @Provides(specifications = AbsComponent.class)}
-     *     public class MyComponent extends AbsComponent {
-     *         // ...
-     *     }
-     * 
- */ - Class[] specifications() default { }; - - /** - * Set the service object creation strategy. - * Multiple values are possible: {@literal SINGLETON}, {@literal SERVICE}, - * {@literal METHOD}, {@literal INSTANCE} or the strategy fully qualified class name: - *
    - *
  • {@literal SINGLETON}: Default strategy
  • - *
  • {@literal SERVICE}: OSGi Service Factory style, 1 POJO instance per consumer bundle
  • - *
  • {@literal METHOD}: Delegates the creation to the factory-method of the component, method will be called every time the service reference is get.
  • - *
  • {@literal INSTANCE}: Creates one service object per requiring instance
  • - *
  • Any other value is interpreted as the qualified name of a {@code CreationStrategy} implementation
  • - *
- */ - String strategy() default "SINGLETON"; - - /** - * Allows adding static properties to the service. - * Nested properties are static service properties, so must contain the name, - * value and type as they are not attached to a field (cannot discover type through - * introspection). - * The array contains {@link StaticServiceProperty} elements. - * Default : No service properties - - *
-     *     {@linkplain org.apache.felix.ipojo.annotations.Component @Component}
-     *     {@code @Provides}(
-     *         properties = {
-     *             {@code @StaticServiceProperty}(name = "size", type = "int", value = "5"),
-     *             {@code @StaticServiceProperty}(name = "name", type = "java.lang.String", value = "OSGi")
-     *         }
-     *     )
-     *     public class MyComponent implements Service {
-     *         // ...
-     *     }
-     * 
- - */ - StaticServiceProperty[] properties() default {}; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java deleted file mode 100644 index 254016d187..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Requires.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Inherited; -import java.lang.annotation.Target; -import java.util.Comparator; - -/** - * This annotation declares a service requirement. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.PARAMETER, ElementType.ANNOTATION_TYPE}) -@Inherited -public @interface Requires { - - /** - * Set the LDAP filter of the dependency. - * Default : no filter - */ - String filter() default ""; - - /** - * Set if the dependency is optional. - * Default : false - */ - boolean optional() default false; - - /** - * Set the dependency id. - * Default : empty - */ - String id() default ""; - - /** - * Enable / Disable nullable pattern. - * Default : true - */ - boolean nullable() default true; - - /** - * Set the default-implementation to use if the dependency is optional, - * and no providers are available. - * The class must implement the required service interface. - * Default : no default-implementation - */ - Class defaultimplementation() default Class.class; - - /** - * Set the exception to throw when the service is not available. This attribute can only be used for optional - * dependencies. It must be a subclass of {@link RuntimeException}. - * Default: no exception. - */ - Class exception() default RuntimeException.class; - - /** - * Set the binding policy. - * Acceptable policy are dynamic, static and dynamic-priority. - * Default: dynamic. - */ - BindingPolicy policy() default BindingPolicy.DYNAMIC; - - /** - * Set the comparator. - * The indicated class must implement {@link Comparator} - */ - Class comparator() default Comparator.class; - - /** - * Set the from attribute. - */ - String from() default ""; - - /** - * Set the required service specification. - * This attribute is required for Collection field. - */ - Class specification() default Object.class; - - /** - * Set to true if the service dependency is injected - * as a proxy. - * Default: true - */ - boolean proxy() default true; - - - /** - * Set the time to wait before applying the 'no service available' action. - * This attribute is only valid for optional dependencies. - * The time is set in milliseconds. - * Default: no timeout - */ - int timeout() default -1; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java deleted file mode 100644 index 61e539e402..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceController.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a service controller. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface ServiceController { - - /** - * Sets the initial value of the controller. - */ - boolean value() default true; - - - /** - * Sets the targeted specification. - * If not set, target all specifications. - */ - Class specification() default Object.class; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java deleted file mode 100644 index 5ce5f394e6..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/ServiceProperty.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a service property. - * It can target both fields and methods. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface ServiceProperty { - - /** - * Set the property name. - * Default : empty - */ - String name() default ""; - - /** - * Set the property value. - * Default : empty - */ - String value() default ""; - - /** - * Is the property mandatory? - * Default: false - */ - boolean mandatory() default false; - - /** - * Is the service property immutable ? - * An immutable property MUST have a value - * Default {@literal false} - */ - boolean immutable() default false; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java deleted file mode 100644 index 969725d8c8..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/StaticServiceProperty.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.annotations; - - -import java.lang.annotation.Target; - -/** - * This annotation declares a static service property. - * @author Felix Project Team - */ -@Target({}) -public @interface StaticServiceProperty { - - /** - * Set the property name. - * This name is mandatory for static properties. - */ - String name(); - - /** - * Set the property value. - * Default : empty - */ - String value() default ""; - - /** - * Is the property mandatory? - * Default: false - */ - boolean mandatory() default false; - - /** - * Set the type. - * This value is required only for static properties. - */ - String type(); - - /** - * Is the property immutable ? - * An immutable property MUST have a value - * Default: {@literal false} - */ - boolean immutable() default false; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java deleted file mode 100644 index efb8369388..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Stereotype.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * In many systems, use of architectural patterns produces a set of recurring roles. A stereotype allows a - * framework developer to identify such a role and declare some common metadata for objects with that role - * in a central place. - * - * A stereotype is an annotation, annotated with {@literal @Stereotype}, that captures several other annotations. - * - * For example, the following stereotype defines a @PseudoSingletonComponent annotation, that will act, - * when applied on a component, just like if @Component and @Instantiate where directly applied on the target component. - *
- *
- *     @Component
- *     @Instantiate
- *     @Stereotype
- *     @Target(TYPE)
- *     @Retention(CLASS)
- *     public @interface PseudoSingletonComponent {}
- *
- * 
- * - * Usage: - *
- *
- *     @PseudoSingletonComponent
- *     public class HelloWorldComponent {
- *       // ...
- *     }
- *
- * 
- * - * Equivalent to: - *
- *
- *     @Component
- *     @Instantiate
- *     public class HelloWorldComponent {
- *       // ...
- *     }
- *
- * 
- * - * @author Felix Project Team - */ -@Target(ElementType.ANNOTATION_TYPE) -@Retention(RetentionPolicy.CLASS) -public @interface Stereotype { -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java deleted file mode 100644 index ae716204c3..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Unbind.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; -import java.util.Comparator; - -/** - * This annotation declares an unbind method. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Unbind { - - /** - * Set the dependency filter. - * Default : no filter - */ - String filter() default ""; - - /** - * Set if the dependency is an aggregate dependency. - * Default : false - */ - boolean aggregate() default false; - - - /** - * Set if the dependency is optional. - * Default : false - */ - boolean optional() default false; - - /** - * Set the required specification. - * Default : empty (try to discover). - */ - Class specification() default Object.class; - - /** - * Set the dependency id. - * Default : empty. - */ - String id() default ""; - - /** - * Set the binding policy. - * Acceptable policy are dynamic, static and dynamic-priority. - * Default: dynamic. - */ - BindingPolicy policy() default BindingPolicy.DYNAMIC; - - /** - * Set the comparator. - * The indicated class must implement {@link Comparator} - */ - Class comparator() default Comparator.class; - - /** - * Set the from attribute. - */ - String from() default ""; - - /** - * Set to true if the service dependency is injected - * as a proxy. - * Default: true - */ - boolean proxy() default true; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java deleted file mode 100644 index 5fa92709c9..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Updated.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares an updated callback. - * Updated callback are called after a reconfiguration. - * - * Methods annotated with {@code @Updated} must have one of the 2 following signatures: - *
- *     {@code @Updated}
- *     public void updated() {
- *         // The instance was reconfigured
- *     }
- * 
- * - *
- *     {@code @Updated}
- *     public void updated(Dictionary conf) {
- *         // The instance was reconfigured, conf is the new configuration.
- *     }
- * 
- * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Updated { - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java deleted file mode 100644 index 3a6517e9d2..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/annotations/Validate.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.annotations; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * This annotation declares a validate callback. - * - *
- *     {@code @Validate}
- *     public void start() {
- *         // Code executed when instances are becoming valid
- *     }
- * 
- * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Validate { - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java deleted file mode 100644 index 587710abe4..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/extender/Extender.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.extender; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Extender pattern Handler annotation. - * Allows configuring an extender pattern. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Extender { - - /** - * Sets the looked Manifest entry. - */ - String extension(); - - /** - * Sets the on service arrival callback. - */ - String onArrival(); - - /** - * Sets the on service departure callback. - */ - String onDeparture(); - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java deleted file mode 100644 index 3e9e03a5c9..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Requires.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Temporal dependency annotation. - * Allows specifying a temporal dependency. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - * @deprecated replaced by {@link Temporal} - */ -@Target(ElementType.FIELD) -@Deprecated -public @interface Requires { - - /** - * Set the LDAP filter of the dependency. - * Default : no filter - */ - String filter() default ""; - - /** - * Timeout of the dependency. - * Default : true - */ - long timeout() default 3000; - - /** - * Set the on timeout action. - * Supports null, nullable, empty, and default-implementation. - * In this latter case, you must specify the qualified class name - * of the default-implementation (instead of default-implementation). - * Default: no action (i.e throws a runtime exception) - */ - String onTimeout() default ""; - - /** - * Set the service specification (for Collection fields). - * This attribute is mandatory for Collections. - */ - String specification() default ""; - - /** - * Inject a proxy instead of the real object. - * This allows passing this reference to collaborators. - * Default: false - */ - boolean proxy() default false; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java deleted file mode 100644 index 52496a5ab1..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handler/temporal/Temporal.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.handler.temporal; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Temporal dependency annotation. - * Allows specifying a temporal dependency. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface Temporal { - - /** - * Set the dependency id. - * Default: empty, will use the field name. - */ - String id() default ""; - - /** - * Set the LDAP filter of the dependency. - * Default: no filter - */ - String filter() default ""; - - /** - * Timeout of the dependency. - * Default: 3000 ms. - */ - long timeout() default 3000; - - /** - * Set the on timeout action. - * Supports null, nullable, empty, and default-implementation. - * In this latter case, you must specify the qualified class name - * of the default-implementation (instead of default-implementation). - * Default: no action (i.e throws a runtime exception) - */ - String onTimeout() default ""; - - /** - * Set the service specification (for Collection fields). - * This attribute is mandatory for Collections. - */ - String specification() default ""; - - /** - * Inject a proxy instead of the real object. - * This allows passing this reference to collaborators. - * Default: false - */ - boolean proxy() default false; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java deleted file mode 100644 index 466d6f059f..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publisher.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.ipojo.handlers.event; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - - -/** - * Event Admin Publisher handler. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - * @deprecated replaced by Publishes - */ -@Target(ElementType.FIELD) -public @interface Publisher { - - /** - * Sets the publisher name. - */ - String name(); - - /** - * Sets topics on which event are sent. - * The topics are separated by a ',' such as in - * "foo, bar". - * Default : no topics (configured in the instance configuration) - */ - String topics() default ""; - - /** - * Enables/Disables synchronous sending. - * Default : false (asynchronous) - */ - boolean synchronous() default false; - - /** - * Sets the data key in which the data is - * put. - * Default : user.data - * @deprecated replaced by dataKey - */ - String data_key() default "user.data"; - - /** - * Sets the data key in which the data is - * put. - * Default : user.data - */ - String dataKey() default "user.data"; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java deleted file mode 100644 index eea2f80fd6..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Publishes.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.handlers.event; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - - -/** - * Event Admin Publisher handler. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface Publishes { - - /** - * Sets the publisher name. - */ - String name(); - - /** - * Sets topics on which event are sent. - * The topics are separated by a ',' such as in - * "foo, bar". - * Default : no topics (configured in the instance configuration) - */ - String topics() default ""; - - /** - * Enables/Disables synchronous sending. - * Default : false (asynchronous) - */ - boolean synchronous() default false; - - /** - * Sets the data key in which the data is - * put. - * Default : user.data - */ - String dataKey() default "user.data"; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java deleted file mode 100644 index 2418944b48..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/event/Subscriber.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.handlers.event; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - - -/** - * Event Admin Subscriber handler. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Subscriber { - - /** - * Sets the subscriber name. - */ - String name(); - - /** - * Sets topics on which event are received. - * The topics are separated by a ',' such as in - * "foo, bar". - * Default : no topics (configured in the instance configuration) - */ - String topics() default ""; - - /** - * Sets the data key in which the data is - * stored. - * Default : no key - * @deprecated replaced by dataKey - */ - String data_key() default ""; - - /** - * Sets the data type (type of the received data). - * Default : no type. - * @deprecated replaced by dataType - */ - String data_type() default ""; - - /** - * Sets the data key in which the data is - * stored. - * Default : no key - */ - String dataKey() default ""; - - /** - * Sets the data type (type of the received data). - * Default : no type. - */ - String dataType() default ""; - - - /** - * Sets the event filter. Only event matching with the - * specified LDAP filter are received. - * default : no filter; - */ - String filter() default ""; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java deleted file mode 100644 index 9a0d5e9be6..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Config.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Handler annotation. - * Allows exposing the instances as a JMX MBean. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - * @deprecated replaced by {@link JMXBean} - */ -@Target(ElementType.TYPE) -public @interface Config { - - /** - * Enables or Disables MOSGi usage. - * If MOSGi is used, MBeans are exposed with the MOSGi mechanism. - * Otherwise the MBean Platform Server is used. - * Default : false - */ - boolean usesMOSGi() default false; - - /** - * Sets the MBean object name. - * Default : 'package-name:factory-name:instance-name'. - */ - String objectname() default ""; - - /** - * Sets the MBean domain. - * Default : 'package-name' - */ - String domain() default ""; - - /** - * Sets the MBean name. - * Default : 'instance-name' - */ - String name() default ""; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java deleted file mode 100644 index b07abfb478..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXBean.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Handler annotation. - * Allows exposing the instances as a JMX MBean. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface JMXBean { - - /** - * Enables or Disables MOSGi usage. - * If MOSGi is used, MBeans are exposed with the MOSGi mechanism. - * Otherwise the MBean Platform Server is used. - * Default : false - */ - boolean usesMOSGi() default false; - - /** - * Sets the MBean object name. - * Default : 'package-name:factory-name:instance-name'. - */ - String objectname() default ""; - - /** - * Sets the MBean domain. - * Default : 'package-name' - */ - String domain() default ""; - - /** - * Sets the MBean name. - * Default : 'instance-name' - */ - String name() default ""; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java deleted file mode 100644 index 3f957fe4f1..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXMethod.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Method annotation. - * Allows exposing methods in the MBean. - * This annotation must be used only if the {@link Config} annotation - * is used. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface JMXMethod { - - /** - * Gets the method description. - * Default : no description - */ - String description() default ""; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java deleted file mode 100644 index 069878db25..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/JMXProperty.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Property annotation. - * Allows exposing properties in the MBean. - * This annotation must be used only if the {@link Config} annotation - * is used. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.FIELD, ElementType.ANNOTATION_TYPE}) -public @interface JMXProperty { - - /** - * Sets the property name. - */ - String name(); - - /** - * Sets the access permission. - * Possible values are 'r' (default) or 'w'. - * 'w' implies read and write access. - */ - String rights() default "r"; - - /** - * Enables notification on the current property. - * Notifications are disable by default. - */ - boolean notification() default false; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java deleted file mode 100644 index 4fb0cd1902..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Method.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Method annotation. - * Allows exposing methods in the MBean. - * This annotation must be used only if the {@link Config} annotation - * is used. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - * @deprecated replaced by {@link JMXMethod} - */ -@Target(ElementType.METHOD) -public @interface Method { - - /** - * Gets the method description. - * Default : no description - */ - String description() default ""; - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java deleted file mode 100644 index 6de9e83310..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/handlers/jmx/Property.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.handlers.jmx; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * JMX Property annotation. - * Allows exposing properties in the MBean. - * This annotation must be used only if the {@link Config} annotation - * is used. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - * @deprecated replaced by {@link JMXProperty} - */ -@Target(ElementType.FIELD) -public @interface Property { - - /** - * Sets the property name. - */ - String name(); - - /** - * Sets the access permission. - * Possible values are 'r' (default) or 'w'. - * 'w' implies read and write access. - */ - String rights() default "r"; - - /** - * Enables notification on the current property. - * Notifications are disable by default. - */ - boolean notification() default false; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java deleted file mode 100644 index 98603234a6..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transaction.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.transaction; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Transaction Handler annotation. - * Allows the declaration of transactionnal methods - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Transaction { - - /** - * Sets the Transaction field. The specified field must be of the type - * Transaction. - */ - String field() default ""; - - /** - * Sets the method called when a transaction is committed. - */ - String oncommit() default ""; - - /** - * Sets the method called when a transaction is rolled back. - */ - String onrollback() default ""; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java deleted file mode 100644 index f89133d958..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/transaction/Transactional.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.transaction; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Transactionnal Method annotation. - * Allows the declaration of transactionnal method. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.METHOD, ElementType.ANNOTATION_TYPE}) -public @interface Transactional { - - /** - * Sets the transaction timeout. - */ - long timeout() default 0;; - - /** - * Sets the transaction propagation policy. - * Supported values are : requires mandatory, notsupported, never, requiresnew. - */ - String propagation() default "requires"; - - /** - * Sets the exceptions that do not rollback the current transaction. - */ - String[] norollbackfor() default { }; - - /** - * Sets if the transaction rollback throws an exception. - */ - boolean exceptiononrollback() default false; - - -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java deleted file mode 100644 index 4c66f5e0db..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Wbp.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.whiteboard; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Whiteboard pattern Handler annotation. - * Allows configuring a whiteboard pattern. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Wbp { - - /** - * Sets the whiteboard pattern filter. - */ - String filter(); - - /** - * Sets the on service arrival callback. - */ - String onArrival(); - - /** - * Sets the on service departure callback. - */ - String onDeparture(); - - /** - * Sets the on service modification callback. - * Default : no callback. - */ - String onModification() default ""; -} diff --git a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java b/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java deleted file mode 100644 index 995bd1cba3..0000000000 --- a/ipojo/manipulator/annotations/src/main/java/org/apache/felix/ipojo/whiteboard/Whiteboards.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.whiteboard; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -/** - * Whiteboard pattern Handler annotation. - * Allows configuring several whiteboard patterns. - * Be aware that despite is it provided in the annotations jar, - * it refers to an external handler. - * @author Felix Project Team - */ -@Target({ElementType.TYPE, ElementType.ANNOTATION_TYPE}) -public @interface Whiteboards { - - /** - * Whiteboards list. - */ - Wbp[] whiteboards() default {}; -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt b/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt deleted file mode 100644 index aed77eee2c..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/changelog.txt +++ /dev/null @@ -1,152 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST - * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account. - * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata - * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames - * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable - * [FELIX-3574] - IPojo bytecode manipulation looses method argument names - * [FELIX-3621] - Two dimensional array as argument to a method in a component - -Changes from the 1.8.2 to 1.8.4 -------------------------------- - -** Bug - * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException - * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7 - * [FELIX-3389] - Bnd iPOJO Plugin ignores annotated components - * [FELIX-3391] - Unexpected warning when using bnd-ipojo-plugin - -Changes in the 1.8.2 --------------------- - -** Bug - * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files - * [FELIX-3012] - "Duplicate name&signature" problem - * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter - * [FELIX-3145] - VerifyError on Java 7 - * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest - -** Improvement - * [FELIX-3017] - The manipulator should return the original class if it's already manipulated - * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator - * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities - * [FELIX-3080] - Implement a BND plugin for iPOJO - * [FELIX-3131] - Elements and attributes should conserve the insertion order - * [FELIX-3204] - @Temporal should handle instantiation-time properties - * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible \ No newline at end of file diff --git a/ipojo/manipulator/bnd-ipojo-plugin/pom.xml b/ipojo/manipulator/bnd-ipojo-plugin/pom.xml deleted file mode 100644 index 784803ffad..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/pom.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - 4.0.0 - - org.apache.felix - felix-parent - 8 - - - bnd-ipojo-plugin - 1.13.1-SNAPSHOT - Apache Felix iPOJO Bnd Plugin - - - - biz.aQute.bnd - bndlib - 2.1.0 - provided - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - org.apache.felix - org.apache.felix.ipojo.annotations - - - org.mockito - mockito-all - 1.8.5 - test - - - junit - junit - 4.13.2 - test - - - - - - - org.apache.felix - ipojo-manipulator-bom - ${project.version} - pom - import - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.MF - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 0c8ef3954b..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed by Peter Kriens -(http://www.aqute.biz/Code/Bnd) -Copyright 2006-2011 aQute, All rights reserved -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 8b13789179..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java deleted file mode 100644 index f555b21ee7..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndJarResourceStore.java +++ /dev/null @@ -1,243 +0,0 @@ -/* - * 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.ipojo.bnd; - -import static java.lang.String.format; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.jar.Attributes; -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.render.MetadataRenderer; -import org.apache.felix.ipojo.manipulator.util.Constants; -import org.apache.felix.ipojo.manipulator.util.Metadatas; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.metadata.Element; - -import aQute.bnd.header.Attrs; -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Clazz; -import aQute.bnd.osgi.Jar; -import aQute.bnd.osgi.Resource; -import aQute.service.reporter.Reporter; - -public class BndJarResourceStore implements ResourceStore { - - private Analyzer m_analyzer; - private Reporter m_reporter; - - private MetadataRenderer m_renderer = new MetadataRenderer(); - - private List m_metadata; - private boolean m_includeEmbedComponents; - - public BndJarResourceStore(Analyzer analyzer, Reporter reporter) { - m_metadata = new ArrayList(); - m_analyzer = analyzer; - m_reporter = reporter; - } - - public byte[] read(String path) throws IOException { - - // Find the resource either in the global jar or in one of the embed dependencies - Resource resource = m_analyzer.getJar().getResource(path); - if (resource == null) { - Jar embed = findJar(path); - if (embed == null) { - throw new IOException(format("Cannot find resource %s in jar and classpath", path)); - } - resource = embed.getResource(path); - } - InputStream is = null; - try { - is = resource.openInputStream(); - } catch (Exception e) { - throw new IOException("Cannot read " + path); - } - return Streams.readBytes(is); - } - - public void accept(ResourceVisitor visitor) { - - try { - // Collect all annotated classes - Collection classes = m_analyzer.getClasses("", - Clazz.QUERY.CLASSANNOTATIONS.name()); - - classes = filter(classes); - - // Iterates over discovered resources - for (Clazz clazz : classes) { - visitor.visit(clazz.getAbsolutePath()); - } - } catch (Exception e) { - m_reporter.error("Cannot find iPOJO annotated types: " + e.getMessage()); - } - } - - private Collection filter(Collection classes) throws Exception { - Set manipulable = new HashSet(); - for (Clazz clazz : classes) { - - // If it is in the main jar, simply use it - if (m_analyzer.getJar().getResource(clazz.getAbsolutePath()) != null) { - manipulable.add(clazz); - continue; - } - - if (m_includeEmbedComponents) { - // Otherwise ... - // Try to see if it is in an embed dependencies - Jar jar = findJar(clazz.getAbsolutePath()); - if (jar == null) { - m_reporter.error("Resource for class %s not found in classpath", clazz.getFQN()); - continue; - } - - // Is it a Bundle ? - if (jar.getBsn() != null) { - // OSGi Bundle case - - // Check if the bundle was manipulated before - Attributes attr = jar.getManifest().getMainAttributes(); - if (Manifests.getComponents(attr) != null) { - // Bundle has been previously manipulated - // TODO We should ignore the resource since it was already manipulated - // TODO But we should also merge its IPOJO-Components header - } else { - // Bundle was not manipulated - manipulable.add(clazz); - } - - } else { - // Simple Jar file with iPOJO annotations - m_reporter.warning("Class %s found in a non-Bundle archive %s", clazz.getFQN(), jar.getName()); - continue; - } - } else { - m_reporter.warning("Embed components are excluded, Component %s will not be manipulated", clazz.getFQN()); - } - } - return manipulable; - } - - private Jar findJar(String path) { - for (Jar jar : m_analyzer.getClasspath()) { - if (jar.getResource(path) != null) { - return jar; - } - } - return null; - } - - public void open() throws IOException { - // nothing to do - } - - public void writeMetadata(Element metadata) { - m_metadata.add(metadata); - - // Find referred packages and add them into Bnd - for (String referred : Metadatas.findReferredPackages(metadata)) { - if (!m_analyzer.getReferred().containsFQN(referred)) { - // The given package is not referred ATM - m_analyzer.getReferred().put(m_analyzer.getPackageRef(referred), - new Attrs()); - } - } - - // IPOJO-Components will be written during the close method. - } - - public void write(String resourcePath, byte[] resource) throws IOException { - Jar jar = m_analyzer.getJar(); - jar.putResource(resourcePath, new ByteArrayResource(resource)); - } - - public void close() throws IOException { - - // Write the iPOJO header (including manipulation metadata) - StringBuilder builder = new StringBuilder(); - - if (m_includeEmbedComponents) { - // Incorporate metadata of embed dependencies (if any) - for (Jar jar : m_analyzer.getClasspath()) { - try { - Manifest manifest = jar.getManifest(); - Attributes main = manifest.getMainAttributes(); - String components = Manifests.getComponents(main); - if (components != null) { - m_reporter.trace("Merging components from %s", jar.getName()); - builder.append(components); - } - } catch (Exception e) { - m_reporter.warning("Cannot open MANIFEST of %s", jar.getName()); - } - } - } - - for (Element metadata : m_metadata) { - builder.append(m_renderer.render(metadata)); - } - - if (builder.length() != 0) { - m_analyzer.setProperty("IPOJO-Components", builder.toString()); - } - - // Add some mandatory imported packages - Attrs version = new Attrs(); - version.put("version:Version", Constants.getPackageImportClause()); - - if (!m_analyzer.getReferred().containsFQN("org.apache.felix.ipojo")) { - m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.apache.felix.ipojo"), - version); - } - if (!m_analyzer.getReferred().containsFQN("org.apache.felix.ipojo.architecture")) { - m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.apache.felix.ipojo.architecture"), - version); - } - if (!m_analyzer.getReferred().containsFQN("org.osgi.service.cm")) { - Attrs cm = new Attrs(); - cm.put("version:Version", "1.2"); - m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.osgi.service.cm"), - cm); - } - if (!m_analyzer.getReferred().containsFQN("org.osgi.service.log")) { - Attrs log = new Attrs(); - log.put("version:Version", "1.3"); - m_analyzer.getReferred().put(m_analyzer.getPackageRef("org.osgi.service.log"), - log); - } - - - } - - public void setIncludeEmbedComponents(boolean excludeEmbedComponents) { - m_includeEmbedComponents = excludeEmbedComponents; - } -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java deleted file mode 100644 index 085d63aaeb..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/BndReporter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.bnd; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.reporter.EmptyReporter; - -import aQute.service.reporter.Reporter; - -/** - * A {@code BndReporter} knows how to wrap a Bnd Reporter into an iPOJO Reporter. - * - * @author Felix Project Team - */ -public class BndReporter extends EmptyReporter { - - /** - * Bnd reporter. - */ - private Reporter m_reporter; - - /** - * Errors which occur during the manipulation. - */ - private List m_errors = new ArrayList(); - - /** - * Warnings which occur during the manipulation. - */ - private List m_warnings = new ArrayList(); - - public BndReporter(Reporter reporter) { - m_reporter = reporter; - } - - public List getErrors() { - return m_errors; - } - - public List getWarnings() { - return m_warnings; - } - - @Override - public void trace(String message, Object... args) { - m_reporter.trace(message, args); - } - - @Override - public void info(String message, Object... args) { - m_reporter.trace(message, args); - } - - @Override - public void warn(String message, Object... args) { - m_reporter.warning(message, args); - m_warnings.add(String.format(message, args)); - } - - @Override - public void error(String message, Object... args) { - m_reporter.error(message, args); - m_errors.add(String.format(message, args)); - } -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java deleted file mode 100644 index e2ee7fc9c3..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ByteArrayResource.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.bnd; - - -import aQute.bnd.osgi.AbstractResource; - -/** - * A {@code ByteArrayResource} is ... - * - * @author Felix Project Team - */ -public class ByteArrayResource extends AbstractResource { - - private byte[] m_content; - - public ByteArrayResource(byte[] content) { - super(System.currentTimeMillis()); - m_content = content; - } - - @Override - protected byte[] getBytes() throws Exception { - return m_content; - } -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java deleted file mode 100644 index 4d267ca7bd..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/Manifests.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.bnd; - -import java.util.jar.Attributes; - -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Jar; - -/** - * A {@code Manifests} is a utility class for extracting data from Bundle's Manifest. - * - * @author Felix Project Team - */ -public class Manifests { - private Manifests() {} - - public static String getComponents(Attributes main) { - String value = main.getValue("iPOJO-Components"); - if (value == null) { - value = main.getValue("IPOJO-Components"); - } - - return value; - } - - public static boolean hasEmbedComponents(Analyzer analyzer) throws Exception { - for (Jar jar : analyzer.getClasspath()) { - // Check if the bundle was manipulated before - Attributes attr = jar.getManifest().getMainAttributes(); - if (getComponents(attr) != null) { - return true; - } - } - return false; - } - - -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java deleted file mode 100644 index 09dc02a5b5..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/PojoizationPlugin.java +++ /dev/null @@ -1,191 +0,0 @@ -/* - * 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.ipojo.bnd; - -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Jar; -import aQute.bnd.osgi.Resource; -import aQute.bnd.service.AnalyzerPlugin; -import aQute.bnd.service.Plugin; -import aQute.service.reporter.Reporter; -import org.apache.felix.ipojo.manipulator.ManipulationVisitor; -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider; -import org.apache.felix.ipojo.manipulator.metadata.CacheableMetadataProvider; -import org.apache.felix.ipojo.manipulator.metadata.CompositeMetadataProvider; -import org.apache.felix.ipojo.manipulator.metadata.FileMetadataProvider; -import org.apache.felix.ipojo.manipulator.util.Classpath; -import org.apache.felix.ipojo.manipulator.visitor.check.CheckFieldConsistencyVisitor; -import org.apache.felix.ipojo.manipulator.visitor.writer.ManipulatedResourcesWriter; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.File; -import java.util.*; - -/** - * A {@code BndIpojoPlugin} is ... - * - * @author Felix Project Team - */ -public class PojoizationPlugin implements Plugin, AnalyzerPlugin { - - private static final String PROPERTY_METADATA = "metadata"; - private static final String PROPERTY_USE_LOCAL_SCHEMAS = "use-local-schemas"; - private static final String PROPERTY_INCLUDE_EMBED_BUNDLES = "include-embed-bundles"; - - private static final String DEFAULT_METADATA = "META-INF/metadata.xml"; - private static final boolean DEFAULT_USE_LOCAL_SCHEMAS = false; - private static final boolean DEFAULT_INCLUDE_EMBED_BUNDLES = false; - - private String m_metadata = DEFAULT_METADATA; - private boolean m_useLocalSchemas = DEFAULT_USE_LOCAL_SCHEMAS; - private boolean m_includeEmbedBundles = DEFAULT_INCLUDE_EMBED_BUNDLES; - - private Reporter m_reporter; - - public void setProperties(Map configuration) { - - // Use metadata file if any - if (configuration.containsKey(PROPERTY_METADATA)) { - m_metadata = configuration.get(PROPERTY_METADATA); - } - - // Use local schemas ? - if (configuration.containsKey(PROPERTY_USE_LOCAL_SCHEMAS)) { - m_useLocalSchemas = true; - } - - // Process embed bundles ? - if (configuration.containsKey(PROPERTY_INCLUDE_EMBED_BUNDLES)) { - m_includeEmbedBundles = true; - } - } - - public void setReporter(Reporter reporter) { - m_reporter = reporter; - } - - public boolean analyzeJar(Analyzer analyzer) throws Exception { - - long start = System.currentTimeMillis(); - - // Wraps the Bnd Reporter - BndReporter reporter = new BndReporter(this.m_reporter); - - // Build ResourceStore - BndJarResourceStore store = new BndJarResourceStore(analyzer, this.m_reporter); - store.setIncludeEmbedComponents(m_includeEmbedBundles); - - CompositeMetadataProvider provider = buildMetadataProvider(analyzer, reporter, store); - - // Quick exit - CacheableMetadataProvider cache = new CacheableMetadataProvider(provider); - if (cache.getMetadatas().isEmpty() && !hasEmbedComponents(analyzer)) { - return false; - } - - // Compute the classpath to build the classloader. - List jars = analyzer.getClasspath(); - Jar jar = analyzer.getJar(); - - Set paths = new LinkedHashSet(); - if (jar != null && jar.getSource() != null) { - paths.add(jar.getSource().getAbsolutePath()); - } - for (Jar j : jars) { - if (j.getSource() != null) { - paths.add(j.getSource().getAbsolutePath()); - } - } - Classpath cp = new Classpath(paths); - manipulateComponents(reporter, store, cache, cp.createClassLoader()); - - int nbComponents = findElements(cache.getMetadatas(), "component").size(); - int nbHandlers = findElements(cache.getMetadatas(), "handler").size(); - this.m_reporter.trace("iPOJO manipulation performed performed in %s ms (%d components, %d handlers).", - (System.currentTimeMillis() - start), - nbComponents, - nbHandlers); - // Return true if a new run should be performed after the analyze - return false; - } - - protected void manipulateComponents(BndReporter reporter, BndJarResourceStore store, - CacheableMetadataProvider cache, ClassLoader classLoader) { - Pojoization pojoization = new Pojoization(reporter); - pojoization.disableAnnotationProcessing(); - if (m_useLocalSchemas) { - pojoization.setUseLocalXSD(); - } - - pojoization.pojoization(store, cache, createVisitor(store, reporter), classLoader); - } - - protected CompositeMetadataProvider buildMetadataProvider(Analyzer analyzer, BndReporter reporter, BndJarResourceStore store) { - // Build MetadataProvider - CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter); - - File file = new File(m_metadata); - if (file.exists()) { - // Absolute file system resource - FileMetadataProvider fmp = new FileMetadataProvider(file, reporter); - fmp.setValidateUsingLocalSchemas(m_useLocalSchemas); - provider.addMetadataProvider(fmp); - } else { - // In archive resource - Resource resource = analyzer.getJar().getResource(m_metadata); - if (resource != null) { - ResourceMetadataProvider rmp = new ResourceMetadataProvider(resource, reporter); - rmp.setValidateUsingLocalSchemas(m_useLocalSchemas); - provider.addMetadataProvider(rmp); - } - } - provider.addMetadataProvider(new AnnotationMetadataProvider(store, reporter)); - return provider; - } - - private boolean hasEmbedComponents(Analyzer analyzer) throws Exception { - // We want to process components from embed jars ? - return m_includeEmbedBundles && Manifests.hasEmbedComponents(analyzer); - - } - - private List findElements(List metadatas, String name) { - List found = new ArrayList(); - for (Element element : metadatas) { - if (name.equalsIgnoreCase(element.getName())) { - found.add(element); - } - } - return found; - } - - protected ManipulationVisitor createVisitor(ResourceStore store, BndReporter reporter) { - ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter(); - writer.setReporter(reporter); - writer.setResourceStore(store); - - CheckFieldConsistencyVisitor checkFieldConsistencyVisitor = new CheckFieldConsistencyVisitor(writer); - checkFieldConsistencyVisitor.setReporter(reporter); - return checkFieldConsistencyVisitor; - } - -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java b/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java deleted file mode 100644 index e696b602ce..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/main/java/org/apache/felix/ipojo/bnd/ResourceMetadataProvider.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.bnd; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.StreamMetadataProvider; -import org.apache.felix.ipojo.metadata.Element; - -import aQute.bnd.osgi.Resource; - -/** - * A {@code ResourceMetadataProvider} is ... - * - * @author Felix Project Team - */ -public class ResourceMetadataProvider implements MetadataProvider { - - private Resource m_resource; - - private List m_cached; - - private boolean m_validateUsingLocalSchemas = false; - - private Reporter m_reporter; - - public ResourceMetadataProvider(Resource resource, Reporter reporter) { - m_resource = resource; - m_reporter = reporter; - } - - public void setValidateUsingLocalSchemas(boolean validateUsingLocalSchemas) { - this.m_validateUsingLocalSchemas = validateUsingLocalSchemas; - } - - public List getMetadatas() throws IOException { - if (m_cached == null) { - m_cached = new ArrayList(); - InputStream stream = null; - try { - stream = m_resource.openInputStream(); - } catch (Exception e) { - m_reporter.error("%s", e.getMessage()); - throw new IOException("Cannot read metadata", e); - } - StreamMetadataProvider provider = new StreamMetadataProvider(stream, m_reporter); - provider.setValidateUsingLocalSchemas(m_validateUsingLocalSchemas); - m_cached.addAll(provider.getMetadatas()); - } - - return m_cached; - } -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java deleted file mode 100644 index 3a425fdd5d..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/BndJarResourceStoreTestCase.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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.ipojo.bnd; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; -import static org.mockito.Mockito.verify; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Map; - -import org.mockito.Matchers; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; - -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Clazz; -import aQute.bnd.osgi.Jar; -import aQute.bnd.osgi.Resource; -import aQute.bnd.osgi.URLResource; -import aQute.service.reporter.Reporter; -import junit.framework.TestCase; - -/** - * Checks the Resource Store from the BND plugin. - */ -public class BndJarResourceStoreTestCase extends TestCase { - @Mock - private Reporter reporter; - - @Spy - private Analyzer analyzer = new Analyzer(); - - @Spy - private Jar dot = new Jar("root.jar"); - - @Spy - private Jar embed = new Jar("embed.jar"); - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testAnalysisWithOnlyEmbedComponents() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - props.put("include-embed-bundles", "true"); - - Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF")); - doReturn(dot).when(analyzer).getJar(); - doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF")); - analyzer.setClasspath(new Jar[] {embed}); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }", - analyzer.getProperty("IPOJO-Components")); - } - - public void testAnalysisWithExcludedEmbedComponents() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - - Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF")); - doReturn(dot).when(analyzer).getJar(); - doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF")); - analyzer.setClasspath(new Jar[] {embed}); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertNull(analyzer.getProperty("IPOJO-Components")); - } - - - public void testAnalysisWithBothLocalAndEmbedComponents() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - props.put("include-embed-bundles", "true"); - - Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST.MF")); - Resource resource2 = new URLResource(getClass().getResource("/metadata-components-only.xml")); - doReturn(dot).when(analyzer).getJar(); - doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF")); - doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml")); - analyzer.setClasspath(new Jar[]{embed}); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertContains("instance { $component=\"org.apache.felix.ipojo.IPOJOURLHandler\" }", - analyzer.getProperty("IPOJO-Components")); - assertContains("component { $class=\"com.acme.Thermometer\" }", - analyzer.getProperty("IPOJO-Components")); - } - - - public void testAnalysisWithLocallyDefinedComponentAndEmbedResource() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - props.put("include-embed-bundles", "true"); - String path = EmptyComponent.class.getName().replace('.', '/').concat(".class"); - - Resource resource2 = new URLResource(getClass().getResource("/metadata-test-component.xml")); - doReturn(dot).when(analyzer).getJar(); - doReturn(resource2).when(dot).getResource(eq("META-INF/metadata.xml")); - - Collection classes = new ArrayList(); - Resource typeResource = new URLResource(getClass().getResource("EmptyComponent.class")); - Clazz clazz = new Clazz(analyzer, path, typeResource); - clazz.parseClassFile(); - classes.add(clazz); - doReturn(classes).when(analyzer).getClasses(Matchers.anyVararg()); - - Resource resource = new URLResource(getClass().getResource("/EMBED-MANIFEST-EMPTY.MF")); - doReturn(resource).when(embed).getResource(eq("META-INF/MANIFEST.MF")); - doReturn(typeResource).when(embed).getResource(path); - doReturn("aaa").when(embed).getBsn(); - - analyzer.setClasspath(new Jar[] {embed}); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertContains("component { $classname=\"org.apache.felix.ipojo.bnd.EmptyComponent\" manipulation { $classname=\"org.apache.felix.ipojo.bnd.EmptyComponent\" method { $name=\"$init\" }}}", - analyzer.getProperty("IPOJO-Components")); - verify(dot).putResource(eq(path), any(Resource.class)); - } - - private void assertContains(String expected, String actual) { - System.out.println("Actual: " + actual); - assertTrue(actual.contains(expected)); - } - -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java deleted file mode 100644 index 6ea32e5dc5..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/EmptyComponent.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.bnd; - -/** -* Created with IntelliJ IDEA. -* User: guillaume -* Date: 07/01/13 -* Time: 11:31 -* To change this template use File | Settings | File Templates. -*/ -public class EmptyComponent { - -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java b/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java deleted file mode 100644 index 97837ad033..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/java/org/apache/felix/ipojo/bnd/PojoizationPluginTestCase.java +++ /dev/null @@ -1,110 +0,0 @@ -/* - * 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.ipojo.bnd; - -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.doReturn; - -import java.util.HashMap; -import java.util.Map; - -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; - -import aQute.bnd.osgi.Analyzer; -import aQute.bnd.osgi.Jar; -import aQute.bnd.osgi.Resource; -import aQute.bnd.osgi.URLResource; -import aQute.service.reporter.Reporter; -import junit.framework.TestCase; - -public class PojoizationPluginTestCase extends TestCase { - - @Mock - private Reporter reporter; - - @Spy - private Analyzer analyzer = new Analyzer(); - - @Spy - private Jar jar = new Jar("mock.jar"); - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testAnalysisWithComponentOnlyMetadataXml() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - - Resource resource = new URLResource(getClass().getResource("/metadata-components-only.xml")); - doReturn(jar).when(analyzer).getJar(); - doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml")); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertEquals("component { $class=\"com.acme.Thermometer\" }", - analyzer.getProperty("IPOJO-Components")); - } - - public void testAnalysisWithInstanceOnlyMetadataXml() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - - Resource resource = new URLResource(getClass().getResource("/metadata-instances-only.xml")); - doReturn(jar).when(analyzer).getJar(); - doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml")); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertEquals("instance { $component=\"com.acme.Thermometer\" }", - analyzer.getProperty("IPOJO-Components")); - } - - public void testAnalysisWithComponentsAndInstancesMetadataXml() throws Exception { - PojoizationPlugin plugin = new PojoizationPlugin(); - - Map props = new HashMap(); - - Resource resource = new URLResource(getClass().getResource("/metadata-components-and-instances.xml")); - doReturn(jar).when(analyzer).getJar(); - doReturn(resource).when(jar).getResource(eq("META-INF/metadata.xml")); - - plugin.setReporter(reporter); - plugin.setProperties(props); - - plugin.analyzeJar(analyzer); - - assertEquals("component { $class=\"com.acme.Thermometer\" }" + - "instance { $component=\"com.acme.Thermometer\" }" + - "instance { $component=\"com.acme.Thermometer\" }", - analyzer.getProperty("IPOJO-Components")); - } -} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF deleted file mode 100644 index bc04d39327..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST-EMPTY.MF +++ /dev/null @@ -1,6 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: Embed -Bundle-Vendor: The Apache Software Foundation -Bundle-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.felix.ipojo.test diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF deleted file mode 100644 index b19fc3ec29..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/EMBED-MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-Name: Embed -Bundle-Vendor: The Apache Software Foundation -Bundle-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-SymbolicName: org.apache.felix.ipojo.test -IPOJO-Components: instance { $component="org.apache.felix.ipojo.IPOJOU - RLHandler" }component { $immediate="true" $classname="org.apache.feli - x.ipojo.IPOJOURLHandler" $public="false" callback { $transition="inva - lidate" $method="stop" }provides { property { $mandatory="false" $nam - e="url.handler.protocol" $value="ipojo" $type="java.lang.String" }}ma - nipulation { $super="org.osgi.service.url.AbstractURLStreamHandlerSer - vice" field { $name="m_context" $type="org.osgi.framework.BundleConte - xt" }field { $name="m_temp" $type="java.io.File" }method { $arguments - ="{org.osgi.framework.BundleContext}" $name="$init" }method { $name=" - stop" }method { $arguments="{java.net.URL}" $name="openConnection" $r - eturn="java.net.URLConnection" }method { $arguments="{java.net.URL,ja - va.io.File}" $name="save" }method { $arguments="{java.io.InputStream, - java.io.File}" $name="save" }method { $arguments="{java.util.jar.JarF - ile}" $name="findMetadata" $return="java.io.File" }interface { $name= - "org.osgi.service.url.URLStreamHandlerService" }}} diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml deleted file mode 100644 index 3b1473e0fa..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-and-instances.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml deleted file mode 100644 index 466d6fba29..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-components-only.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml deleted file mode 100644 index 870c6ed782..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-instances-only.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml b/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml deleted file mode 100644 index 8df4c4c045..0000000000 --- a/ipojo/manipulator/bnd-ipojo-plugin/src/test/resources/metadata-test-component.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - diff --git a/ipojo/manipulator/changelog.txt b/ipojo/manipulator/changelog.txt deleted file mode 100644 index 382b8ca231..0000000000 --- a/ipojo/manipulator/changelog.txt +++ /dev/null @@ -1,158 +0,0 @@ -Changes from the 1.12.1 to 1.13.0 ---------------------------------- - -** Improvement - * [FELIX-6502] - iPojo Java 11+ support - -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST - * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account. - * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata - * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames - * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable - * [FELIX-3574] - IPojo bytecode manipulation looses method argument names - * [FELIX-3621] - Two dimensional array as argument to a method in a component - - -Changes from the 1.8.2 to 1.8.4 -------------------------------- - -** Bug - * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException - * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7 - -Changes in the 1.8.2 --------------------- - -** Bug - * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files - * [FELIX-3012] - "Duplicate name&signature" problem - * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter - * [FELIX-3145] - VerifyError on Java 7 - * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest - -** Improvement - * [FELIX-3017] - The manipulator should return the original class if it's already manipulated - * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator - * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities - * [FELIX-3080] - Implement a BND plugin for iPOJO - * [FELIX-3131] - Elements and attributes should conserve the insertion order - * [FELIX-3204] - @Temporal should handle instantiation-time properties - * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible diff --git a/ipojo/manipulator/ipojo-ant-task/changelog.txt b/ipojo/manipulator/ipojo-ant-task/changelog.txt deleted file mode 100644 index 17553472cc..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/changelog.txt +++ /dev/null @@ -1,197 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST - * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account. - * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata - * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames - * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable - * [FELIX-3574] - IPojo bytecode manipulation looses method argument names - * [FELIX-3621] - Two dimensional array as argument to a method in a component - -Changes from the 1.8.2 to 1.8.4 -------------------------------- - -** Bug - * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException - * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7 - -Changes from the 1.8.0 to 1.8.2 -------------------------------- - -** Bug - * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files - * [FELIX-3012] - "Duplicate name&signature" problem - * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter - * [FELIX-3145] - VerifyError on Java 7 - * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest - -** Improvement - * [FELIX-3017] - The manipulator should return the original class if it's already manipulated - * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator - * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities - * [FELIX-3080] - Implement a BND plugin for iPOJO - * [FELIX-3131] - Elements and attributes should conserve the insertion order - * [FELIX-3204] - @Temporal should handle instantiation-time properties - * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible - -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Improvement - * [FELIX-2755] - Allow the manipulator and the different front end to use several metadata files - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Bug - * [FELIX-1411] - Issue on windows to find components inside bundle - -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from the 1.4.0 to 1.4.2 -------------------------------- -** Bug - * [FELIX-1411] - Issue on windows to find components inside bundle - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1302] - Manipulator never ignore annotations - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-813] - Resolve XML-Schemas locally rather than from Internet - -Changes from 0.8.1 to 1.0.0 ---------------------------- -** Bug - * Update contained Xerces packages to support XML-Schemas - -** Improvement - * Embed the latest manipulator - -Version 0.8.1 -------------- - * Initial release diff --git a/ipojo/manipulator/ipojo-ant-task/pom.xml b/ipojo/manipulator/ipojo-ant-task/pom.xml deleted file mode 100644 index 98fb59d9f5..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/pom.xml +++ /dev/null @@ -1,171 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - org.apache.felix.ipojo.ant - 1.13.1-SNAPSHOT - bundle - Apache Felix iPOJO Ant Task - - - Ant task to package iPOJO-powered bundles. - - - - [1.12.1,2.0.0) - - - - - org.apache.felix - org.apache.felix.ipojo.metadata - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - xerces - xercesImpl - 2.12.2 - - - ant - ant - 1.6.5 - - - commons-cli - commons-cli - 1.2 - - - - - - - org.apache.felix - ipojo-manipulator-bom - ${project.version} - pom - import - - - - - - - - src/main/resources - true - - - - - org.apache.felix - maven-bundle-plugin - 5.1.9 - true - - - iPOJO Ant Task - ${project.artifactId} - The Apache Software Foundation - iPOJO Ant Task - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-ant-task.html - - - org.apache.felix.ipojo.metadata, - org.apache.felix.ipojo.manipulator*, - org.apache.felix.ipojo.xml.parser, - org.apache.felix.ipojo.manipulation*, - org.apache.felix.ipojo.annotations*, - org.objectweb.asm.util;-split-package:=merge-first, - org.objectweb.asm;-split-package:=merge-first, - org.objectweb.asm.commons;-split-package:=merge-first, - org.objectweb.asm.tree*;-split-package:=merge-first, - org.apache.xerces.parsers, org.apache.xerces.xni*, - org.apache.xerces.impl*, org.apache.xerces.util.*, - org.apache.xerces.dom.*, org.apache.xerces.dom3.*, - - org.apache.commons.cli - - org.apache.felix.ipojo.task - org.apache.felix.ipojo.task.IPojoc - - NONE - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - - diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index caa7b23fd9..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -III. Overall License Summary -- Apache License 2.0 -- BSD License diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index b42de548c3..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Ant Task: - -The Apache Felix iPOJO Ant Task includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 016e60dffa..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,3 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java deleted file mode 100644 index b99b8521d9..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/AntReporter.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ipojo.task; - -import org.apache.felix.ipojo.manipulator.reporter.EmptyReporter; -import org.apache.tools.ant.Project; - -/** - * An {@code AntReporter} wraps an Ant project (central place for logging in ant - * into an iPOJO Reporter. - * - * @author Felix Project Team - */ -public class AntReporter extends EmptyReporter { - - /** - * Ant Project (used for log). - */ - private Project project; - - public AntReporter(Project project) { - this.project = project; - } - - @Override - public void trace(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - project.log(formatted, Project.MSG_DEBUG); - } - - @Override - public void info(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - project.log(formatted, Project.MSG_INFO); - } - - @Override - public void warn(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - project.log(formatted, Project.MSG_WARN); - getWarnings().add(formatted); - } - - @Override - public void error(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - project.log(formatted, Project.MSG_ERR); - getErrors().add(formatted); - } - -} diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java deleted file mode 100644 index ddbb0627c6..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoTask.java +++ /dev/null @@ -1,348 +0,0 @@ -/* - * 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.ipojo.task; - -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.tools.ant.BuildException; -import org.apache.tools.ant.Project; -import org.apache.tools.ant.Task; -import org.apache.tools.ant.types.Path; -import org.apache.tools.ant.types.Reference; - -import java.io.File; - -/** - * iPOJO Ant Task. This Ant task manipulates an input bundle. - * - * @author Felix Project Team - */ -public class IPojoTask extends Task { - - /** - * Metadata file. - */ - private File m_metadata; - - /** - * Input bundle. - */ - private File m_input; - - /** - * Output bundle. - */ - private File m_output; - - /** - * Input directory. - */ - private File m_directory; - - /** - * Input manifest. - */ - private File m_manifest; - - /** - * Flag describing if we need to ignore annotation of not. - */ - private boolean m_ignoreAnnotations = false; - - - /** - * Flag describing if we need or not use local XSD files - * (i.e. use the {@link org.apache.felix.ipojo.xml.parser.SchemaResolver} or not). - * If true the local XSD are not used. - */ - private boolean m_ignoreLocalXSD = false; - - /** - * The classpath. - */ - private Path m_classpath; - - /** - * Set the metadata file. - * - * @param meta : the metadata file. - */ - public void setMetadata(File meta) { - m_metadata = meta; - } - - /** - * Set the manifest file. - * - * @param manifest : the manifest file. - */ - public void setManifest(File manifest) { - m_manifest = manifest; - } - - /** - * Set the input bundle. - * - * @param in : the input bundle - */ - public void setInput(File in) { - m_input = in; - } - - /** - * Set the input directory. - * - * @param dir : the input directory - */ - public void setDir(File dir) { - m_directory = dir; - } - - /** - * Set the output bundle. - * - * @param out : the output bundle - */ - public void setOutput(File out) { - m_output = out; - } - - /** - * Set if we need to ignore annotations or not. - * - * @param flag : true if we need to ignore annotations. - */ - public void setIgnoreAnnotations(boolean flag) { - m_ignoreAnnotations = flag; - } - - /** - * Set if we need to use embedded XSD files or not. - * - * @param flag : true if we need to ignore embedded XSD files. - */ - public void setIgnoreEmbeddedSchemas(boolean flag) { - m_ignoreLocalXSD = flag; - } - - /** - * Execute the Ant Task. - * - * @see org.apache.tools.ant.Task#execute() - */ - public void execute() { - - if (m_input == null && m_directory == null) { - throw new BuildException("Neither input bundle nor directory specified"); - } - - if (m_input != null && !m_input.exists()) { - throw new BuildException("The input bundle " + m_input.getAbsolutePath() + " does not exist"); - } - - if (m_directory != null && !m_directory.exists()) { - throw new BuildException("The input directory " + m_directory.getAbsolutePath() + " does not exist"); - } - if (m_directory != null && !m_directory.isDirectory()) { - throw new BuildException("The input directory " + m_directory.getAbsolutePath() + " is not a directory"); - } - - - if (m_input != null) { - log("Input bundle file : " + m_input.getAbsolutePath()); - } else { - log("Input directory : " + m_directory.getAbsolutePath()); - } - - if (m_manifest != null) { - if (m_input != null) { - throw new BuildException("The manifest location cannot be used when manipulating an existing bundle"); - } - if (!m_manifest.exists()) { - throw new BuildException("The manifest file " + m_manifest.getAbsolutePath() + " does not exist"); - } - } - - // Get metadata file - if (m_metadata == null) { - m_metadata = new File("./metadata.xml"); - if (!m_metadata.exists()) { - // Verify if annotations are ignored - if (m_ignoreAnnotations) { - log("No metadata file found & annotations ignored : nothing to do"); - return; - } else { - log("No metadata file found - trying to use only annotations"); - m_metadata = null; - } - } else { - log("Metadata file : " + m_metadata.getAbsolutePath()); - } - } else { - // Metadata file is specified, check existence - if (!m_metadata.exists()) { - throw new BuildException("No metadata file found - the file " + m_metadata.getAbsolutePath() + " does not exist"); - } else { - if (m_metadata.isDirectory()) { - log("Metadata directory : " + m_metadata.getAbsolutePath()); - } else { - log("Metadata file : " + m_metadata.getAbsolutePath()); - } - } - } - - initializeSaxDriver(); - - - log("Start manipulation"); - - if (m_input != null) { // Prepare output file - if (m_output == null) { - m_output = new File("./_out.jar"); - } - if (m_output.exists()) { - boolean r = m_output.delete(); - if (!r) { - throw new BuildException("The file " + m_output.getAbsolutePath() + " cannot be deleted"); - } - } - } - - AntReporter reporter = new AntReporter(getProject()); - Pojoization pojo = new Pojoization(reporter); - if (m_ignoreAnnotations) { - pojo.disableAnnotationProcessing(); - } - if (!m_ignoreLocalXSD) { - pojo.setUseLocalXSD(); - } - - Path classpath = getClasspath(); - classpath.addJavaRuntime(); - - // Adding the input jar or directory - if (m_classpath == null) { - m_classpath = createClasspath(); - } - Path element = m_classpath.createPath(); - if (m_input != null) { - element.setLocation(m_input.getAbsoluteFile()); - } else if (m_directory != null) { - element.setLocation(m_directory.getAbsoluteFile()); - } - m_classpath.add(element); - - ClassLoader loader = getProject().createClassLoader(getClasspath()); - if (m_input != null) { - pojo.pojoization(m_input, m_output, m_metadata, loader); - } else { - pojo.directoryPojoization(m_directory, m_metadata, m_manifest, loader); - } - for (int i = 0; i < reporter.getWarnings().size(); i++) { - log((String) reporter.getWarnings().get(i), Project.MSG_WARN); - } - if (reporter.getErrors().size() > 0) { - throw new BuildException((String) reporter.getErrors().get(0)); - } - - if (m_input != null) { - String out; - if (m_output.getName().equals("_out.jar")) { - if (m_input.delete()) { - if (!m_output.renameTo(m_input)) { - log("Cannot rename the output jar to " + m_input.getAbsolutePath(), Project.MSG_WARN); - } - } else { - log("Cannot delete the input file : " + m_input.getAbsolutePath(), Project.MSG_WARN); - } - out = m_input.getAbsolutePath(); - } else { - out = m_output.getAbsolutePath(); - } - - log("Bundle manipulation - SUCCESS"); - log("Output file : " + out); - } else { - log("Manipulation - SUCCESS"); - log("Output files : " + m_directory.getAbsolutePath()); - if (m_manifest != null) { - log("Manifest : " + m_manifest.getAbsolutePath()); - } - - } - - } - - /** - * If Ant runs with Java 1.4, we should use the embedded Xerces. - * To achieve that, we set the org.xml.sax.driver property. - * Otherwise, the JVM sets the org.xml.sax.driver property. - */ - private void initializeSaxDriver() { - String version = (String) System.getProperty("java.vm.version"); - if (version.startsWith("1.4")) { - System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); - } - } - - /** - * Set the classpath to be used for this packaging. - * - * @param classpath the classpath used for this packaging - */ - public synchronized void setClasspath(Path classpath) { - if (m_classpath == null) { - m_classpath = createClasspath(); - } - m_classpath.append(classpath); - } - - /** - * Creates a nested classpath element. - * - * @return classpath - */ - public synchronized Path createClasspath() { - if (m_classpath == null) { - m_classpath = new Path(getProject()); - } - return m_classpath.createPath(); - } - - /** - * Adds to the classpath a reference to - * a <path> defined elsewhere. - * - * @param pathRef the reference to add to the classpath - */ - public void setClasspathRef(Reference pathRef) { - createClasspath().setRefid(pathRef); - } - - /** - * Gets the classpath. - * - * @return the classpath - */ - public Path getClasspath() { - return m_classpath; - } - - -} - diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java b/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java deleted file mode 100644 index 82607429d9..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/java/org/apache/felix/ipojo/task/IPojoc.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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.ipojo.task; - -import static java.lang.String.format; - -import org.apache.commons.cli.*; -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.util.Constants; - -import java.io.File; -import java.util.List; - -/** - * A command line tools to manipulate iPOJO bundles. - * It can be used as follow: - * java -jar this-jar.jar --input the-jar-to-manipulate
- * java -jar this-jar.jar --input the-jar-to-manipulate --output the-output-jar
- * java -jar this-jar.jar --input the-jar-to-manipulate --metadata the-xml-metadata
- */ -public class IPojoc { - - /** - * Input file to be manipulated. - */ - private File m_input; - - /** - * Output file (temporary or not). - */ - private File m_output; - - /** - * Metadata file (may be null). - */ - private File m_metadata; - - /** - * Manipulator. - */ - private Pojoization m_pojoization; - - /** - * The main entry point - * @param args the arguments - */ - public static void main(String[] args) { - Options options = buildOptions(); - CommandLine cmd = null; - try { - cmd = buildCommandLine(args, options); - if (cmd.hasOption('h')) { - printHelp(options); - } else { - IPojoc compiler = new IPojoc(); - compiler.execute(cmd); - } - } catch (MissingOptionException e) { - for (String opt : (List) e.getMissingOptions()) { - System.err.println("The '" + opt + "' option is missing"); - } - printHelp(options); - } catch (MissingArgumentException e) { - System.err.println("The option '" + e.getOption() + "' requires an argument"); - printHelp(options); - } catch (Exception e) { - System.out.printf("Manipulation failed: %s%n", e.getMessage()); - if ((cmd != null) && cmd.hasOption('X')) { - e.printStackTrace(System.out); - } else { - System.out.printf("Use -X option to print the full stack trace%n"); - } - } - } - - private static CommandLine buildCommandLine(final String[] args, final Options options) throws ParseException { - CommandLineParser parser = new GnuParser(); - return parser.parse(options, args); - } - - /** - * The command line is valid, to processing the command line. - * @param cmd the command line - * @throws ParseException - */ - private void execute(CommandLine cmd) throws Exception { - System.out.printf("iPOJO Manipulation (%s)%n", Constants.getVersion()); - System.out.println("-----------------------------------------------"); - readInputOption(cmd); - readOutputOption(cmd); - readMetadataOption(cmd); - - manipulate(); - printStatus(); - } - - private void readMetadataOption(final CommandLine cmd) throws Exception { - // Retrieve the metadata file - if (cmd.hasOption("m")) { - m_metadata = (File) cmd.getParsedOptionValue("m"); - if (m_metadata != null && !m_metadata.isFile()) { - throw new Exception( - format("The metadata option must be an existing file, '%s' does not exist", cmd.getOptionValue('m')) - ); - } - System.out.println("metadata file => " + m_metadata.getAbsolutePath()); - } else { - System.out.println("metadata file => no metadata file"); - } - } - - private void readOutputOption(final CommandLine cmd) throws Exception { - // Retrieve output file - if (cmd.hasOption("o")) { - try { - m_output = (File) cmd.getParsedOptionValue("o"); - } catch (ParseException pe) { - throw new Exception( - format("The output option must be an existing file, '%s' does not exist", cmd.getOptionValue('o')) - ); - } - System.out.println("output file => " + m_output.getAbsolutePath()); - } else { - // Inline replacement - // We create a temporary file marked by a __ prefix - // It will be substituted upon success. - m_output = new File("__" + m_input.getName()); - System.out.println("output file => " + m_input.getAbsolutePath()); - } - } - - private void readInputOption(final CommandLine cmd) throws Exception { - // Check that the input file exist - m_input = (File) cmd.getParsedOptionValue("i"); - if (m_input == null || !m_input.isFile()) { - throw new Exception( - format("The input option must be an existing file, '%s' does not exist", cmd.getOptionValue('i')) - ); - } - System.out.println("input file => " + m_input.getAbsolutePath()); - } - - private void manipulate() { - m_pojoization = new Pojoization(); - m_pojoization.pojoization(m_input, m_output, m_metadata); - } - - private void printStatus() { - if (m_pojoization.getErrors().size() != 0) { - System.err.println("iPOJO Manipulation failed :"); - for (String error : m_pojoization.getErrors()) { - System.err.println("\t" + error); - } - System.exit(-1); - } else { - System.err.println("iPOJO Manipulation successfully completed."); - for (String warning : m_pojoization.getWarnings()) { - System.err.println(warning); - } - cleanup(); - System.exit(0); - } - } - - /** - * Upon success, cleanup temporary files. - */ - private void cleanup() { - if (m_output.getName().startsWith("__")) { - m_input.delete(); - m_output.renameTo(m_input); - } - } - - /** - * Print help. - * @param options - */ - private static void printHelp(final Options options) { - HelpFormatter formatter = new HelpFormatter(); - formatter.printHelp("java -jar org.apache.felix.ipojo.ant-" + Constants.getVersion() + ".jar", options); - } - - /** - * Builds the option list - * @return the options - */ - public static Options buildOptions() { - Option input = - OptionBuilder.withArgName("input file") - .withLongOpt("input") - .hasArg() - .withDescription("the input jar file") - .isRequired(true) - .withType(File.class) - .create('i'); - - Option output = - OptionBuilder - .withLongOpt("output") - .withArgName("output file") - .hasArg() - .withDescription("the output jar file, if not set the manipulation replaces the input file") - .isRequired(false) - .withType(File.class) - .create('o'); - - Option metadata = - OptionBuilder - .withLongOpt("metadata") - .withArgName("metadata file") - .hasArg() - .withDescription("the XML metadata file") - .isRequired(false) - .withType(File.class) - .create('m'); - - Option verbose = new Option("X", "exception", false, "print exception stack trace in case of error"); - - Option help = - OptionBuilder.withLongOpt("help").withDescription("print this message").create('h'); - - return new Options() - .addOption(input) - .addOption(output) - .addOption(metadata) - .addOption(verbose) - .addOption(help); - } -} diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties deleted file mode 100644 index d070319aec..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/constants.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -# This file define the different constant we use in the manipulator. This file is filtered by Maven. -manipulator.version=${project.version} -ipojo.import.packages=${ipojo.import.packages} \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module deleted file mode 100644 index d3b15f9e2e..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module +++ /dev/null @@ -1 +0,0 @@ -org.apache.felix.ipojo.manipulator.metadata.annotation.module.DefaultBindingModule \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd deleted file mode 100644 index f127dddf8d..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/composite.xsd +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd deleted file mode 100644 index 3c729c9e05..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/core.xsd +++ /dev/null @@ -1,704 +0,0 @@ - - - - iPOJO Core XML-Schema. This grammars models iPOJO descriptor using core - features. It provides several extensibility mechanism in order to compose this schema with - external handlers and other component implementation type such as - compositions. - - - - - - iPOJO top level element. - - - - - The handler declarations. - - - - - The instance declarations. - - - - - The component type declarations. - - - - - - - - - Description of the handler. - - - - - - - - - The implementation class of the handler. The specified class must - implement (direcly or not) the "org.apache.felix.ipojo.Handler" - interface. - - - - - - The name of the handler. - - - - - The XML namespace of the handler. - - - - - Enables or disables the architecture exposition. By default, the - architecture is not exposed. This allows handler introspection. - - - - - - The start level of the handler. - - - - - - - - Describes an instance of a component. - - - - - - - The instance props. - - - - - - The name of the instance component type. - - - - - The (unique) name of the instance. - - - - - The version of the factory to use. - - - - - - - - Defines a property of an instance configuration. - - - - - - - Name of the property. Can be optional if a property is inside a structure. - The 'instance.name' property has a special semantic as it will be used as the instance - name. - - - - - - Value of the property. Can be null for property containing other - props. - - - - - - Type of the property, used to create the adequate object. Supported values - are list, array, dictionary and map. - - - - - - - - Declares an atomic (i.e. primitive) component type. - - - - - Describes the method(s) to invoke when the component's state - changes. - - - - - - Indicates the component provided service(s). By default, all implemented - interfaces are published. - - - - - - Indicates the service requirements of the component. - - - - - Describes the properties of the component. - - - - - Lifecycle controller for this component. - - - - - - - Specifies the name of the component type. This name is used to identify - the factory attached to this type. If not specified, the factory name is the - implementation class name. - - - - - - Determines if the component type is public or private. A public factory - (default) can be used from any bundles. - - - - - - Specifies the implementation class of the component - type. - - - - - - Enables or disables the architecture exposition. By default, the - architecture is exposed. This allows instance introspection. - - - - - - Creates the object of the component implementation type as soon as the - component instance becomes valid. The default value is "true" if the component doesn't - provide any service, "false" otherwise. - - - - - - Factory method called to create POJO objects instead of the constructor. - The specified method must be a static method of the implementation class returning an - instance of this implementation class. The factory method can receive the bundle context - in argument. - - - - - - Set the version of this component type - - - - - - Description of component services requirements. - - - - - - - Service requirement method invocation description. Here can be - specified a bind method called when a service appears and an unbind method called - when a service disappears. - - - - - - - - The interface describing the required service type. This attribute is - needed only when using aggregate dependencies with field injection and when the type - of this field is a list, vector, collection and set. This attribute is deprecated, use - 'specification'. - - - - - - - The name of the field representing the service dependency in the - implementation class. - - - - - - - Enable or disable the Nullable pattern on optional service - dependencies. By default, Nullable pattern is enabled. If disabled, iPOJO will inject - null instead of a Nullable object. - - - - - - - Specifies the default implementation class for an optional service - dependency. If no providers are found, iPOJO creates an instance of the - default-implementation (nullary constructor) and injects it. The given class must - implement the required service interface. - - - - - - - Specifies the exception to throw for an optional service - dependency. If no providers are found, iPOJO creates an instance of the - exception (with either no parameter or a String parameter as constructor argument), and - throws it. The given class name must extends RuntimeException. - - - - - - - Specifies the timeout after which the 'no service policy' is executed - (nullable, null, empty collection, exception...). The value is the time in millisecond to - wait. -1 is used to indicate an infinite wait, 0 executes the no service policy - immediately. - - - - - - - Specific service provider. The dependency can only be fulfilled by the - component with the matching name, or by the service with a matching - PID. - - - - - - - Enables or Disable the proxy injection (on field - injection) - - - - - - - - - - - - - - - - - - - - Dependency callbacks are used to receive notification when service providers - arrive and leave. - - - - - Method to call - - - - - Type of callback (bind, unbind, or updated). Bind means that the method - will be called when a provider arrives. Unbind means that the method will be called when a - provider leaves. Updated means that a service was modified but is still valid for the - service dependency. - - - - - - - - - - - - - - Lifecycle Callback. Allows a POJO to be notified when the instance becomes - valid or invalid. - - - - - Specifies the method to call on the transition. - - - - - Specifies the transition when the callback needs to be - invoked. - - - - - Lifecycle transition state. "validate" means that the component's - instance was invalid and becomes valid, "invalidate" means that the component's intance - was valid and becomes invalid. - - - - - - - - - - - - Allows injecting the OSGi bundle context into the component. - - - - - Specifies the method receiving the bundle context. - - - - - Specifies the field receiving the bundle context. - - - - - Specifies the index of the parameter (0-based) receiving the bundle - context. - - - - - - Specifies the context source. - - - - - iPOJO supports two bundle context 'sources': component and instance. Component - is the bundle context of the bundle declaring the component, while instance is the bundle - context of the bundle declaring the instance. Obviously, they are the same when the instance - is declared in the same bundle as the component. By default, it uses 'component'. - - - - - - - - - - - - - Provided service(s) description. - - - - - - List of service specific props. - - - - - Service Controller impacting the current provided - service - - - - - - - - Deprecated attribute, use 'specifications' instead of - 'interface' - - - - - - The list of service specifications (i.e. interfaces) to expose. By - default, all interfaces implemented by the component implementation class are - published. - - - - - - Use 'strategy' instead of 'factory' - - - - - POJO creation strategy. By default, the POJO object is created once - (singleton). If the factory is set to "SERVICE", the creation policy follows the OSGi - service factory policy (one object object per asking bundle). INSTANCE allows creating one - different POJO object per asking instance. Finally, a custom strategy can be used by - specifying the qualified name of the class extending CreationPolicy - - - - - - Defines a callback called after the service registration. The callback takes a - ServiceReference - as parameter - - - - - - Defines a callback called after the service unregistration. The callback takes a - ServiceReference - as parameter - - - - - - - Defines a service controller. - - - - Field of the controller - - - - - Intiail value of the controller - - - - - - Defines a component property. - - - - Field of the property - - - - - Setter method of the property. This method is called to inject property - value. - - - - - - Name of the property. - - - - - Default value of the property. - - - - - Type of the property. - - - - - Set the property as mandatory. A mandatory property MUST receive a value - either in the component type description or in the instance configuration. Properties are - optional by default. - - - - - - Set the property as immutable. An immutable property is inherited by the component - instance but the value cannot be overridden. - - - - - - - - - - - - - - - - - - - - List of component, instance or service props. This field will receive - the property value. - - - - - - The list of props. - - - - - - Propagation of the component properties to the provided services. If this - parameter is set to "true", each time properties are reconfigured, they are propagated to - each service published by the component. - - - - - - Unique identifier used to reconfigure components properties (via Managed - Services) with the Configuration Admin. - - - - - - Method called when a reconfiguration is done - - - - - - - - The specification describing the required service type. This attribute is - needed only when using aggregate dependencies with field injection and when the type of - this field is a list, vector, collection and set. - - - - - - Sets the service dependency optionality - - - - - Sets the service dependency cardinality. - - - - - Sets the binding policy of the dependency. Three policies are supported. - The dynamic policy supports service providers dynamism. The static policy freezes the - provider set as soon as the dependency is used. The dynamic-priority policy is an - extension of the dynamic policy, but providers are ranked. - - - - - - - - - - - - - The comparator attribute allows specifying the class used to compare - providers. This class must implemented the java.util.Comparator class and must support the - comparison of service references. - - - - - - LDAP filter used to filter providers - - - - - id of the service dependency. The id allows to identify and to refer to - this dependency. - - - - - - - - Specifies the lifecycle controller of a component, which allows to validate - or invalidate component instances. - - - - - The name of the component lifecycle controller field. The type of the - specified field must be boolean. Setting the value of the specified field to "true" means - the validation of the component instance while setting it to "false" means the - invalidation of the component instance. - - - - - diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd deleted file mode 100644 index d3948e6f9c..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/event-admin.xsd +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - Description of an event publisher. - - - - The name of the event publisher, acting as a unique identifier. -The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher". - - - - The name of the POJO field associated to this event publisher. -Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending. - - - - The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events. - - - Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher. -The default value of this attribute is "false". - - - - The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key. -The default value of this attribute is user.data. - - - - - Description of an event subscriber. - - - - The name of the event subscriber, acting as a unique identifier. - - - The name of the POJO's method that will be called each time an event is received. -This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes. - - - - The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method. - - - The event filter is used to filter incoming events before sending them to the callback. -The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered. - - - - The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary. -If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event. -This attribute is generally used with the data-typeattribute to specify the received object type. -If an event is received and it does not contain such a key, it is ignored (with a warning message). - - - - This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects. -It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception. -Data events that are not corresponding to the specified type will be ignored (with a warning message). - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd deleted file mode 100644 index dc39757e90..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/extender-pattern.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Description of the extender pattern configuration. -The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked. - - - - Declaring the method to invoke when a matching bundle arrives - - - - Declaring the method to invoke when a matching bundle leaves - - - - Declaring the looked manifest header. - - - \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd deleted file mode 100644 index 09b95090d8..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/jmx.xsd +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Description of a JMX managed component. - - - - - - - The list of methods to expose. - - - - - - - The list of attributes to expose. - - - - - - - - Determines if the component must be register on the - MOSGi MBean server or not. - - - - - - - The complete object name of the managed component. - The syntax of this attribute must be compliant with - the ObjectName syntax, detailed in the JMX - specification. If neither domain nor name attributes - are specified, the default value is determined by - the package, the type and the instance name of the - component. This attribute overrides the domain and - name attributes. - - - - - - - The domain of the managed object (i.e., the left - part of the object name). This attribute must be - compliant with the domain syntax, as described in - the JMX specification. - - - - - - - The name property of the managed object. The value - of this attribute must comply with the ObjectName - value syntax, as described in the JMX specification. - - - - - - - - Specifies method to carry out operations before - beeing registered from the MBean server. The - signature of the specified method must be : - "ObjectName preRegister(MBeanServer server, - ObjectName name) throws Exception". - - - - - - - Specifies method to carry out operations after - beeing registered from the MBean server. The - signature of the specified method must be : "void - postRegister(Boolean registrationDone)". - - - - - - - Specifies method to carry out operations before - beeing unregistered from the MBean server. The - signature of the specified method must be : "void - preDeregister() throws Exception". - - - - - - - Specifies method to carry out operations after - beeing unregistered from the MBean server. The - signature of the specified method must be : - "void postDeregister()". - - - - - - Description of an attribute to expose. - - - - The name of the component's field to expose. - - - The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field. - - - Specify the access permission of the exposed field. - - - - Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access). - - - - - - - - - - Enable or disable attribute change notification sending for this property. If set to "true", a notification is sent each time the value of the field changes. - - - - - Description of a method to expose. - - - - The name of the method to expose. If multiple methods have the same name, all of them are exposed. - - - - The description of the exposed method, as it will appear in JMX. - - \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd deleted file mode 100644 index cecc68bb99..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/temporal.xsd +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - Description of a temporal dependency. - - - - The implementation field supporting the dependency. - - - - The dependency id - - - - Filter use to discover matching filter. - - - Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait. - - - - Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached. - - - - - Enables or Disables the proxy injection - - - - - Specifies the looked service specification. This attribute is mandatory when injecting in a Collection - - - - \ No newline at end of file diff --git a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd b/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd deleted file mode 100644 index 0c8ebb20c2..0000000000 --- a/ipojo/manipulator/ipojo-ant-task/src/main/resources/META-INF/xsd/whiteboard-pattern.xsd +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Description of the white-board architecture. - - - - Declaring the method to invoke when a matching service arrives. - - - - Declaring the method to invoke when a matching service leaves. - - - - Method called when an injected service reference is modified but stills valid against the filter. - - - - Filter use to discover matching filter. - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-bom/pom.xml b/ipojo/manipulator/manipulator-bom/pom.xml deleted file mode 100644 index 226ebd61ca..0000000000 --- a/ipojo/manipulator/manipulator-bom/pom.xml +++ /dev/null @@ -1,73 +0,0 @@ - - - - - 4.0.0 - - org.apache.felix - felix-parent - 8 - - - ipojo-manipulator-bom - 1.13.1-SNAPSHOT - Apache Felix iPOJO Manipulator BOM - pom - - - 9.6 - 1.6.0 - - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator - ${project.version} - - - org.apache.felix - org.apache.felix.ipojo.annotations - ${project.version} - - - org.ow2.asm - asm - ${asm.version} - - - org.ow2.asm - asm-commons - ${asm.version} - - - org.ow2.asm - asm-util - ${asm.version} - - - org.apache.felix - org.apache.felix.ipojo.metadata - ${metadata.version} - - - - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml deleted file mode 100644 index 5c2946651a..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator.manipulator-it - 1.13.1-SNAPSHOT - - - 4.0.0 - - ipojo-manipulator-creation-test - Apache Felix iPOJO Manipulator ~ Creation IT - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java deleted file mode 100644 index 32f39c59e9..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ASimpleParentClass.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class ASimpleParentClass { - - protected String name; - - public ASimpleParentClass() { - name = "hello"; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java deleted file mode 100644 index bd4893286f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructor.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class CallSuperConstructor extends ParentClass { - - public CallSuperConstructor() { - super("test"); - System.out.println("plop"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java deleted file mode 100644 index d75c223c4f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithBC.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.osgi.framework.BundleContext; - -public class CallSuperConstructorWithBC extends ParentClassWithBC { - - public CallSuperConstructorWithBC(BundleContext bc) { - super("bc", bc, "bundle"); - String message = "plop-bc"; - System.out.println(message); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java deleted file mode 100644 index 68237badd9..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperConstructorWithNew.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class CallSuperConstructorWithNew extends ParentClass { - - public CallSuperConstructorWithNew() { - super(new StringBuffer("test")); - System.out.println("plop"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java deleted file mode 100644 index 38720d62c0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CallSuperSuperConstructorWithNew.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class CallSuperSuperConstructorWithNew extends ParentClass2 { - - public CallSuperSuperConstructorWithNew() { - super(new String("test")); - System.out.println("plop"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index 01429a226b..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,118 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - private static FooProviderType1 singleton(BundleContext bc) { - if (singleton == null) { - count++; - singleton = new FooProviderType1(bc); - } - return singleton; - } - - public static FooProviderType1 several(BundleContext bc) { - count++; - return new FooProviderType1(bc); - } - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - - /** - * Custom constructor. - * @param bar - * @param foo - * @param bc - */ - public FooProviderType1(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java deleted file mode 100644 index f932351acc..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructor.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -public class NoEmptyConstructor implements CheckService { - - - private String name; - - public NoEmptyConstructor(final String n) { - name = n; - } - - public boolean check() { - return name != null; - } - - public Properties getProps() { - Properties props = new Properties(); - if (name == null) { - props.put("name", "NULL"); - } else { - props.put("name", name); - } - return props; - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java deleted file mode 100644 index 5e8afdae02..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoEmptyConstructorWithParentClass.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -public class NoEmptyConstructorWithParentClass extends ASimpleParentClass implements CheckService { - - public NoEmptyConstructorWithParentClass(final String n) { - name = n; - } - - public boolean check() { - return name != null; - } - - public Properties getProps() { - Properties props = new Properties(); - if (name == null) { - props.put("name", "NULL"); - } else { - props.put("name", name); - } - return props; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java deleted file mode 100644 index 6e4fc9edee..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class ParentClass { - - private String name; - - public ParentClass(final String n) { - name = n; - } - - public ParentClass(final StringBuffer n) { - name = n.toString(); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java deleted file mode 100644 index 6ea05837b0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass2.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class ParentClass2 extends SuperParentClass { - - public ParentClass2(String n) { - super(n); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java deleted file mode 100644 index 10fa7bac4d..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClassWithBC.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.osgi.framework.BundleContext; - -public class ParentClassWithBC { - - private BundleContext bc; - - public ParentClassWithBC(String foo, BundleContext bc, String bar) { - this.bc = bc; - System.out.println(foo + " : " + this.bc + "(" + bar + ")"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java deleted file mode 100644 index 21b825e5cb..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SeveralConstructors.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -public class SeveralConstructors implements CheckService { - - - private String name; - - public SeveralConstructors(){ - this("hello world"); - } - - public SeveralConstructors(final String n) { - name = n; - } - - public boolean check() { - return name != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("name", name); - return props; - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java deleted file mode 100644 index 5609a9c5e5..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SuperParentClass.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class SuperParentClass { - - private String name; - - public SuperParentClass(final String n) { - System.out.println("Hello from super super !"); - name = n; - } - - public SuperParentClass(final StringBuffer n) { - name = n.toString(); - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index b8e2d62bbb..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 523ddf3ff6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 7792aaa52c..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 67c6d7a2d6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java deleted file mode 100644 index 88a147802b..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface Plop { - - Object getPlop(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java deleted file mode 100644 index 419962ef3f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface PrimitiveManipulationTestService { - - byte getByte(); - void setByte(byte b); - - short getShort(); - void setShort(short s); - - int getInt(); - void setInt(int i); - - long getLong(); - void setLong(long l); - - float getFloat(); - void setFloat(float f); - - double getDouble(); - void setDouble(double d); - - char getChar(); - void setChar(char c); - - boolean getBoolean(); - void setBoolean(boolean b); - - // Array types - byte[] getBytes(); - void setBytes(byte[] bs); - - short[] getShorts(); - void setShorts(short[] ss); - - int[] getInts(); - void setInts(int is[]); - - long[] getLongs(); - void setLongs(long[] ls); - - float[] getFloats(); - void setFloats(float[] fs); - - double[] getDoubles(); - void setDoubles(double[] ds); - - char[] getChars(); - void setChars(char[] cs); - - boolean[] getBooleans(); - void setBooleans(boolean[] bs); - - // This method has been added to test an issue when autoboxing. - void setLong(long l, String s); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml deleted file mode 100644 index d35922c8d0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java deleted file mode 100644 index 3834a6a53a..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPOJOCreation.java +++ /dev/null @@ -1,283 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.FooProviderType1; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -/** - * Check the different method to create POJO object. - */ -public class TestPOJOCreation extends BaseTest { - - private ComponentInstance ci_lazzy; - private ComponentInstance ci_immediate; - private ComponentInstance ci_immediate_singleton; - - private Architecture lazzyArch; - private Architecture immeArch; - private Architecture immeArchSing; - - - private ComponentInstance ci_lazzy_sing; - private ComponentInstance ci_lazzy_sev; - - private Architecture lazzyArchSing; - private Architecture lazzyArchSev; - private ComponentInstance ci_lazzy_singM; - private ComponentInstance ci_lazzy_sevM; - - private Architecture lazzyArchSingM; - private Architecture lazzyArchSevM; - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - - @Before - public void setUp() { - String factName = "ManipulationCreation-FooProviderType-1"; - String compName = "FooProvider-1"; - ci_lazzy = ipojoHelper.createComponentInstance(factName, compName); - - String factName2 = "ManipulationCreation-ImmediateFooProviderType"; - String compName2 = "FooProvider-2"; - ci_immediate = ipojoHelper.createComponentInstance(factName2, compName2); - - String factName3 = "ManipulationCreation-ImmediateFooProviderTypeSingleton"; - String compName3 = "FooProvider-3"; - ci_immediate_singleton = ipojoHelper.createComponentInstance(factName3, compName3); - - String factName4 = "ManipulationCreation-FooProviderType-1-Sing"; - String compName4 = "FooProvider-1-Sing"; - ci_lazzy_sing = ipojoHelper.createComponentInstance(factName4, compName4); - - String factName5 = "ManipulationCreation-FooProviderType-1-Sev"; - String compName5 = "FooProvider-1-Sev"; - ci_lazzy_sev = ipojoHelper.createComponentInstance(factName5, compName5); - - String factName6 = "ManipulationCreation-FooProviderType-1-SingM"; - String compName6 = "FooProvider-1-SingM"; - ci_lazzy_singM = ipojoHelper.createComponentInstance(factName6, compName6); - - String factName7 = "ManipulationCreation-FooProviderType-1-SevM"; - String compName7 = "FooProvider-1-SevM"; - ci_lazzy_sevM = ipojoHelper.createComponentInstance(factName7, compName7); - - lazzyArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName + ")"); - immeArch = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName2 + ")"); - immeArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName3 + ")"); - lazzyArchSing = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName4 + ")"); - lazzyArchSev = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName5 + ")"); - lazzyArchSingM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName6 + ")"); - lazzyArchSevM = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + compName7 + ")"); - } - - public void tearDown() { - lazzyArch = null; - immeArch = null; - immeArchSing = null; - lazzyArchSing = null; - lazzyArchSev = null; - lazzyArchSingM = null; - lazzyArchSevM = null; - ipojoHelper.dispose(); - } - - /** - * Check lazy creation. - */ - @Test - public void testLazyCreation() { - assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check lazy and singleton creation. - */ - @Test - public void testLazyCreationSingleton() { - assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sing.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy_sing.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSing.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check lazy and "several" creation. - */ - @Test - public void testLazyCreationSeveral() { - assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sev.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy_sev.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - FooService fs2 = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertTrue("Check the FooService invocation-2", fs2.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSev.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check immediate creation. - */ - @Test - public void testImmediateCreation() { - assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_immediate.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArch.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check bundle context injection. - */ - @Test - public void testBundleContext() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - Properties p = fs.fooProps(); - assertNotNull("Check the bundle context", p.get("context")); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArch.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Test immediate singleton creation. - */ - @Test - public void testImmediateSingletonCreation() { - assertEquals("Check that one object is created ", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_immediate_singleton.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_immediate_singleton.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) immeArchSing.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check creation through a factory method. - * (lazy & singleton creation) - */ - @Test - public void testLazyCreationSingletonM() { - assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_singM.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy_singM.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - FooService fs2 = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertTrue("Check the FooService invocation", fs2.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSingM.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Check creation through a factory method. - * (lazy & several creation) - */ - @Test - public void testLazyCreationSeveralM() { - assertEquals("Check that no objects are created ", 0, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy_sevM.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy_sevM.getInstanceName() + " is available", ref); - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation", fs.foo()); - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length); - FooService fs2 = (FooService) osgiHelper.getServiceObject(ref); - assertTrue("Check the FooService invocation-2", fs2.foo()); - // Only one object as the getService method is called only once (service factory) despite the policy="method". - assertEquals("Check the creation of 1 object", 1, ((PrimitiveInstanceDescription) lazzyArchSevM.getInstanceDescription()).getCreatedObjects().length); - } - - /** - * Test a custom constructor. - * Not manipulated. - */ - @Test - public void testCustomConstuctor() { - FooService fs = new FooProviderType1(0, "foo", bc); - Properties props = fs.fooProps(); - assertEquals("Check bar", 0, ((Integer) props.get("bar")).intValue()); - assertEquals("Check foo", "foo", props.get("foo")); - assertEquals("Check context", bc, props.get("context")); - } - - @Test - public void testSuperCall() { - try { - ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructor"); - } catch (Throwable e) { - fail(e.getMessage()); - } - } - - @Test - public void testSuperCallWithNew() { - try { - ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithNew"); - } catch (Throwable e) { - fail(e.getMessage()); - } - } - - @Test - public void testSuperSuperCallWithNew() { - try { - ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperSuperConstructorWithNew"); - } catch (Throwable e) { - fail(e.getMessage()); - } - } - - @Test - public void testSuperCallWithBC() { - try { - ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.CallSuperConstructorWithBC"); - } catch (Throwable e) { - fail(e.getMessage()); - } - } - - -} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java deleted file mode 100644 index ba5e8150a9..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-creation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConstructor.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; - -public class TestSeveralConstructor extends BaseTest { - - private ComponentInstance ci, ci2, ci3; - - @Before - public void setUp() { - ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.SeveralConstructors"); - ci2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructor"); - ci3 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.NoEmptyConstructorWithParentClass"); - } - - @Test - public void testSeveralConstructor() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName()); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - assertTrue("Check assignation", cs.check()); - String name = (String) cs.getProps().get("name"); - assertEquals("Check message", "hello world", name); - //assertNull("Check message", name); - } - - @Test - public void testNoEmptyConstructor() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci2.getInstanceName()); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - assertFalse("Check assignation", cs.check()); - String name = (String) cs.getProps().get("name"); - assertEquals("Check message", "NULL", name); - } - - @Test - public void testNoEmptyConstructorWithAParentClass() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci3.getInstanceName()); - CheckService cs = (CheckService) osgiHelper.getServiceObject(ref); - assertTrue("Check assignation", cs.check()); // super set name to "hello" - String name = (String) cs.getProps().get("name"); - assertEquals("Check message", "hello", name); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml deleted file mode 100644 index e25ec3bea0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator.manipulator-it - 1.13.1-SNAPSHOT - - - 4.0.0 - - ipojo-manipulator-manipulation-metadata-test - - Apache Felix iPOJO Manipulator ~ Metadata IT - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java deleted file mode 100644 index 9441beeaa0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Child.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class Child extends Parent { - - public Child(String s) { - super(s); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java deleted file mode 100644 index 7eb4dbdf3f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentWithInnerClasses.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; - -/** - ** - * A component containing inner classes. - */ -@Component -public class ComponentWithInnerClasses{ - - public String doSomething() { - MyInnerWithANativeMethod nat = new MyInnerWithANativeMethod(); - MyInnerClass inn = new MyInnerClass(); - Runnable compute = new Runnable() { - - public void run() { - // ... - } - }; - return "foo"; - } - - private String foo = "foo"; - - private class MyInnerWithANativeMethod { - - public String foo() { - return ComponentWithInnerClasses.this.foo; - } - - public native void baz(); - - } - - public static class MyStaticInnerClass { - - public static String foo() { - return "foo"; - } - - public String bar() { - return "bar"; - } - - public native void baz(); - } - - private class MyInnerClass { - public String foo() { - return ComponentWithInnerClasses.this.foo; - } - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index fd0e6deffd..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { - return true; - } - - public double getDouble() { - return 1.0; - } - - public int getInt() { - return 1; - } - - public long getLong() { - return 1; - } - - public Boolean getObject() { - return new Boolean(true); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index 87b7304eb6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - private static FooProviderType1 singleton(BundleContext bc) { - if (singleton == null) { - count++; - singleton = new FooProviderType1(bc); - } - return singleton; - } - - public static FooProviderType1 several(BundleContext bc) { - count++; - return new FooProviderType1(bc); - } - - public FooProviderType1(BundleContext bc) { - if (bc == null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if (m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo" + a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch (RuntimeException e) { - - } - } - - public boolean getBoolean() { - return true; - } - - public double getDouble() { - return 1.0; - } - - public int getInt() { - return 1; - } - - public long getLong() { - return 1; - } - - public Boolean getObject() { - return new Boolean(true); - } - - /** - * Custom constructor. - * - * @param bar - * @param foo - * @param bc - */ - public FooProviderType1(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 779fdd6d8a..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if (strProp.equals("foo")) { - strProp = "bar"; - } else { - strProp = "foo"; - } - strAProp = new String[]{"foo", "bar", "baz"}; - intAProp = new int[]{3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { - return true; - } - - public double getDouble() { - return 1.0; - } - - public int getInt() { - return 1; - } - - public long getLong() { - return 1; - } - - public Boolean getObject() { - return new Boolean(true); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java deleted file mode 100644 index eada5a0aa6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; - - -public class Manipulation23Tester implements PrimitiveManipulationTestService { - - // Integer types - byte b = 1; - short s = 1; - int i = 1; - long l = 1; - - // Floatting types - double d = 1.1; - float f = 1.1f; - - // Character - char c = 'a'; - - // Boolean - boolean bool = false; - - // Integer arrays - byte[] bs = new byte[]{0, 1, 2}; - short[] ss = new short[]{0, 1, 2}; - int[] is = new int[]{0, 1, 2}; - long[] ls = new long[]{0, 1, 2}; - - double[] ds = new double[]{0.0, 1.1, 2.2}; - float[] fs = new float[]{0.0f, 1.1f, 2.2f}; - - char[] cs = new char[]{'a', 'b', 'c'}; - - boolean[] bools = new boolean[]{false, true, false}; - - public boolean getBoolean() { - return bool; - } - - public boolean[] getBooleans() { - return bools; - } - - public byte getByte() { - return b; - } - - public byte[] getBytes() { - return bs; - } - - public char getChar() { - return c; - } - - public char[] getChars() { - return cs; - } - - public double getDouble() { - return d; - } - - public double[] getDoubles() { - return ds; - } - - public float getFloat() { - return f; - } - - public float[] getFloats() { - return fs; - } - - public int getInt() { - return i; - } - - public int[] getInts() { - return is; - } - - public long getLong() { - return l; - } - - public long[] getLongs() { - return ls; - } - - public short getShort() { - return s; - } - - public short[] getShorts() { - return ss; - } - - public void setBoolean(boolean b) { - this.bool = b; - } - - public void setBooleans(boolean[] bs) { - this.bools = bs; - } - - public void setByte(byte b) { - this.b = b; - } - - public void setBytes(byte[] bs) { - this.bs = bs; - } - - public void setChar(char c) { - this.c = c; - } - - public void setChars(char[] cs) { - this.cs = cs; - } - - public void setDouble(double d) { - this.d = d; - } - - public void setDoubles(double[] ds) { - this.ds = ds; - } - - public void setFloat(float f) { - this.f = f; - } - - public void setFloats(float[] fs) { - this.fs = fs; - } - - public void setInt(int i) { - this.i = i; - } - - public void setInts(int[] is) { - this.is = is; - } - - public void setLong(long l) { - this.l = l; - } - - public void setLongs(long[] ls) { - this.ls = ls; - } - - public void setShort(short s) { - this.s = s; - } - - public void setShorts(short[] ss) { - this.ss = ss; - } - - // This method has been added to test an issue when autoboxing. - public void setLong(long l, String s) { - this.l = l; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java deleted file mode 100644 index 06ecb0635b..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Multiconstructor.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class Multiconstructor { - - public Multiconstructor(String s1, String s2) { - this(s1, s2, -1); - } - - public Multiconstructor(String s1, int s2) { - this(s1, "" + s2, s2); - } - - public Multiconstructor(String s1, String s2, int i) { - //... - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java deleted file mode 100644 index 5956b40147..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultipleCheckService.java +++ /dev/null @@ -1,159 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class MultipleCheckService implements CheckService { - - FooService fs[]; - - int simpleB = 0; - - int objectB = 0; - - int refB = 0; - - int bothB = 0; - - int simpleU = 0; - - int objectU = 0; - - int refU = 0; - - int bothU = 0; - - public boolean check() { - boolean r = fs.length != 0; - for (int i = 0; i < fs.length; i++) { - r = r & fs[i].foo(); - } - return r; - } - - private boolean getBoolean() { - return check(); - } - - private int getInt() { - int r = 0; - for (int i = 0; i < fs.length; i++) { - r = r + fs[i].getInt(); - } - return r; - } - - private long getLong() { - long r = 0; - for (int i = 0; i < fs.length; i++) { - r = r + fs[i].getLong(); - } - return r; - } - - private double getDouble() { - double r = 0.0; - for (int i = 0; i < fs.length; i++) { - r = r + fs[i].getInt(); - } - return r; - } - - protected Object doNothing(Object o, String s) { - return null; - } - - // private Object getObject() { - // boolean r = true; - // for(int i = 0; i < fs.length; i++) { - // r = r && ((Boolean) fs[i].getObject()).booleanValue(); - // } - // return new Boolean(r); - // } - - public Properties getProps() { - Properties props = new Properties(); - props.put("result", new Boolean(check())); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - props.put("boolean", new Boolean(getBoolean())); - props.put("int", new Integer(getInt())); - props.put("long", new Long(getLong())); - props.put("double", new Double(getDouble())); - - return props; - } - - public void voidBind() { - simpleB++; - } - - public void voidUnbind() { - simpleU++; - } - - public void objectBind(FooService o) { - if (o != null && o instanceof FooService) { - objectB++; - } - } - - public void objectUnbind(FooService o) { - if (o != null && o instanceof FooService) { - objectU++; - } - } - - public void refBind(ServiceReference sr) { - if (sr != null) { - refB++; - } - } - - public void refUnbind(ServiceReference sr) { - if (sr != null) { - refU++; - } - } - - public void bothBind(FooService o, ServiceReference sr) { - if (o != null && o instanceof FooService && sr != null) { - bothB++; - } - } - - public void bothUnbind(FooService o, ServiceReference sr) { - if (o != null && o instanceof FooService && sr != null) { - bothU++; - } - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java deleted file mode 100644 index 8e721bfea4..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Parent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class Parent { - - private String s; - - public Parent(String s) { - this.s = s; - } - - public String getS() { - return s; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index b8e2d62bbb..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 523ddf3ff6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 7792aaa52c..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 67c6d7a2d6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java deleted file mode 100644 index 88a147802b..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface Plop { - - Object getPlop(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java deleted file mode 100644 index 419962ef3f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface PrimitiveManipulationTestService { - - byte getByte(); - void setByte(byte b); - - short getShort(); - void setShort(short s); - - int getInt(); - void setInt(int i); - - long getLong(); - void setLong(long l); - - float getFloat(); - void setFloat(float f); - - double getDouble(); - void setDouble(double d); - - char getChar(); - void setChar(char c); - - boolean getBoolean(); - void setBoolean(boolean b); - - // Array types - byte[] getBytes(); - void setBytes(byte[] bs); - - short[] getShorts(); - void setShorts(short[] ss); - - int[] getInts(); - void setInts(int is[]); - - long[] getLongs(); - void setLongs(long[] ls); - - float[] getFloats(); - void setFloats(float[] fs); - - double[] getDoubles(); - void setDoubles(double[] ds); - - char[] getChars(); - void setChars(char[] cs); - - boolean[] getBooleans(); - void setBooleans(boolean[] bs); - - // This method has been added to test an issue when autoboxing. - void setLong(long l, String s); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml deleted file mode 100644 index 207d3148f9..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java deleted file mode 100644 index bdb314c66f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadata.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Assert; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.fail; - -/** - * Check manipulation metadata written in the manifest. - */ -public class TestManipulationMetadata extends BaseTest { - - @Test - public void testGetMetadata() { - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - - Element manip = getManipulationForComponent(elem, "ManipulationMetadata-FooProviderType-1"); - assertNotNull("Check manipulation metadata not null for " + "FooProviderType-1", manip); - } - - @Test - public void testInterface() { - String comp_name = "ManipulationMetadata-FooProviderType-1"; - Element manip = getManipulationForComponent(comp_name); - Element[] itf = manip.getElements("Interface"); - assertEquals("Check interfaces number", itf.length, 1); - assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName()); - } - - @Test - public void testInterfaces() { - String comp_name = "ManipulationMetadata-FooBarProviderType-1"; - Element manip = getManipulationForComponent(comp_name); - Element[] itf = manip.getElements("Interface"); - assertEquals("Check interfaces number", itf.length, 2); - assertEquals("Check itf name", itf[0].getAttribute("name"), FooService.class.getName()); - assertEquals("Check itf name", itf[1].getAttribute("name"), BarService.class.getName()); - } - - @Test - public void testFields() { - String comp_name = "ManipulationMetadata-FooProviderType-Dyn"; - Element manip = getManipulationForComponent(comp_name); - Element[] fields = manip.getElements("field"); - assertEquals("Check field count " + fields.length, fields.length, 5); - /* - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - */ - - Element field; - - field = getFieldFromName(manip, "intProp"); - assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intProp"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int"); - - field = getFieldFromName(manip, "strProp"); - assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strProp"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String"); - - field = getFieldFromName(manip, "strAProp"); - assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "strAProp"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "java.lang.String[]"); - - field = getFieldFromName(manip, "intAProp"); - assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "intAProp"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]"); - - field = getFieldFromName(manip, "boolProp"); - assertEquals("Check field name : " + field.getAttribute("name"), field.getAttribute("name"), "boolProp"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean"); - } - - @Test - public void testPrimitivesFields() { - String comp_name = "ManipulationMetadata-PrimitiveManipulationTester"; - Element manip = getManipulationForComponent(comp_name); - Element[] fields = manip.getElements("Field"); - assertEquals("Check field count", fields.length, 16); - /* - byte b = 1; - short s = 1; - int i = 1; - long l = 1; - double d = 1.1; - float f = 1.1f; - char c = 'a'; - boolean bool = false; - byte[] bs = new byte[] {0,1,2}; - short[] ss = new short[] {0,1,2}; - int[] is = new int[] {0,1,2}; - long[] ls = new long[] {0,1,2}; - double[] ds = new double[] {0.0, 1.1, 2.2}; - float[] fs = new float[] {0.0f, 1.1f, 2.2f}; - char[] cs = new char[] {'a', 'b', 'c'}; - boolean[] bools = new boolean[] {false, true, false}; - */ - Element field; - - field = getFieldFromName(manip, "b"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte"); - field = getFieldFromName(manip, "s"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short"); - field = getFieldFromName(manip, "i"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int"); - field = getFieldFromName(manip, "l"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long"); - field = getFieldFromName(manip, "d"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double"); - field = getFieldFromName(manip, "f"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float"); - field = getFieldFromName(manip, "c"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char"); - field = getFieldFromName(manip, "bool"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean"); - - field = getFieldFromName(manip, "bs"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "byte[]"); - field = getFieldFromName(manip, "ss"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "short[]"); - field = getFieldFromName(manip, "is"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "int[]"); - field = getFieldFromName(manip, "ls"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "long[]"); - field = getFieldFromName(manip, "ds"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "double[]"); - field = getFieldFromName(manip, "fs"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "float[]"); - field = getFieldFromName(manip, "cs"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "char[]"); - field = getFieldFromName(manip, "bools"); - assertEquals("Check field type : " + field.getAttribute("name"), field.getAttribute("type"), "boolean[]"); - } - - @Test - public void testNoArgMethod() { - String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider"; - Element manip = getManipulationForComponent(comp_name); - Element method = getMethodFromName(manip, "check"); - assertFalse("Check no args", method.containsAttribute("arguments")); - assertEquals("Check return", method.getAttribute("return"), "boolean"); - } - - @Test - public void testOneArgsMethod() { - String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider"; - Element manip = getManipulationForComponent(comp_name); - Element method = getMethodFromName(manip, "refBind"); - assertEquals("Check args", method.getAttribute("arguments"), "{org.osgi.framework.ServiceReference}"); - assertEquals("Check args count", 1, ParseUtils.parseArrays("{org.osgi.framework.ServiceReference}").length); - assertFalse("Check return", method.containsAttribute("return")); - } - - @Test - public void testTwoArgsMethod() { - String comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider"; - Element manip = getManipulationForComponent(comp_name); - Element method = getMethodFromName(manip, "doNothing"); - assertEquals("Check args", method.getAttribute("arguments"), "{java.lang.Object,java.lang.String}"); - assertEquals("Check args count", 2, ParseUtils.parseArrays("{java.lang.Object,java.lang.String}").length); - assertEquals("Check return", method.getAttribute("return"), "java.lang.Object"); - } - - @Test - public void testInnerClasses() { - String comp_name = "org.apache.felix.ipojo.runtime.core.components.ComponentWithInnerClasses"; - Element manipulation = getManipulationForComponent(comp_name); - Element[] inners = manipulation.getElements("inner"); - assertEquals(inners.length, 3); - - Element inner = getInnerClassMetadataByName(inners, "MyInnerWithANativeMethod"); - Assert.assertNotNull(inner); - Assert.assertNotNull(getMethodByName(inner.getElements("method"), "foo")); - - inner = getInnerClassMetadataByName(inners, "MyInnerClass"); - assertNotNull(inner); - assertNotNull(getMethodByName(inner.getElements("method"), "foo")); - - inner = getInnerClassMetadataByName(inners, "1"); - assertNotNull(inner); - assertNotNull(getMethodByName(inner.getElements("method"), "run")); - } - - private static Element getInnerClassMetadataByName(Element[] inners, String name) { - for (Element element : inners) { - if (name.equals(element.getAttribute("name"))) { - return element; - } - } - return null; - } - - private static Element getMethodByName(Element[] methods, String name) { - for (Element element : methods) { - if (name.equals(element.getAttribute("name"))) { - return element; - } - } - return null; - } - - - private Element getManipulationForComponent(Element metadata, String comp_name) { - Element[] comps = metadata.getElements("component"); - for (Element comp : comps) { - if (comp.containsAttribute("factory") && comp.getAttribute("factory").equals(comp_name)) { - return comp.getElements("manipulation")[0]; - } - if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) { - return comp.getElements("manipulation")[0]; - } - } - return null; - } - - private Element getManipulationForComponent(String comp_name) { - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - Element manip = getManipulationForComponent(elem, comp_name); - assertNotNull("Check manipulation metadata not null for " + comp_name, manip); - return manip; - } - - private Element getMethodFromName(Element manip, String name) { - Element methods[] = manip.getElements("Method"); - for (int i = 0; i < methods.length; i++) { - if (methods[i].containsAttribute("name") && methods[i].getAttribute("name").equals(name)) { - return methods[i]; - } - } - fail("Method " + name + " not found"); - return null; - } - - private Element getFieldFromName(Element manip, String name) { - Element fields[] = manip.getElements("Field"); - for (int i = 0; i < fields.length; i++) { - if (fields[i].containsAttribute("name") && fields[i].getAttribute("name").equals(name)) { - return fields[i]; - } - } - fail("Field " + name + " not found"); - return null; - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java deleted file mode 100644 index 21f3957220..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-metadata-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManipulationMetadataAPI.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.*; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.*; - -public class TestManipulationMetadataAPI extends BaseTest { - - PojoMetadata FooProviderType1, FooBarProviderType1, FooProviderTypeDyn, PrimitiveManipulationTester, SimpleMultipleCheckServiceProvider; - - @Before - public void setUp() { - String comp_name = "ManipulationMetadata-FooProviderType-1"; - FooProviderType1 = getManipulationMetadataForComponent(comp_name); - - comp_name = "ManipulationMetadata-FooBarProviderType-1"; - FooBarProviderType1 = getManipulationMetadataForComponent(comp_name); - - comp_name = "ManipulationMetadata-FooProviderType-Dyn"; - FooProviderTypeDyn = getManipulationMetadataForComponent(comp_name); - - comp_name = "ManipulationMetadata-PrimitiveManipulationTester"; - PrimitiveManipulationTester = getManipulationMetadataForComponent(comp_name); - - comp_name = "ManipulationMetadata-SimpleMultipleCheckServiceProvider"; - SimpleMultipleCheckServiceProvider = getManipulationMetadataForComponent(comp_name); - } - - @Test - public void testGetMetadata() { - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - Element manip = getMetadataForComponent(elem, "ManipulationMetadata-FooProviderType-1"); - assertNotNull("Check manipulation metadata not null for " + "Manipulation-FooProviderType-1", manip); - PojoMetadata mm; - try { - mm = new PojoMetadata(manip); - assertNotNull("Check mm not null", mm); - } catch (ConfigurationException e) { - fail("The creation of pojo metadata has failed"); - } - } - - @Test - public void testInterface() { - PojoMetadata manip = FooProviderType1; - - String[] itf = manip.getInterfaces(); - assertEquals("Check interfaces number", itf.length, 1); - assertEquals("Check itf name", itf[0], FooService.class.getName()); - - assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented(FooService.class.getName())); - assertFalse("Check Bar Service implementation", manip.isInterfaceImplemented(BarService.class.getName())); - } - - @Test - public void testInterfaces() { - PojoMetadata manip = FooBarProviderType1; - String[] itf = manip.getInterfaces(); - assertEquals("Check interfaces number", itf.length, 2); - assertEquals("Check itf name", itf[0], FooService.class.getName()); - assertEquals("Check itf name", itf[1], BarService.class.getName()); - - assertTrue("Check Foo Service implementation", manip.isInterfaceImplemented(FooService.class.getName())); - assertTrue("Check Bar Service implementation", manip.isInterfaceImplemented(BarService.class.getName())); - } - -// @Test -// public void testInnerClasses() { -// String comp_name = "org.apache.felix.ipojo.runtime.core.components.ComponentWithInnerClasses"; -// PojoMetadata metadata = getManipulationMetadataForComponent(comp_name); -// assertEquals(metadata.getInnerClasses().length, 3); -// assertNotNull(metadata.getMethodsFromInnerClass("MyInnerWithANativeMethod")); -// assertNotNull( -// getMethodMetadata(metadata.getMethodsFromInnerClass("MyInnerWithANativeMethod"), -// "foo")); -// -// assertNotNull( -// getMethodMetadata(metadata.getMethodsFromInnerClass("MyInnerClass"), -// "foo")); -// -// assertNotNull( -// getMethodMetadata(metadata.getMethodsFromInnerClass("1"), -// "run")); -// } - - public static MethodMetadata getMethodMetadata(MethodMetadata[] methods, String name) { - for (MethodMetadata m : methods) { - if (m.getMethodName().equals(name)) { - return m; - } - } - return null; - } - - @Test - public void testFields() { - PojoMetadata manip = FooProviderTypeDyn; - - FieldMetadata[] fields = manip.getFields(); - assertEquals("Check field count + " + fields.length, fields.length, 5); - /* - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - */ - - FieldMetadata field; - - field = manip.getField("intProp"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int"); - assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "int"); - - field = manip.getField("intProp", "int"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int"); - - field = manip.getField("intProp", "long"); - assertNull("Check bad field", field); - - field = manip.getField("strProp"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String"); - assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "java.lang.String"); - - field = manip.getField("strProp", "String"); - assertNull("Check bad field", field); - - field = manip.getField("strProp", "java.lang.String"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String"); - - field = manip.getField("strAProp"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]"); - assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[Ljava.lang.String;"); - - field = manip.getField("strAProp", "java.lang.String[]"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "strAProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "java.lang.String[]"); - - field = manip.getField("strAProp", "String[]"); - assertNull("Check bad field", field); - - field = manip.getField("intAProp"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]"); - assertEquals("Check field reflective type : " + field.getFieldName() + " -> " + FieldMetadata.getReflectionType(field.getFieldType()), FieldMetadata.getReflectionType(field.getFieldType()), "[I"); - - field = manip.getField("intAProp", "int[]"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "intAProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]"); - - field = manip.getField("intAProp", "String[]"); - assertNull("Check bad field", field); - - field = manip.getField("boolProp"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean"); - assertEquals("Check field reflective type : " + field.getFieldName(), FieldMetadata.getReflectionType(field.getFieldType()), "boolean"); - - field = manip.getField("boolProp", "boolean"); - assertEquals("Check field name : " + field.getFieldName(), field.getFieldName(), "boolProp"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean"); - - field = manip.getField("boolProp", "bool"); - assertNull("Check bad field", field); - } - - @Test - public void testPrimitivesFields() { - PojoMetadata manip = PrimitiveManipulationTester; - FieldMetadata[] fields = manip.getFields(); - assertEquals("Check field count", fields.length, 16); - - FieldMetadata field; - - field = manip.getField("b"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte"); - field = manip.getField("s"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short"); - field = manip.getField("i"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int"); - field = manip.getField("l"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long"); - field = manip.getField("d"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double"); - field = manip.getField("f"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float"); - field = manip.getField("c"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char"); - field = manip.getField("bool"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean"); - - field = manip.getField("bs"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "byte[]"); - field = manip.getField("ss"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "short[]"); - field = manip.getField("is"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "int[]"); - field = manip.getField("ls"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "long[]"); - field = manip.getField("ds"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "double[]"); - field = manip.getField("fs"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "float[]"); - field = manip.getField("cs"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "char[]"); - field = manip.getField("bools"); - assertEquals("Check field type : " + field.getFieldName(), field.getFieldType(), "boolean[]"); - } - - @Test - public void testNoArgMethod() { - PojoMetadata manip = SimpleMultipleCheckServiceProvider; - MethodMetadata method = manip.getMethod("check"); - assertEquals("Check no args", method.getMethodArguments().length, 0); - assertEquals("Check return", method.getMethodReturn(), "boolean"); - - method = manip.getMethod("check", new String[0]); - assertEquals("Check no args", method.getMethodArguments().length, 0); - assertEquals("Check return", method.getMethodReturn(), "boolean"); - } - - @Test - public void testOneArgsMethod() { - PojoMetadata manip = SimpleMultipleCheckServiceProvider; - MethodMetadata method = manip.getMethods("refBind")[0]; - assertEquals("Check args count", method.getMethodArguments().length, 1); - assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference"); - assertEquals("Check return", method.getMethodReturn(), "void"); - - method = manip.getMethod("refBind", new String[]{"org.osgi.framework.ServiceReference"}); - assertEquals("Check args count", method.getMethodArguments().length, 1); - assertEquals("Check args", method.getMethodArguments()[0], "org.osgi.framework.ServiceReference"); - assertEquals("Check return", method.getMethodReturn(), "void"); - } - - @Test - public void testTwoArgsMethod() { - PojoMetadata manip = SimpleMultipleCheckServiceProvider; - MethodMetadata method = manip.getMethods("doNothing")[0]; - assertEquals("Check args count", 2, method.getMethodArguments().length); - assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object"); - assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String"); - assertEquals("Check return", method.getMethodReturn(), "java.lang.Object"); - - method = manip.getMethod("doNothing", new String[]{"java.lang.Object", "java.lang.String"}); - assertEquals("Check args count", 2, method.getMethodArguments().length); - assertEquals("Check args - 1", method.getMethodArguments()[0], "java.lang.Object"); - assertEquals("Check args - 2", method.getMethodArguments()[1], "java.lang.String"); - assertEquals("Check return", method.getMethodReturn(), "java.lang.Object"); - } - - private Element getMetadataForComponent(Element metadata, String comp_name) { - Element[] comps = metadata.getElements("component"); - for (int i = 0; i < comps.length; i++) { - if (comps[i].containsAttribute("factory") && comps[i].getAttribute("factory").equals(comp_name)) { - return comps[i]; - } - if (comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) { - return comps[i]; - } - } - return null; - } - - private PojoMetadata getManipulationMetadataForComponent(String comp_name) { - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - Element manip = getMetadataForComponent(elem, comp_name); - assertNotNull("Check manipulation metadata not null for " + comp_name, manip); - try { - return new PojoMetadata(manip); - } catch (ConfigurationException e) { - fail("The creation of pojo metadata for " + comp_name + " has failed"); - return null; - } - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml deleted file mode 100644 index 2745607012..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator.manipulator-it - 1.13.1-SNAPSHOT - - - 4.0.0 - - ipojo-manipulator-manipulation-test - - Apache Felix iPOJO Manipulator ~ Manipulation IT - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java deleted file mode 100644 index 86e52b7bea..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/A123/Manipulation23Tester.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.A123; - -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; - - -public class Manipulation23Tester implements PrimitiveManipulationTestService { - - - // Integer types - byte b = 1; - short s = 1; - int i = 1; - long l = 1; - - // Floatting types - double d = 1.1; - float f = 1.1f; - - // Character - char c = 'a'; - - // Boolean - boolean bool = false; - - // Integer arrays - byte[] bs = new byte[]{0, 1, 2}; - short[] ss = new short[]{0, 1, 2}; - int[] is = new int[]{0, 1, 2}; - long[] ls = new long[]{0, 1, 2}; - - double[] ds = new double[]{0.0, 1.1, 2.2}; - float[] fs = new float[]{0.0f, 1.1f, 2.2f}; - - char[] cs = new char[]{'a', 'b', 'c'}; - - boolean[] bools = new boolean[]{false, true, false}; - - public boolean getBoolean() { - return bool; - } - - public boolean[] getBooleans() { - return bools; - } - - public byte getByte() { - return b; - } - - public byte[] getBytes() { - return bs; - } - - public char getChar() { - return c; - } - - public char[] getChars() { - return cs; - } - - public double getDouble() { - return d; - } - - public double[] getDoubles() { - return ds; - } - - public float getFloat() { - return f; - } - - public float[] getFloats() { - return fs; - } - - public int getInt() { - return i; - } - - public int[] getInts() { - return is; - } - - public long getLong() { - return l; - } - - public long[] getLongs() { - return ls; - } - - public short getShort() { - return s; - } - - public short[] getShorts() { - return ss; - } - - public void setBoolean(boolean b) { - this.bool = b; - } - - public void setBooleans(boolean[] bs) { - this.bools = bs; - } - - public void setByte(byte b) { - this.b = b; - } - - public void setBytes(byte[] bs) { - this.bs = bs; - } - - public void setChar(char c) { - this.c = c; - } - - public void setChars(char[] cs) { - this.cs = cs; - } - - public void setDouble(double d) { - this.d = d; - } - - public void setDoubles(double[] ds) { - this.ds = ds; - } - - public void setFloat(float f) { - this.f = f; - } - - public void setFloats(float[] fs) { - this.fs = fs; - } - - public void setInt(int i) { - this.i = i; - } - - public void setInts(int[] is) { - this.is = is; - } - - public void setLong(long l) { - this.l = l; - } - - public void setLongs(long[] ls) { - this.ls = ls; - } - - public void setShort(short s) { - this.s = s; - } - - public void setShorts(short[] ss) { - this.ss = ss; - } - - public void setLong(long l, String s) { - this.l = l; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java deleted file mode 100644 index e31d52d26d..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Annotation.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -public class Annotation { - - @Marker(name = "marker", type = Marker.Type.BAR, - sub = @SubMarker(subname = "foo"), - arrayOfObjects = {"foo", "bar", "baz"}, - arrayOfAnnotations = {@SubMarker(subname = "foo")} - ) - @SubMarker(subname = "bar") - @Invisible - public void doSomething() { - System.out.println("Foo ..."); - } - - @Marker(name = "marker", type = Marker.Type.BAR, - sub = @SubMarker(subname = "foo"), - arrayOfObjects = {"foo", "bar", "baz"}, - arrayOfAnnotations = {@SubMarker(subname = "foo")} - ) - @SubMarker(subname = "bar") - @Invisible - public Annotation() { - - } - - public void doSomethingWithParams(@Marker(name = "marker", type = Marker.Type.BAR, - sub = @SubMarker(subname = "foo"), - arrayOfObjects = {"foo", "bar", "baz"}, - arrayOfAnnotations = {@SubMarker(subname = "foo")}) String foo, - @Invisible String bar, - @bla @SubMarker(subname = "baz") String baz) { - System.out.println("Foo ..."); - } - - @Retention(RetentionPolicy.RUNTIME) - @interface bla { - - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index 87b7304eb6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - private static FooProviderType1 singleton(BundleContext bc) { - if (singleton == null) { - count++; - singleton = new FooProviderType1(bc); - } - return singleton; - } - - public static FooProviderType1 several(BundleContext bc) { - count++; - return new FooProviderType1(bc); - } - - public FooProviderType1(BundleContext bc) { - if (bc == null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if (m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo" + a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch (RuntimeException e) { - - } - } - - public boolean getBoolean() { - return true; - } - - public double getDouble() { - return 1.0; - } - - public int getInt() { - return 1; - } - - public long getLong() { - return 1; - } - - public Boolean getObject() { - return new Boolean(true); - } - - /** - * Custom constructor. - * - * @param bar - * @param foo - * @param bc - */ - public FooProviderType1(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java deleted file mode 100644 index b3ae226769..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooServiceImpl.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooServiceImpl implements FooService { - - public boolean foo() { - // TODO Auto-generated method stub - return false; - } - - public Properties fooProps() { - // TODO Auto-generated method stub - return null; - } - - public boolean getBoolean() { - // TODO Auto-generated method stub - return false; - } - - public double getDouble() { - // TODO Auto-generated method stub - return 0; - } - - public int getInt() { - // TODO Auto-generated method stub - return 0; - } - - public long getLong() { - // TODO Auto-generated method stub - return 0; - } - - public Boolean getObject() { - // TODO Auto-generated method stub - return null; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java deleted file mode 100644 index 85e7c7b8cc..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/HandlerBindingTestComponent.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.handlers.Foo; -import org.apache.felix.ipojo.runtime.core.handlers.IgnoredFoo; -import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService; - -/** - * User: guillaume - * Date: 24/07/13 - * Time: 12:31 - */ -@Component -@Provides -@Instantiate -public class HandlerBindingTestComponent implements HandlerBindingTestService { - - @Foo("Bonjour") - private String greeting; - - @Foo("Welcome") - private String welcome; - - @IgnoredFoo("Ignored") - private String ignored; - - @Override - public String get(final String name) { - if ("greeting".equals(name)) { - return greeting; - } - if ("welcome".equals(name)) { - return welcome; - } - if ("ignored".equals(name)) { - return ignored; - } - throw new IllegalArgumentException(name + " is not valid"); - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java deleted file mode 100644 index 23ad270191..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateComponent.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.Stereotype; - -/** - * User: guillaume - * Date: 03/06/13 - * Time: 11:55 - */ -@Component -@Instantiate -@Provides -@Stereotype -@Target(ElementType.TYPE) -public @interface ImmediateComponent {} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java deleted file mode 100644 index e98f457112..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/InnerClasses.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.Job; - -import java.util.HashMap; -import java.util.Map; -import java.util.Properties; -import java.util.concurrent.Callable; - -public class InnerClasses implements CheckService { - - private String privateObject; - private int privateInt; - - protected String protectedObject; - protected int protectedInt; - - String packageObject; - int packageInt; - - public String publicObject; - public int publicInt; - - private String nonObject = "not-managed"; - private int nonInt = 5; - - private static int staticint = 6; - - /** - * A fake service. - */ - private Runnable runnable; - - public boolean check() { - return true; - } - - private static final Callable callable = new Callable() { - public Integer call() { - return 1; - } - }; - - public Properties getProps() { - Properties props = new Properties(); - props.put("publicInner", new PublicNested().doSomething()); - props.put("packageInner", new PackageNested().doSomething()); - props.put("protectedInner", new ProtectedNested().doSomething()); - props.put("privateInner", new PrivateNested().doSomething()); - props.put("constructorInner", new ConstructorNested().doSomething()); - props.put("staticInner", new StaticNested().doSomething()); - props.put("packageStaticInner", new PackageStaticNested().doSomething()); - try { - props.put("call", callable.call()); - } catch (Exception e) { - // Ignore. - } - - Job anonymous = new Job() { - public Map doSomething() { - Map map = new HashMap(); - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - return map; - } - }; - - props.put("anonymous", anonymous.doSomething()); - props.put("public", new PublicNested()); - - - return props; - } - - private class PrivateNested implements Job { - public Map doSomething() { - Map map = new HashMap(); - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - return map; - } - } - - public class PublicNested implements Job { - public Map doSomething() { - Map map = new HashMap(); - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - return map; - } - } - - class PackageNested implements Job { - public Map doSomething() { - Map map = new HashMap(); - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - return map; - } - } - - protected class ProtectedNested implements Job { - public Map doSomething() { - Map map = new HashMap(); - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - return map; - } - } - - protected static class StaticNested implements Job { - private Map map = new HashMap(); - - public Map doSomething() { - map.put("static", new Boolean(true)); - map.put("staticint", new Integer(staticint)); - return map; - } - } - - static class PackageStaticNested implements Job { - private Map map = new HashMap(); - - public Map doSomething() { - map.put("static", new Boolean(true)); - map.put("staticint", new Integer(staticint)); - return map; - } - } - - protected class ConstructorNested implements Job { - Map map = new HashMap(); - public ConstructorNested() { - map.put("publicObject", publicObject); - map.put("publicInt", new Integer(publicInt)); - map.put("packageObject", packageObject); - map.put("packageInt", new Integer(packageInt)); - map.put("protectedObject", protectedObject); - map.put("protectedInt", new Integer(protectedInt)); - map.put("privateObject", privateObject); - map.put("privateInt", new Integer(privateInt)); - map.put("nonObject", nonObject); - map.put("nonInt", new Integer(nonInt)); - } - - public Map doSomething() { - return map; - } - } - - -} - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java deleted file mode 100644 index ca9808dd39..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Invisible.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public @interface Invisible { - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java deleted file mode 100644 index abaf536ac7..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Manipulation23Tester.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; - - -public class Manipulation23Tester implements PrimitiveManipulationTestService { - - // Integer types - byte b = 1; - short s = 1; - int i = 1; - long l = 1; - - // Floatting types - double d = 1.1; - float f = 1.1f; - - // Character - char c = 'a'; - - // Boolean - boolean bool = false; - - // Integer arrays - byte[] bs = new byte[] {0,1,2}; - short[] ss = new short[] {0,1,2}; - int[] is = new int[] {0,1,2}; - long[] ls = new long[] {0,1,2}; - - double[] ds = new double[] {0.0, 1.1, 2.2}; - float[] fs = new float[] {0.0f, 1.1f, 2.2f}; - - char[] cs = new char[] {'a', 'b', 'c'}; - - boolean[] bools = new boolean[] {false, true, false}; - - public boolean getBoolean() { return bool; } - - public boolean[] getBooleans() { return bools; } - - public byte getByte() { return b; } - - public byte[] getBytes() { return bs; } - - public char getChar() { return c; } - - public char[] getChars() { return cs; } - - public double getDouble() { return d; } - - public double[] getDoubles() { return ds; } - - public float getFloat() { return f; } - - public float[] getFloats() { return fs; } - - public int getInt() { return i; } - - public int[] getInts() { return is; } - - public long getLong() { return l; } - - public long[] getLongs() { return ls; } - - public short getShort() { return s; } - - public short[] getShorts() { return ss; } - - public void setBoolean(boolean b) { this.bool = b; } - - public void setBooleans(boolean[] bs) { this.bools = bs; } - - public void setByte(byte b) { this.b = b; } - - public void setBytes(byte[] bs) { this.bs = bs; } - - public void setChar(char c) { this.c = c; } - - public void setChars(char[] cs) { this.cs = cs; } - - public void setDouble(double d) { this.d = d; } - - public void setDoubles(double[] ds) { this.ds = ds; } - - public void setFloat(float f) { this.f = f; } - - public void setFloats(float[] fs) { this.fs = fs; } - - public void setInt(int i) { this.i = i; } - - public void setInts(int[] is) { this.is = is; } - - public void setLong(long l) { this.l = l; } - - public void setLongs(long[] ls) { this.ls = ls; } - - public void setShort(short s) { this.s = s; } - - public void setShorts(short[] ss) { - this.ss = new short[ss.length]; - for (int i = 0; i < ss.length; i++) { - this.ss[i] = ss[i]; - } - } - - // This method has been added to test an issue when autoboxing. - public void setLong(long l, String s) { - this.l = l; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java deleted file mode 100644 index c5f6e31247..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Marker.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface Marker { - - String name(); - - String[] arrayOfObjects(); - - SubMarker sub(); - - SubMarker[] arrayOfAnnotations(); - - Type type(); - - public enum Type {FOO, BAR, BAZ}; - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java deleted file mode 100644 index c28d716135..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MultiBind.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Stereotype; - -/** - * User: guillaume - * Date: 03/06/13 - * Time: 16:09 - */ -@Bind( - aggregate = true, - optional = false -) -@Stereotype -@Target(ElementType.METHOD) -public @interface MultiBind {} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java deleted file mode 100644 index 32e9629820..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PlopImpl.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Plop; - -//TODO this test requires source compatibility 1.5 -public class PlopImpl implements Plop { - - public String getPlop() { - return "plop"; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java deleted file mode 100644 index 83fd0cd901..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedBazComponent.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; - -/** - * User: guillaume - * Date: 03/06/13 - * Time: 12:22 - */ -@ImmediateComponent -public class StereotypedBazComponent implements BazService { - @Override - public String hello(final String name) { - return "Hello " + name; - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java deleted file mode 100644 index 650d63bc6a..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/StereotypedMultiBind.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.architecture.Architecture; - -/** - * User: guillaume - * Date: 03/06/13 - * Time: 12:22 - */ -@Component -public class StereotypedMultiBind { - - @MultiBind - public void bindArchitecture(Architecture service) { - - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java deleted file mode 100644 index 89787f30b3..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SubMarker.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; - -@Retention(RetentionPolicy.RUNTIME) -public @interface SubMarker { - - String subname(); - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java deleted file mode 100644 index a0787e5214..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Switches.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.Color; - -import java.util.Properties; - -/** - * A component checking switch construct with integer and enumeration. - */ -public class Switches implements CheckService { - - private static enum Stuff { - FOO, - BAR - } - - private String switchOnInteger(int i) { - switch (i) { - case 0: - return "0"; - case 1: - return "1"; - case 2: - return "2"; - default: - return "3"; - } - } - - private String switchOnEnum(Color color) { - switch (color) { - case RED: - return "RED"; - case GREEN: - return "GREEN"; - case BLUE: - return "BLUE"; - default: - return "COLOR"; - } - } - - private String switchOnStuff(Stuff stuff) { - switch (stuff) { - case FOO : return "foo"; - case BAR : return "bar"; - default: return ""; - } - } - - @Override - public boolean check() { - return true; - } - - @Override - public Properties getProps() { - Properties properties = new Properties(); - properties.put("switchOnInteger1", switchOnInteger(1)); - properties.put("switchOnInteger4", switchOnInteger(4)); - - properties.put("switchOnEnumRed", switchOnEnum(Color.RED)); - - properties.put("switchOnStuffFoo", switchOnStuff(Stuff.FOO)); - - return properties; - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java deleted file mode 100644 index ad27a985af..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TestTypedList.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.List; -import java.util.Properties; - -public class TestTypedList implements CheckService { - - private List list; - - public boolean check() { - return !list.isEmpty(); - } - - public Properties getProps() { - Properties props = new Properties(); - if (list != null) { - props.put("list", list); - - int i = 0; - for (FooService fs : list) { - props.put(i, fs.foo()); - i++; - } - } - - return props; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java deleted file mode 100644 index 3971ac20f8..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/nativ/NativeComponent.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.nativ; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.BazService; - -/** - * Component using a native method. - */ -@Component -@Provides -public class NativeComponent implements BazService { - - static { - System.loadLibrary("foo"); - } - - /** - * Provided by the native library. - * @return foo: Test program of JNI. - */ - public native String nativeFoo(); - - @Override - public String hello(String name) { - return nativeFoo(); - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java deleted file mode 100644 index 79e93d7a31..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/Foo.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.handlers; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.HandlerBinding; - -/** - * User: guillaume - * Date: 24/07/13 - * Time: 12:10 - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.CLASS) -@HandlerBinding("com.acme:foo") -public @interface Foo { - String value(); -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java deleted file mode 100644 index cc86c67fe9..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/FooHandler.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.runtime.core.handlers; - -import java.util.Dictionary; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.FieldInterceptor; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.annotations.Handler; -import org.apache.felix.ipojo.metadata.Element; - -/** - * User: guillaume - * Date: 24/07/13 - * Time: 12:08 - */ -@Handler(namespace = "com.acme", name = "foo") -public class FooHandler extends PrimitiveHandler { - - @Override - public void configure(final Element metadata, final Dictionary configuration) throws ConfigurationException { - Element[] elements = metadata.getElements("foo", "com.acme"); - for (Element foo : elements) { - String value = foo.getAttribute("value"); - String field = foo.getAttribute("field"); - - this.getInstanceManager().register(getPojoMetadata().getField(field, "java.lang.String"), - new FixedValueFieldInterceptor(value)); - - } - - } - - @Override - public Object onGet(final Object pojo, final String fieldName, final Object value) { - return value; - } - - @Override - public void stop() { - //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public void start() { - //To change body of implemented methods use File | Settings | File Templates. - } - - private static class FixedValueFieldInterceptor implements FieldInterceptor { - private final String m_value; - - public FixedValueFieldInterceptor(final String value) { - m_value = value; - } - - @Override - public void onSet(final Object pojo, final String fieldName, final Object value) { - //To change body of implemented methods use File | Settings | File Templates. - } - - @Override - public Object onGet(final Object pojo, final String fieldName, final Object value) { - return m_value; - } - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java deleted file mode 100644 index ccbff86ed0..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/handlers/IgnoredFoo.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.handlers; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.HandlerBinding; -import org.apache.felix.ipojo.annotations.Ignore; - -/** - * User: guillaume - * Date: 24/07/13 - * Time: 12:10 - */ -@Target(ElementType.FIELD) -@Retention(RetentionPolicy.CLASS) -@Ignore -public @interface IgnoredFoo { - String value(); -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index b8e2d62bbb..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 523ddf3ff6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java deleted file mode 100644 index f2d7c6e730..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -/** - * User: guillaume - * Date: 03/06/13 - * Time: 12:23 - */ -public interface BazService { - String hello(String name); -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 7792aaa52c..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java deleted file mode 100644 index 086b365b91..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Color.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -/** - * An enumeration. - */ -public enum Color { - - RED, - GREEN, - BLUE -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 67c6d7a2d6..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java deleted file mode 100644 index 120d60b400..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/HandlerBindingTestService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -/** - * User: guillaume - * Date: 24/07/13 - * Time: 12:36 - */ -public interface HandlerBindingTestService { - String get(String name); -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java deleted file mode 100644 index fdc4b744f8..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Job.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Map; - -/** - * - */ -public interface Job { - public Map doSomething(); -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java deleted file mode 100644 index 88a147802b..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Plop.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface Plop { - - Object getPlop(); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java deleted file mode 100644 index 419962ef3f..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/PrimitiveManipulationTestService.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface PrimitiveManipulationTestService { - - byte getByte(); - void setByte(byte b); - - short getShort(); - void setShort(short s); - - int getInt(); - void setInt(int i); - - long getLong(); - void setLong(long l); - - float getFloat(); - void setFloat(float f); - - double getDouble(); - void setDouble(double d); - - char getChar(); - void setChar(char c); - - boolean getBoolean(); - void setBoolean(boolean b); - - // Array types - byte[] getBytes(); - void setBytes(byte[] bs); - - short[] getShorts(); - void setShorts(short[] ss); - - int[] getInts(); - void setInts(int is[]); - - long[] getLongs(); - void setLongs(long[] ls); - - float[] getFloats(); - void setFloats(float[] fs); - - double[] getDoubles(); - void setDoubles(double[] ds); - - char[] getChars(); - void setChars(char[] cs); - - boolean[] getBooleans(); - void setBooleans(boolean[] bs); - - // This method has been added to test an issue when autoboxing. - void setLong(long l, String s); - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux32/libfoo.so deleted file mode 100644 index e574158167c56ead47b2da740fcf09ae0dabc604..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 7011 zcmeHMU2I%O6`u8Ok}Yv5tlr<3_2~M#6vV)RyA}XH8lnbh+NWYj3l= z*WJDA+9iQFt3uqxk|9r2RfPyhARdTBANUhWv?-wys@xXTJ`~9mh1!ZmUCAH=ZI|zx z*>SGZ1R){be5|u)zBy;k%$+%N@67SnqWwLAKtN~;il88x4GFOi^1vsRW}h&`7ICj= z7I#R!wx^umtauYagHZZmHz)@=pf4(^QpVd)ot{`SeQeD%2>z4g@N%|D-czwX)_ z@6|!IjyQHr1`2~3K<);=;=_$7bBvk{6y`L5q~7*n1Ld|G@SlJUDnJe5(_#fOVh|B; z7X`=*Sj`$m{moxx}J@lLcxNx50xDEt~{Uqo@_avPLp)*2;T!&a*6GrLrkc zSV;(B^~Mfa2`A@_r1GAViyi7pyICh@52qcaySc`SPuO%|r&G_suy5QNta|85+xfhc z7k&1)ZMnG-%O11iqmGqy(y0k6HRe9)TDd~jOJy7@?&kQD8AF#@FK=aSFEwrr@Ym_m z)vDI%ab1zI(`h#@GEOG%cp{w|j+=Sc+%GIAVS6?nb2y(@Pl>8*LLBVx?d-Bz&6c&& zUh^R}FEuh^7*Sk5|6h%G6Lp+ZQbQ_*&otkEhZ*5(7sE!c0c-vWIDC5F>P3A-JXSo5RBr7+i99G@z`yHki#aivnJ zJbTgGw9tXt;^px1GS!+YKV=|P&T~wp%6Y867-eyB9xW^9`4pp6FV0EaM9j*?ixTf3 z=Fj2<;GyZOM;99LAXDWLbYEO*nkn85<;*z)zxT}*S2sVsxp=wh_?OD1;u0EQXv@=0 zk;>e)#TjppknLZG=~Ve1-JUIV`%9}e)0ZwS?h5?&wbg=lRQiC9UV)?TNQll}yLNTv zr9Eh-{GCBzs{H1iay+MhX;4v!l#0u$|GH9DzoGn<&V}jbb#Gg#xT+j(oso6&v80E^&p=UXj+AHle8r{6!h5KgDtE)h zmFO}ZUkOF-f>F6@N6fZ|G zqi>+s#0=~VKFY;~V=@0>rNVE@5sdwDNJauF@XVkHoD2tc)`mi7vGfM&IHBK%{Sin} z7w)O6?W^DFg(k%3?tJwA*2r!H)$QPAJO$rVqN6VSY)$9wo4Sj^8n4{(GJLUmgEnSh zV+J;6U}FY0W?*9mHfG?)85qNv*8r1n^pIz9o?v;u;T?|m8XR-vxf|z6c{jwNOP;^= zo%3%WRopf-rkfZJI=l*bz@LDuhva>b2VNYv<>7{BAp^|w53kqT!OKvxd;yYoxOVWT zz&tqPh~u6{J&sK-+zA{z-30JIAtC-J;{99G7x2tU@HqJEVBRebc6B{s+&eUk8&u)5 z{kVYTTw|a4u-W=xYe81-y-#5w%=~1=vxgzQoRXuulyyDF9LW~U;X*2%crcX^5{=sV zQDG(~vuLTLms6T?CznsT*>%8zF6X3auL@&nPnhyZE452Br_g0 z>EdIkU~JKjaYbfq>wZ~J9s)BKS!O(vTTu4*3n&s`Tv}xt#xuDc7(x>58P^%GwqyL0 z4b;(&dq>-iqs*~#UvXcOBPeU49qB2swrfWvS>7L{R_#IBp7hzxqJsQgJsHq(?nr0A z+8^HoUlJ>NH!)GT904xCGPZMp(Z-cczzMGn1$9he={0=JEKcB-ez_+k_7kc_@ z0h4HVzbeXK>d1UA%Q=>{LiE9Ixmu>64T+L5py>q!%Pbml|33ic_|R0wyx-pg_`p2u zYpDIf^kc;L2T5gV)jL9A<$&)3g;fvS^9rlk;oeqQee_PRVXmm!t4hx|mfDjFb4D@# z>Ldr{Q>Z13Yo)In31evU10+i3?dVT_!pML@C^FjcplMp)O z_({|^Z~z7o@iwuCxJm|OC$PZ+hMTM__;6doT8mj(6s{MLg%_y+Sf+#*zE&>l(EBdymGD;J%*E zw!DlLXGS|ObRyeVWmyT=8cDmucG^mKZZ2=xg$cogblUNpgt`BrwpMt)iIGg6tAh$M z&0cO&sH07ykjYG^Ky)q66K`$;gFHo??<_Y(shhkCnEi;Mb+(Z}MLPIXJyC>;C!h|M>rb`p3t= E0c;{wyZ`_I diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/linux64/libfoo.so deleted file mode 100644 index df86ae3262d2ff8663f7f5f7fe090f60af25f86e..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6629 zcmcgweQX?85r5~i9g`2+Nomq1fvlng(uf?PX+xS4dbV@U+SqAuZ8e}qd+WQk@2b07 zbGMh+C2fOJkX@Lp_OB{@M6ziGPWf^xkz?lV z{OsNJIYLMt;do%OizTKI3ZyrzebvMLf3KUmgR4gT%eIzLzPp^{(v7|brn(4k> z-L7?;mb+H8j<)y^xKf4&cnluGlzy|t$H9{gT1}b4VaFodrNu5ScHlGeDBz-|8p(#Q zi_#zEyQq%|oOPK_T=TNro>`;C6@0r7(^~ihyDyWSETQz=oCW9kaZ-)bb?o?%>UnAJ zKVSX+{wrI4^1_#fpW8R_QRWlj_M#$+2~>*;Ext26c1`>*`rsk2{y z?8z72`P#|tKfQ3h^}XNzg}ZJ_aq|4j$V=ttGwN8)61J%h&hs+r;8zH%r*E&Ke`pna zfbgAkMd^10w5#j2$+bqP>u-WzjNnzmH>q{XkoS95tmZ^N>Ze`nuUwza8egxT5kKNa zDa#ryx+SaP*=5hNl$9^#J!Op$Q&!Jlzm;{$&S<{kIpx9ru7X=~2JPX3nEBRvb?i^23=##Z4SkmXozTn;vtx zQt_XXpi)*H>+9+4vhGaWnYbHk!LjRya|3<1%RlaC>22b?zD(7vdHR$a)Q7%EdBV^w z#L0pL*NF)JqTuJ`JwqR|Avmk~bMXh*6TlI}+_OJ`2jlrr01v+MWB|w5>?bWa>vHUZ zasfOz?pOd1hT?bt5BfLHzu#g`Hw`r!%KYYx*EDy4MljF+qU91s@_FsOJ-{-D@BFNmds*hCnxD~fC(HZ@^DmNYUT882FfSZAOl-)!W6_+t zW}aVcJ=1XN5>4o5aeqP|oT^>r@koE8ufH~+|Jq{QoO<1S?N9fau~~EK4fD+#Rc(Lk zx3&FmJhJ~i+n+n~CLyZ&Y4iM%$GJ5`<9X}N=_5ZTY3>wFX)Z^%Q*SgqPeAOimqwTp zZ9ATzDf5yXNyiMOyd5;T&yohO)-6Lc|6YR0S8evx{Db6Ret>QlFS2`DTf>}sbk3Zr zUNtYL78TLYKS{T_cW=-NOr;jg^N%j5YO^_=T72&q-4|Zr?pImSoVq;sT~@o$#DSo- zr&Dw0v@)m99cm(Ex_`l(9wP6*HmBaM(c`BU+0m6t`knGC9C6*l#-LO2jIpviTDFUZ zJ7V-6?@3VHY>VH^xw(O^{WJ{c%QVeAO`M7M5~kQA11dJ&9^1BlO$+aRy9i^ug@4s* zCs?7iy}R|c-nMmTTF$Baw%)tDM%?rKn9%?C8#R~Zmt|mDU`=TWI>hjz z^sklvCXv^Pe4B8@swr{D>&%qa_vQ6P4%i}iP6h`4yaYGqIU{#(uss56|mOU7M^&nFJ- zyXy|Wp;V$WQS|I#;$GS3IkZZy=Oji;)x>Z$U&!vuXO)(6b|t40*@+Ta`rIq~J*S;= zCGVC(f<=90r(m;zw8jdaO6a{h;W^{f);o5h?CRYv;pD6libKcBWyuzjZ(-TxvOVEj zp#5-$)X2MC%x7q5mmJb9p-1sO()Otmv>z8~H;yjie<5?+@VAHWb+!Mya4nw`L`A7Z z{e!+O*dw06zaX0U?(kj10p}r(CD!_+t_K zq)Y_-p~wq^9b7&UvB&>vaO6$sN9X^f*yH{EKoT){^!X#xQBOteqvt>DJFAWVY{dSm zj1QiLp>VuEz(1r0AJp)DU_ZopIjSF(Un1MKfIarh6QUT^kIJu;Ew2g2KPmsSPyUDY zm&ul2Iqb1Nq{V(l798&lFo;eC(f1Kwx$(uL|SEV@37W-LH zDNZxS{uIXJ3j0nNZ&c|zlZ>k-g?%Ed->i`T!}yw|{2s3r(wHjJGM|r7+&UbnXu08x`_N7~iCjC&KtGRIf9FkZ#B6 zbb`1JcE;7M3h^4oH!H+p7~i50Utt_y<1)(MStHelmJz?j=aLvzf}->1^GJhQx&HkB zi19IOu)Z7BA$as0^dR9ewLDLJ?;{#txtiUG*7 zvaU5+aEI-JmG#_m#j>m8iVK4U$8)lYgP+@f4|%Smq>GsT0f#DnUU@?KN1|-CSezh} zfTXLQVO7`FGwvSf=ucUx<43tRs^^b(w&GejyOiZ(=+Unn@96L8A`L2%Lirh$u Qe^HsWLIvT-boCMT-++5I!2kdN diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/libs/mac/libfoo.jnilib deleted file mode 100755 index 6c1e780cb878f2b7603b1ad1f38dae372225ad8f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8696 zcmeHN-D@0G6u+CKZD{i`7SR~1ok}D1gKQprC_YGHlQOAEh;33rq1^6nCfR9sXSOr5 zZBh^xqvA9a^5~zSK8a7U50X+Ld20I<@*oX>_cXt#n^MuV@-^4J~1>kAwoMZaoToF z`oLs>5t!7;d1%jt)QY7MuhJgJ{ZwqpZ;`pew6IFj*=6qy$?46;(Vf9X!2$CouQ+TW<7aidw*B>qSW6-XKc)`iecwX;C*Fg(? zFELi>gJmXTtuU>yG)9SO#yA%21qA8dslR5%@85+ZjC}(C0CXHmLUkym{N(*oe^M-r zSMNwN{yZF-=lirvp%RX!{Uy^m8+8cTDlO44WM zgU~LfN1Uvm@#oVgX=z^d{7XUlROU+N>}ao8tQ1L~wf(^H+#o$5`+!2Y$Dv!e&7TSE zbUEG_ykWV{TedOtN|eqWLP7w}15gHk{F^xU;*1~dbj0nLDBKr^5j z__qv9TG4%L;pcHHdaq_huH6*aUvFdI#iYy8y0tjDY(=-K-xFFiwE5E!8vm8ZzPX*f z8r`X$lPT7XJwL=vDywEKqKwLMeDh%*c#~^Z1n~9xJ>ab%LzD}<0lx}cwHCe^KYzRP zaD`^+Jp2I}Ci&^pzE-qQs(>pk7H1!f~RUPz%aaHih#8{DNl1t0tfD)UcM>sz$2A%D}Hu!GPn z`Q9uxrlvPzo*EnO6}#v|Gy;;ew6moz*f(HF|Bzp!)TZ5b8%7#pG#s%7rpZWB*G{w4 zoRKox_O&jdu-6eII^~Z*mmkOZS+s@hlCQdzHRN|+ zx3ns*t!6+opc&8%Xa+O`ngPv#W|B`lwCEs`TTCIto6JIQpZ0`n^O9?m*U({AK1@#5&=t{~;9M!`+(W rT7&<7gHMSBEYFJjm2cvt7-#kc$F-9r{wHMZd`{{KJ@H&oC1ZaB_zc); diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml deleted file mode 100644 index bcb40e18ac..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-java5.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml deleted file mode 100644 index 305a55bb77..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata-primitives.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml deleted file mode 100644 index 3144b886d3..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java deleted file mode 100644 index df3b085ebd..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestAnnotationProcessing.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.runtime.core.components.Marker; -import org.apache.felix.ipojo.runtime.core.components.SubMarker; -import org.junit.Before; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestAnnotationProcessing extends BaseTest { - - private Class clazz; - - @Before - public void setUp() { - try { - clazz = bc.getBundle(). - loadClass("org.apache.felix.ipojo.runtime.core.components.Annotation"); - } catch (ClassNotFoundException e) { - fail("Cannot load the annotation class : " + e.getMessage()); - } - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - - @Test - public void testAnnotationOnMethod() { - Method method = null; - try { - method = this.clazz.getMethod("doSomething", new Class[0]); - } catch (Exception e) { - fail("Cannot find the doSomething method : " + e.getMessage()); - } - assertNotNull("Check method existence", method); - - java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations(); - assertNotNull("Check annotations size - 1", annotations); - assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible - - /* - @Marker(name="marker", type=Type.BAR, - sub=@SubMarker(subname="foo"), - arrayOfObjects={"foo", "bar", "baz"}, - arrayOfAnnotations= {@SubMarker(subname="foo")} - ) - @SubMarker(subname="bar") - @Invisible - */ - - Marker marker = getMarkerAnnotation(annotations); - assertNotNull("Check marker", marker); - - assertEquals("Check marker name", "marker", marker.name()); - assertEquals("Check marker type", Marker.Type.BAR, marker.type()); - assertEquals("Check sub marker attribute", "foo", marker.sub().subname()); - assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]); - assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]); - assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]); - assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname()); - - SubMarker sub = getSubMarkerAnnotation(annotations); - assertNotNull("Check submarker", sub); - assertEquals("Check submarker", "bar", sub.subname()); - - } - - @Test - public void testAnnotationOnConstructor() { - Constructor method = null; - try { - method = clazz.getConstructor(new Class[0]); - } catch (Exception e) { - fail("Cannot find the constructor method : " + e.getMessage()); - } - assertNotNull("Check method existence", method); - - java.lang.annotation.Annotation[] annotations = method.getDeclaredAnnotations(); - assertNotNull("Check annotations size - 1", annotations); - assertEquals("Check annotations size - 2", 2, annotations.length); // Invisible is not visible - - /* - @Marker(name="marker", type=Type.BAR, - sub=@SubMarker(subname="foo"), - arrayOfObjects={"foo", "bar", "baz"}, - arrayOfAnnotations= {@SubMarker(subname="foo")} - ) - @SubMarker(subname="bar") - @Invisible - */ - - Marker marker = getMarkerAnnotation(annotations); - assertNotNull("Check marker", marker); - - assertEquals("Check marker name", "marker", marker.name()); - assertEquals("Check marker type", Marker.Type.BAR, marker.type()); - assertEquals("Check sub marker attribute", "foo", marker.sub().subname()); - assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]); - assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]); - assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]); - assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname()); - - SubMarker sub = getSubMarkerAnnotation(annotations); - assertNotNull("Check submarker", sub); - assertEquals("Check submarker", "bar", sub.subname()); - } - - @Test - public void testParameterAnnotations() { - Method method = null; - try { - method = this.clazz.getMethod("doSomethingWithParams", new Class[]{String.class, String.class, String.class}); - } catch (Exception e) { - fail("Cannot find the doSomethingWithParams method : " + e.getMessage()); - } - assertNotNull("Check method existence", method); - - java.lang.annotation.Annotation[][] annotations = method.getParameterAnnotations(); - assertNotNull("Check annotations size - 1", annotations); - assertEquals("Check annotations size - 3", 3, annotations.length); - - // Check internals - // First parameter (foo) - java.lang.annotation.Annotation[] fooAnns = annotations[0]; - assertEquals("Check fooAnns length", 1, fooAnns.length); - Marker marker = (Marker) fooAnns[0]; - assertNotNull("Check marker", marker); - assertEquals("Check marker name", "marker", marker.name()); - assertEquals("Check marker type", Marker.Type.BAR, marker.type()); - assertEquals("Check sub marker attribute", "foo", marker.sub().subname()); - assertEquals("Check objects [0]", "foo", marker.arrayOfObjects()[0]); - assertEquals("Check objects [1]", "bar", marker.arrayOfObjects()[1]); - assertEquals("Check objects [2]", "baz", marker.arrayOfObjects()[2]); - assertEquals("Check annotations[0]", "foo", marker.arrayOfAnnotations()[0].subname()); - - // Second parameter (bar), no annotation (invisible) - java.lang.annotation.Annotation[] barAnns = annotations[1]; - assertEquals("Check barAnns length", 0, barAnns.length); - - // Third parameter (baz), two annotations - java.lang.annotation.Annotation[] bazAnns = annotations[2]; - System.out.println(Arrays.toString(bazAnns)); - assertEquals("Check bazAnns length", 2, bazAnns.length); - } - - private Marker getMarkerAnnotation(java.lang.annotation.Annotation[] annotations) { - for (int i = 0; i < annotations.length; i++) { - if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.runtime.core.components.Marker")) { - return (Marker) annotations[i]; - } - } - return null; - } - - private SubMarker getSubMarkerAnnotation(java.lang.annotation.Annotation[] annotations) { - for (int i = 0; i < annotations.length; i++) { - if (annotations[i].annotationType().getName().equals("org.apache.felix.ipojo.runtime.core.components.SubMarker")) { - return (SubMarker) annotations[i]; - } - } - return null; - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java deleted file mode 100644 index b929a86998..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDuplicateMethods.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.runtime.core.services.Plop; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestDuplicateMethods extends BaseTest { - - - @Test - public void testDuplicateMethod() { - ipojoHelper.createComponentInstance("plopimpl", "plop"); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Plop.class.getName(), "plop"); - assertNotNull("Check plop", ref); - Plop plop = (Plop) osgiHelper.getServiceObject(ref); - Object o = plop.getPlop(); - assertEquals("Check result", "plop", o); - ipojoHelper.dispose(); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java deleted file mode 100644 index 1f7ba93084..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestExceptionHandling.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.FooProviderType1; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -/** - * Test exception handling. POJO exception must be propagated. - */ -public class TestExceptionHandling extends BaseTest { - - private ComponentInstance ci_lazzy; - - private ServiceReference lazzyRef; - private ServiceReference immRef; - - @Before - public void setUp() { - String factName = "Manipulation-FooProviderType-1"; - String compName = "FooProvider-1"; - ci_lazzy = ipojoHelper.createComponentInstance(factName, compName); - - String factName2 = "Manipulation-ImmediateFooProviderType"; - String compName2 = "FooProvider-2"; - ipojoHelper.createComponentInstance(factName2, compName2); - - lazzyRef = osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + compName + ")"); - immRef = osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + compName2 + ")"); - - assertNotNull("LazzyRef", lazzyRef); - assertNotNull("ImmRef", immRef); - } - - /** - * Check that the exception is correctly propagated. - */ - @Test - public void testException() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref); - FooProviderType1 fs = (FooProviderType1) osgiHelper.getServiceObject(ref); - try { - fs.testException(); - fail("The method must returns an exception"); - } catch (Exception e) { - // OK - } - } - - /** - * Check that the exception is correctly catch by the POJO. - */ - @Test - public void testTry() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), ci_lazzy.getInstanceName()); - assertNotNull("Check that a FooService from " + ci_lazzy.getInstanceName() + " is available", ref); - FooProviderType1 fs = (FooProviderType1) osgiHelper.getServiceObject(ref); - try { - fs.testTry(); - } catch (Exception e) { - fail("The method has returned an exception"); - } - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java deleted file mode 100644 index c7ae3c2664..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGenericList.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -public class TestGenericList extends BaseTest { - - ComponentInstance foo1, foo2; - ComponentInstance checker; - - @Before - public void setUp() { - foo1 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo1"); - foo2 = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.FooServiceImpl", "foo2"); - checker = ipojoHelper.createComponentInstance("TypedList", "checker"); - foo1.stop(); - foo2.stop(); - } - - @Test - public void testTypedList() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), checker.getInstanceName()); - CheckService check = (CheckService) osgiHelper.getServiceObject(ref); - assertNotNull("Checker availability", check); - // Check without providers - assertFalse("Empty list", check.check()); - - // Start the first provider - foo1.start(); - assertTrue("List with one element", check.check()); - Properties props = check.getProps(); - List list = (List) props.get("list"); - assertEquals("Check size - 1", 1, list.size()); - - // Start the second provider - foo2.start(); - assertTrue("List with two element", check.check()); - props = check.getProps(); - list = (List) props.get("list"); - assertEquals("Check size - 2", 2, list.size()); - - // Stop the first one - foo1.stop(); - assertTrue("List with one element (2)", check.check()); - props = check.getProps(); - list = (List) props.get("list"); - assertEquals("Check size - 3", 1, list.size()); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java deleted file mode 100644 index 63998f0020..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestGetComponentInstance.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.Pojo; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.*; - -/** - * Check the getComponentInstance method on a POJO - */ -public class TestGetComponentInstance extends BaseTest { - - /** - * Check if a pojo can correctly be cast in POJO. - * Check the getComponentInstance method. - */ - @Test - public void testGetComponentInstance() throws NoSuchFieldException, IllegalAccessException, NoSuchMethodException { - String factName = "Manipulation-FooProviderType-1"; - String compName = "FooProvider-1"; - ServiceReference ref = null; - - // Get the factory to create a component instance - Factory fact = ipojoHelper.getFactory(factName); - assertNotNull("Cannot find the factory FooProvider-1", fact); - - Properties props = new Properties(); - props.put("instance.name", compName); - ComponentInstance ci = null; - try { - ci = fact.createComponentInstance(props); - } catch (Exception e1) { - fail(e1.getMessage()); - } - - assertEquals("Check instance name", compName, ci.getInstanceName()); - - // Get a FooService provider - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), compName); - - assertNotNull("FS not available", ref); - - // Get foo object - FooService fs = (FooService) osgiHelper.getServiceObject(ref); - - // Cast to POJO - Pojo pojo = (Pojo) fs; - Field im = fs.getClass().getDeclaredField("__IM"); - assertNotNull(im); - im.setAccessible(true); - assertNotNull(im.get(fs)); - - Method method = fs.getClass().getMethod("getComponentInstance"); - assertNotNull(method); - - // GetComponentInstance - ComponentInstance instance = pojo.getComponentInstance(); - assertNotNull(instance); - assertEquals("Check component instance name", instance.getInstanceName(), compName); - assertEquals("Check component factory name", instance.getFactory().getName(), factName); - assertNotNull("Instance description not null", instance.getInstanceDescription()); - PrimitiveInstanceDescription id = (PrimitiveInstanceDescription) instance.getInstanceDescription(); - assertTrue("Check instance state", id.getState() == ComponentInstance.VALID); - assertEquals("Check created pojo count", id.getCreatedObjects().length, 1); - assertEquals("Check instance description name", id.getName(), compName); - - ci.dispose(); - - // Check that there is no more FooService - ref = osgiHelper.getServiceReference(FooService.class.getName()); - assertNull("FS available, but component instance stopped", ref); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java deleted file mode 100644 index d70ea3342c..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestHandlerBindingAndIgnoreAnnotation.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNull; -import static junit.framework.Assert.assertTrue; - -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.HandlerBindingTestService; -import org.junit.Test; -import org.ops4j.pax.exam.CoreOptions; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import junit.framework.Assert; - -public class TestHandlerBindingAndIgnoreAnnotation extends BaseTest { - - public static final String FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.HandlerBindingTestComponent"; - - @Test - public void testFooHandlerBinding() { - -/* - HandlerFactory handlerFactory = ipojoHelper.getHandlerFactory("com.acme:foo"); - assertNotNull(handlerFactory); - assertEquals(Factory.VALID, handlerFactory.getState()); -*/ - - // verify component's factory is here - // verify BazService has been published - // --> verify instance has been created - - Factory factory = ipojoHelper.getFactory(FACTORY_NAME); - assertNotNull(factory); - assertEquals(Factory.VALID, factory.getState()); - - - List services = osgiHelper.getServiceObjects(HandlerBindingTestService.class); - assertEquals(1, services.size()); - - HandlerBindingTestService baz = services.get(0); - assertEquals("Bonjour", baz.get("greeting")); - assertEquals("Welcome", baz.get("welcome")); - assertNull(baz.get("ignored")); - ipojoHelper.dispose(); - } - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - - @Override - protected Option[] getCustomOptions() { - return new Option[] {CoreOptions.vmOption("-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=8000")}; - //return new Option[] {CoreOptions.vmOptions("-Xdebug", "-Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8000")}; - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java deleted file mode 100644 index 5ea6c17b77..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNativeMethod.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import aQute.lib.osgi.Constants; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.filefilter.TrueFileFilter; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.apache.commons.io.FileUtils.copyInputStreamToFile; -import static org.ops4j.pax.exam.CoreOptions.bundle; - -/** - * Checks that native methods can still be used in components. - */ -public class TestNativeMethod extends BaseTest { - - private static final String NATIVE_CLAUSE = "" + - //Mac - "libs/mac/libfoo.jnilib;osname=MacOSX;osname=MacOS;processor=x86;processor=x86_64;processor=PowerPC," + - // Linux 32 bits - "libs/linux64/libfoo.so;processor=x86_64;osname=Linux," + - // Linux 64 bits - "libs/linux32/libfoo.so;processor=x86;osname=Linux"; - - /** - * We don't deploy the test bundle, a specific one will be built. - * On KF we still deploy the bundle as the probe bundles needs the components and services. - */ - @Override - public boolean deployTestBundle() { - return isKnopflerfish(); - } - - public boolean isKnopflerfish() { - if (context != null) { - return super.isKnopflerfish(); - } else { - String pf = System.getProperty("pax.exam.framework"); - return pf != null && pf.equalsIgnoreCase("knopflerfish"); - } - } - - @Override - protected Option[] getCustomOptions() { - // The native bundle cannot be deployed on kf, - // just skip - if (isKnopflerfish()) { - return new Option[0]; - } - return new Option[] { - buildBundleWithNativeLibraries() - }; - } - - @Test - public void testComponentWithNativeMethod() { - if (isKnopflerfish()) { - System.out.println("Test not supported on knopflerfish"); - return; - } - - ComponentInstance ci = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components" + - ".nativ.NativeComponent"); - - BazService baz = osgiHelper.getServiceObject(BazService.class, "(instance.name=" + ci.getInstanceName() +")"); - assertEquals("foo: Test program of JNI.", baz.hello("")); - } - - - public static Option buildBundleWithNativeLibraries() { - File out = new File("target/tested/test-bundle-with-native.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - TinyBundle tested = TinyBundles.bundle(); - - // We look inside target/classes to find the class and resources - File classes = new File("target/classes"); - Collection files = FileUtils.listFilesAndDirs(classes, TrueFileFilter.INSTANCE, TrueFileFilter.INSTANCE); - List exports = new ArrayList(); - for (File file : files) { - if (file.isDirectory()) { - // By convention we export of .services and .service package - if (file.getAbsolutePath().contains("/services") || file.getAbsolutePath().contains("/service")) { - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - String packageName = path.replace('/', '.'); - exports.add(packageName); - } - } else { - // We need to compute the path - String path = file.getAbsolutePath().substring(classes.getAbsolutePath().length() +1); - try { - tested.add(path, file.toURI().toURL()); - } catch (MalformedURLException e) { - // Ignore it. - } - System.out.println(file.getName() + " added to " + path); - } - } - - // Depending on the the order, the probe bundle may already have detected requirements on components. - String clause = "" + - "org.apache.felix.ipojo.runtime.core.components, " + - "org.apache.felix.ipojo.runtime.core.services, " + - "org.apache.felix.ipojo.runtime.core.services.A123"; - for (String export : exports) { - if (export.length() > 0) { export += ", "; } - clause += export; - } - - System.out.println("Exported packages : " + clause); - - InputStream inputStream = tested - .set(Constants.BUNDLE_SYMBOLICNAME, BaseTest.TEST_BUNDLE_SYMBOLIC_NAME + "-with-native") - .set(Constants.IMPORT_PACKAGE, "*") - .set(Constants.EXPORT_PACKAGE, clause) - .set(Constants.BUNDLE_NATIVECODE, NATIVE_CLAUSE) - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources"))); - - try { - copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the manipulated bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the manipulated bundle"); - } - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java deleted file mode 100644 index 37d2774e06..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestNestedClasses.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.components.InnerClasses; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestNestedClasses extends BaseTest { - - private ComponentInstance instance; - private CheckService service; - - @Before - public void setUp() { - Properties map = new Properties(); - map.put("publicObject", "publicObject"); - map.put("publicInt", new Integer(0)); - map.put("packageObject", "packageObject"); - map.put("packageInt", new Integer(1)); - map.put("protectedObject", "protectedObject"); - map.put("protectedInt", new Integer(2)); - map.put("privateObject", "privateObject"); - map.put("privateInt", new Integer(3)); - map.put("nonObject", "nonObject"); - map.put("nonInt", new Integer(4)); - instance = ipojoHelper.createComponentInstance("inners", map); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Check service availability", ref); - service = (CheckService) osgiHelper.getServiceObject(ref); - } - - @After - public void tearDown() { - service = null; - } - - @Test - public void testPrivateInnerClass() { - Map data = (Map) service.getProps().get("privateInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testProtectedInnerClass() { - Map data = (Map) service.getProps().get("protectedInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testPackageInnerClass() { - Map data = (Map) service.getProps().get("packageInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testPublicInnerClass() { - Map data = (Map) service.getProps().get("publicInner"); - assertNotNull("Check data existence", data); - System.out.println(data); - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testConstructorInnerClass() { - Map data = (Map) service.getProps().get("constructorInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testStaticInnerClass() { - Map data = (Map) service.getProps().get("staticInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check static", new Boolean(true), data.get("static")); - assertEquals("Check static int", new Integer(6), data.get("staticint")); - - } - - @Test - public void testAnonymousClassDeclaredInStaticField() { - assertEquals(service.getProps().get("call"), 1); - } - - @Test - public void testPackageStaticInnerClass() { - Map data = (Map) service.getProps().get("packageStaticInner"); - assertNotNull("Check data existence", data); - - assertEquals("Check static", new Boolean(true), data.get("static")); - assertEquals("Check static int", new Integer(6), data.get("staticint")); - - } - - @Test - public void testAnonymousInnerClass() { - Map data = (Map) service.getProps().get("anonymous"); - assertNotNull("Check data existence", data); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - - } - - @Test - public void testInnerAccess() { - Map map = (Map) service.getProps(); - assertNotNull("Check map existence", map); - - InnerClasses.PublicNested p = (InnerClasses.PublicNested) map.get("public"); - Map data = p.doSomething(); - - assertEquals("Check public object", "publicObject", data.get("publicObject")); - assertEquals("Check public int", new Integer(0), data.get("publicInt")); - assertEquals("Check protected object", "protectedObject", data.get("protectedObject")); - assertEquals("Check protected int", new Integer(2), data.get("protectedInt")); - assertEquals("Check package object", "packageObject", data.get("packageObject")); - assertEquals("Check package int", new Integer(1), data.get("packageInt")); - assertEquals("Check private object", "privateObject", data.get("privateObject")); - assertEquals("Check private int", new Integer(3), data.get("privateInt")); - assertEquals("Check non-managed object", "not-managed", data.get("nonObject")); - assertEquals("Check non-managed int", new Integer(5), data.get("nonInt")); - } - - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java deleted file mode 100644 index 84b659b275..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypes.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -/** - * Check the manipulation of primitive type (boxed and unboxed). - */ -public class TestPrimitiveTypes extends BaseTest { - - PrimitiveManipulationTestService prim; - - @Before - public void setUp() { - ComponentInstance instance = ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTester"); - assertTrue("check instance state", instance.getState() == ComponentInstance.VALID); - prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(PrimitiveManipulationTestService.class.getName(), "(instance.name=" + instance.getInstanceName() + ")"); - assertNotNull("Check prim availability", prim); - } - - @After - public void tearDown() { - prim = null; - } - - @Test - public void testByte() { - assertEquals("Check - 1", prim.getByte(), 1); - prim.setByte((byte) 2); - assertEquals("Check - 2", prim.getByte(), 2); - } - - @Test - public void testShort() { - assertEquals("Check - 1", prim.getShort(), 1); - prim.setShort((short) 2); - assertEquals("Check - 2", prim.getShort(), 2); - } - - @Test - public void testInt() { - assertEquals("Check - 1", prim.getInt(), 1); - prim.setInt((int) 2); - assertEquals("Check - 2", prim.getInt(), 2); - } - - @Test - public void testLong() { - assertEquals("Check - 1", prim.getLong(), 1); - prim.setLong((long) 2); - assertEquals("Check - 2", prim.getLong(), 2); - } - - @Test - public void testFloat() { - assertEquals("Check - 1", prim.getFloat(), 1.1f, 0); - prim.setFloat(2.2f); - assertEquals("Check - 2", prim.getFloat(), 2.2f, 0); - } - - @Test - public void testDouble() { - assertEquals("Check - 1", prim.getDouble(), 1.1, 0); - prim.setDouble(2.2); - assertEquals("Check - 2", prim.getDouble(), 2.2, 0); - } - - @Test - public void testBoolean() { - assertFalse("Check - 1", prim.getBoolean()); - prim.setBoolean(true); - assertTrue("Check - 2", prim.getBoolean()); - } - - @Test - public void testChar() { - assertEquals("Check - 1", prim.getChar(), 'a'); - prim.setChar('b'); - assertEquals("Check - 2", prim.getChar(), 'b'); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java deleted file mode 100644 index 28cc0e7cf2..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPrimitiveTypesWithNumberInNames.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -/** - * Check the manipulation of primitive type (boxed and unboxed). - * The targeted implementation contains numbers in the package and class name. - */ -public class TestPrimitiveTypesWithNumberInNames extends BaseTest { - - PrimitiveManipulationTestService prim; - - @Before - public void setUp() { - ComponentInstance instance = - ipojoHelper.createComponentInstance("ManipulationPrimitives-PrimitiveManipulationTesterA"); - assertTrue("check instance state", instance.getState() == ComponentInstance.VALID); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(), - instance.getInstanceName()); - assertNotNull("Check prim availability", ref); - prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(ref); - } - - @After - public void tearDown() { - prim = null; - } - - @Test - public void testByte() { - assertEquals("Check - 1", prim.getByte(), 1); - prim.setByte((byte) 2); - assertEquals("Check - 2", prim.getByte(), 2); - } - - @Test - public void testShort() { - assertEquals("Check - 1", prim.getShort(), 1); - prim.setShort((short) 2); - assertEquals("Check - 2", prim.getShort(), 2); - } - - @Test - public void testInt() { - assertEquals("Check - 1", prim.getInt(), 1); - prim.setInt((int) 2); - assertEquals("Check - 2", prim.getInt(), 2); - } - - @Test - public void testLong() { - assertEquals("Check - 1", prim.getLong(), 1); - prim.setLong((long) 2); - assertEquals("Check - 2", prim.getLong(), 2); - } - - @Test - public void testFloat() { - assertEquals("Check - 1", prim.getFloat(), 1.1f, 0); - prim.setFloat(2.2f); - assertEquals("Check - 2", prim.getFloat(), 2.2f, 0); - } - - @Test - public void testDouble() { - assertEquals("Check - 1", prim.getDouble(), 1.1, 0); - prim.setDouble(2.2); - assertEquals("Check - 2", prim.getDouble(), 2.2, 0); - } - - @Test - public void testBoolean() { - assertFalse("Check - 1", prim.getBoolean()); - prim.setBoolean(true); - assertTrue("Check - 2", prim.getBoolean()); - } - - @Test - public void testChar() { - assertEquals("Check - 1", prim.getChar(), 'a'); - prim.setChar('b'); - assertEquals("Check - 2", prim.getChar(), 'b'); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java deleted file mode 100644 index c956eda438..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestStereotypeAnnotation.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertTrue; -import static org.junit.Assert.assertNotNull; - -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import junit.framework.Assert; - -public class TestStereotypeAnnotation extends BaseTest { - - public static final String BAZ_FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.StereotypedBazComponent"; - - public static final String MB_FACTORY_NAME = "org.apache.felix.ipojo.runtime.core.components.StereotypedMultiBind"; - - @Test - public void testTypeStereotype() { - - // verify component's factory is here - // verify BazService has been published - // --> verify instance has been created - - Factory factory = ipojoHelper.getFactory(BAZ_FACTORY_NAME); - Assert.assertNotNull(factory); - assertEquals(Factory.VALID, factory.getState()); - - - List services = osgiHelper.getServiceObjects(BazService.class); - assertEquals(1, services.size()); - - BazService baz = services.get(0); - assertEquals("Hello Guillaume", baz.hello("Guillaume")); - ipojoHelper.dispose(); - } - - @Test - public void testMethodStereotype() { - - // verify component's factory is here - // verify that the requires handler has been activated - // verify that a created instance works - - Factory factory = ipojoHelper.getFactory(MB_FACTORY_NAME); - Assert.assertNotNull(factory); - assertEquals(Factory.VALID, factory.getState()); - - assertTrue(factory.getRequiredHandlers().contains("org.apache.felix.ipojo:requires")); - - ComponentInstance instance = ipojoHelper.createComponentInstance(MB_FACTORY_NAME, "stereotype-multibind-instance"); - assertTrue(ipojoHelper.isInstanceValid(instance)); - - ipojoHelper.dispose(); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java deleted file mode 100644 index c4c879e656..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSwitches.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.ProbeBuilder; -import org.ops4j.pax.exam.TestProbeBuilder; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestSwitches extends BaseTest { - - private ComponentInstance instance; - private CheckService service; - - @Before - public void setUp() { - instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.components.Switches"); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Check service availability", ref); - service = (CheckService) osgiHelper.getServiceObject(ref); - } - - @After - public void tearDown() { - service = null; - } - - @ProbeBuilder - public TestProbeBuilder probe(TestProbeBuilder builder) { - builder.setHeader(Constants.IMPORT_PACKAGE, "org.osgi.framework, org.apache.felix.ipojo, " + - "org.ow2.chameleon.testing.helpers," + - "org.apache.felix.ipojo.architecture, org.apache.felix.ipojo.handlers.dependency," + - "org.apache.felix.ipojo.runtime.core.services, org.apache.felix.ipojo.runtime.core.components"); - builder.setHeader(Constants.DYNAMICIMPORT_PACKAGE, "org.ops4j.pax.exam,org.junit,javax.inject," + - "org.ops4j.pax.exam.options,junit.framework"); - builder.setHeader("Bundle-ManifestVersion", "2"); - return builder; - } - - @Test - public void testSwitches() { - Properties properties = service.getProps(); - assertEquals(properties.get("switchOnInteger1"), "1"); - assertEquals(properties.get("switchOnInteger4"), "3"); - - - assertEquals(properties.get("switchOnEnumRed"), "RED"); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - - -} diff --git a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java b/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java deleted file mode 100644 index 8a6732edc8..0000000000 --- a/ipojo/manipulator/manipulator-it/ipojo-manipulator-manipulation-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestTypeBoxing.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.PrimitiveManipulationTestService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -public class TestTypeBoxing extends BaseTest { - - ComponentInstance instance; // Instance under test - - PrimitiveManipulationTestService prim; - - ServiceReference prim_ref; - - @Before - public void setUp() { - Properties p1 = new Properties(); - p1.put("instance.name", "primitives"); - instance = ipojoHelper.createComponentInstance("ManipulationPrimitives5-PrimitiveManipulationTester", p1); - assertTrue("check instance state", instance.getState() == ComponentInstance.VALID); - prim_ref = ipojoHelper.getServiceReferenceByName(PrimitiveManipulationTestService.class.getName(), instance.getInstanceName()); - assertNotNull("Check prim availability", prim_ref); - prim = (PrimitiveManipulationTestService) osgiHelper.getServiceObject(prim_ref); - } - - @After - public void tearDown() { - prim = null; - } - - - @Test - public void testLongFromObject() { - assertEquals("Check - 1", prim.getLong(), 1); - Long l = new Long(2); - prim.setLong(l); - assertEquals("Check - 2", prim.getLong(), 2); - } - - @Test - public void testLongFromObject2() { - assertEquals("Check - 1", prim.getLong(), 1); - Long l = new Long(2); - prim.setLong(l, "ss"); - assertEquals("Check - 2", prim.getLong(), 2); - } - - @Override - protected List getExtraExports() { - return Arrays.asList("org.apache.felix.ipojo.runtime.core.components"); - } - -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml deleted file mode 100644 index 5d5e4ecda5..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator.manipulator-it - 1.13.1-SNAPSHOT - - - 4.0.0 - - ipojo-online-manipulator-test - - Apache Felix iPOJO Manipulator ~ Online IT - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java deleted file mode 100644 index 0549286488..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/Consumer.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.test.online.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.test.online.services.Hello; - -@Component -public class Consumer { - - @Requires - private Hello hello; - - public Consumer() { - System.out.println(hello.sayHello()); - } - -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java deleted file mode 100644 index 289f3e92e5..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/FrenchHelloService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.test.online.components; - -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.test.online.module.Type; -import org.apache.felix.ipojo.test.online.services.Hello; - -/** - * User: guillaume - * Date: 27/02/2014 - * Time: 14:33 - */ -@Type -@Instantiate -@Provides -public class FrenchHelloService implements Hello { - @Override - public String sayHello() { - return "Bonjour"; - } -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java deleted file mode 100644 index a4cd6d52a7..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/GermanHelloService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.test.online.components; - -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.test.online.module.Type2; -import org.apache.felix.ipojo.test.online.services.Hello; - -/** - * User: guillaume - * Date: 27/02/2014 - * Time: 14:33 - */ -@Type2 -@Instantiate -@Provides -public class GermanHelloService implements Hello { - @Override - public String sayHello() { - return "Hallo"; - } -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java deleted file mode 100644 index d2ef530601..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.test.online.components; - - -import org.apache.felix.ipojo.test.online.services.Hello; - -public class MyProvider implements Hello { - - public String sayHello() { - return "Hello"; - } - -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java deleted file mode 100644 index a7c731229c..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/components/MyProviderWithAnnotations.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.test.online.components; - - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.test.online.services.Hello; - -@Component -@Provides -@Instantiate -public class MyProviderWithAnnotations implements Hello { - - public String sayHello() { - return "Hello"; - } - -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java deleted file mode 100644 index 8bf3d804b6..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Activator.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ipojo.test.online.module; - -import org.apache.felix.ipojo.manipulator.spi.Module; -import org.osgi.framework.BundleActivator; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceRegistration; - -/** - * User: guillaume - * Date: 27/02/2014 - * Time: 14:31 - */ -public class Activator implements BundleActivator { - - private ServiceRegistration registration; - - @Override - public void start(final BundleContext context) throws Exception { - registration = context.registerService(Module.class, new TypeModule(), null); - } - - @Override - public void stop(final BundleContext context) throws Exception { - registration.unregister(); - } -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java deleted file mode 100644 index 2329851f95..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.test.online.module; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Stereotype; - -/** - * Stereotype defined in a Module - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Type { -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java deleted file mode 100644 index 36992abb48..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/Type2.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.test.online.module; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Stereotype; - -/** - * Annotated stereotype - */ -@Stereotype -@Component -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface Type2 { -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java deleted file mode 100644 index 877d163c2d..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/module/TypeModule.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.test.online.module; - -import java.lang.annotation.Annotation; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.manipulator.spi.AnnotationLiteral; -import org.apache.felix.ipojo.manipulator.spi.AbsBindingModule; - -/** - * User: guillaume - * Date: 27/02/2014 - * Time: 14:26 - */ -public class TypeModule extends AbsBindingModule { - @Override - public void configure() { - // @Type is equivalent to @Component - bindStereotype(Type.class) - .with(new ComponentLiteral()); - } - - public static class ComponentLiteral extends AnnotationLiteral implements Component { - - public boolean public_factory() { - return true; - } - - public boolean publicFactory() { - return true; - } - - public String name() { - return ""; - } - - public boolean architecture() { - return false; - } - - public boolean immediate() { - return false; - } - - public boolean propagation() { - return true; - } - - public String managedservice() { - return ""; - } - - public String factory_method() { - return ""; - } - - public String factoryMethod() { - return ""; - } - - public String version() { - return ""; - } - } -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java deleted file mode 100644 index a58fb1f570..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/java/org/apache/felix/ipojo/test/online/services/Hello.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.test.online.services; - -public interface Hello { - - public String sayHello(); - -} diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml deleted file mode 100644 index a78ad3c345..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/consumer.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml deleted file mode 100644 index 593779f48b..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/main/resources/provider.xml +++ /dev/null @@ -1,25 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java b/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java deleted file mode 100644 index 63b9ebcc09..0000000000 --- a/ipojo/manipulator/manipulator-it/online-manipulator-it/src/test/java/org/apache/felix/ipojo/test/online/OnlineManipulatorTest.java +++ /dev/null @@ -1,593 +0,0 @@ -/* - * 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.ipojo.test.online; - - -import ch.qos.logback.classic.Level; -import ch.qos.logback.classic.Logger; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.test.online.components.Consumer; -import org.apache.felix.ipojo.test.online.components.FrenchHelloService; -import org.apache.felix.ipojo.test.online.components.GermanHelloService; -import org.apache.felix.ipojo.test.online.components.MyProvider; -import org.apache.felix.ipojo.test.online.components.MyProviderWithAnnotations; -import org.apache.felix.ipojo.test.online.module.Activator; -import org.apache.felix.ipojo.test.online.module.Type; -import org.apache.felix.ipojo.test.online.module.Type2; -import org.apache.felix.ipojo.test.online.module.TypeModule; -import org.apache.felix.ipojo.test.online.services.Hello; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.ops4j.io.StreamUtils; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerClass; -import org.ops4j.pax.tinybundles.core.InnerClassStrategy; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.*; -import org.osgi.service.url.URLStreamHandlerService; -import org.ow2.chameleon.testing.helpers.OSGiHelper; -import org.slf4j.LoggerFactory; - -import javax.inject.Inject; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import static org.ops4j.pax.exam.CoreOptions.*; - - -@RunWith(PaxExam.class) -@ExamReactorStrategy(PerClass.class) -public class OnlineManipulatorTest { - - - private static File TMP = new File("target/tmp-bundle"); - - @Inject - BundleContext context; - - private OSGiHelper helper; - - - @Configuration - public Option[] configure() throws IOException { - Logger root = (Logger) LoggerFactory.getLogger(Logger.ROOT_LOGGER_NAME); - root.setLevel(Level.INFO); - - String providerWithMetadata = providerWithMetadata(); - String providerWithMetadataInMetaInf = providerWithMetadataInMetaInf(); - String providerWithoutMetadata = providerWithoutMetadata(); - String consumerWithMetadata = consumerWithMetadata(); - String consumerWithoutMetadata = consumerWithoutMetadata(); - String providerUsingModules = providerUsingModules(); - String providerUsingAnnotatedStereotype = providerUsingAnnotatedStereotype(); - - return options( - cleanCaches(), - mavenBundle("org.apache.felix", "org.apache.felix.ipojo").versionAsInProject(), - mavenBundle("org.ow2.chameleon.testing", "osgi-helpers").versionAsInProject(), - mavenBundle("org.apache.felix","org.apache.felix.ipojo.manipulator.online").versionAsInProject(), - junitBundles(), - - provision( - TinyBundles.bundle() - .add(Hello.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(), - moduleBundle() - ), - - systemProperty("providerWithMetadata").value(providerWithMetadata), - systemProperty("providerWithMetadataInMetaInf").value(providerWithMetadataInMetaInf), - systemProperty("providerWithoutMetadata").value(providerWithoutMetadata), - systemProperty("providerUsingAnnotations").value(providerUsingAnnotation()), - systemProperty("consumerWithMetadata").value(consumerWithMetadata), - systemProperty("consumerWithoutMetadata").value(consumerWithoutMetadata), - systemProperty("providerUsingModules").value(providerUsingModules), - systemProperty("providerUsingAnnotatedStereotype").value(providerUsingAnnotatedStereotype), - - systemProperty("org.knopflerfish.osgi.registerserviceurlhandler").value("true") - ); - - } - - private InputStream moduleBundle() { - return TinyBundles.bundle() - .add(Activator.class) - .add(Type.class) - .add(Type2.class) - .add(TypeModule.class, InnerClassStrategy.ALL) - .add(TypeModule.ComponentLiteral.class) - .set(Constants.BUNDLE_ACTIVATOR, Activator.class.getName()) - .set(Constants.BUNDLE_SYMBOLICNAME, "Manipulator Module") - .set(Constants.IMPORT_PACKAGE, - "org.osgi.framework," + - "org.apache.felix.ipojo.manipulator.spi," + - "org.apache.felix.ipojo.annotations") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.online.module") - .build(); - } - - @Before - public void before() { - helper = new OSGiHelper(context); - waitForStability(context); - - helper.waitForService(URLStreamHandlerService.class, null, 1000); - - Assert.assertEquals("Check online manipulator bundle state", - helper.getBundle("org.apache.felix.ipojo.manipulator.online").getState(), - Bundle.ACTIVE); - - URLStreamHandlerService svc = helper.getServiceObject(URLStreamHandlerService.class, null); - Assert.assertNotNull("URL Stream handler exported", svc); - System.out.println(svc); - } - - @After - public void after() { - helper.dispose(); - } - - private static File getTemporaryFile(String name) throws IOException { - if (!TMP.exists()) { - TMP.mkdirs(); - TMP.deleteOnExit(); - } - File file = File.createTempFile(name, ".jar", TMP); - //File file = new File(TMP, name + ".jar"); - if (file.exists()) { - file.delete(); - } - file.deleteOnExit(); - return file; - } - - @Test - public void installProviderWithMetadata1() throws Exception { - String url = context.getProperty("providerWithMetadata"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - - assertBundle("Provider"); - - helper.waitForService(Hello.class.getName(), null, 5000); - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - } - - - @Test - public void installProviderWithMetadata2() throws BundleException, InvalidSyntaxException, IOException { - String url = context.getProperty("providerWithMetadataInMetaInf"); - Assert.assertNotNull(url); - System.out.println("prefixed url : " + "ipojo:" + url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - assertBundle("Provider"); - helper.waitForService(Hello.class.getName(), null, 5000); - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - } - - @Test - public void installProviderWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException { - String url = context.getProperty("providerWithoutMetadata"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - - assertBundle("Provider"); - helper.waitForService(Hello.class.getName(), null, 5000); - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - } - - @Test - public void installProviderUsingAnnotations() throws BundleException, InvalidSyntaxException, IOException { - String url = context.getProperty("providerUsingAnnotations"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - - assertBundle("Provider-with-annotations"); - helper.waitForService(Hello.class.getName(), null, 5000); - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - } - - @Test - public void installConsumerWithMetadata() throws BundleException, InvalidSyntaxException, IOException { - String url = context.getProperty("providerWithoutMetadata"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - assertBundle("Provider"); - - String url2 = context.getProperty("consumerWithMetadata"); - Assert.assertNotNull(url); - Bundle bundle2 = context.installBundle("ipojo:" + url2); - bundle2.start(); - - assertBundle("Consumer"); - helper.waitForService(Hello.class.getName(), null, 5000); - // Wait for activation. - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - bundle.uninstall(); - bundle2.uninstall(); - } - - @Test - public void installConsumerWithoutMetadata() throws BundleException, InvalidSyntaxException, IOException { - String url = context.getProperty("providerWithMetadataInMetaInf"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - assertBundle("Provider"); - helper.waitForService(Hello.class.getName(), null, 5000); - - String url2 = context.getProperty("consumerWithoutMetadata"); - Assert.assertNotNull(url); - Bundle bundle2 = context.installBundle("ipojo:" + url2); - bundle2.start(); - assertBundle("Consumer"); - // Wait for activation. - try { - Thread.sleep(2000); - } catch (InterruptedException e) { - e.printStackTrace(); - } - assertValidity(); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - bundle2.uninstall(); - } - - @Test - public void testManipulatorModuleRegisteredAsServicesAreLoaded() throws Exception { - - String url = context.getProperty("providerUsingModules"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - assertBundle("ProviderUsingModules"); - - helper.waitForService(Hello.class.getName(), null, 5000); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - - } - - @Test - public void testAnnotatedStereotypes() throws Exception { - - String url = context.getProperty("providerUsingAnnotatedStereotype"); - Assert.assertNotNull(url); - Bundle bundle = context.installBundle("ipojo:" + url); - bundle.start(); - assertBundle("ProviderUsingAnnotatedStereotype"); - - helper.waitForService(Hello.class.getName(), null, 5000); - Assert.assertNotNull(context.getServiceReference(Hello.class.getName())); - - bundle.uninstall(); - - } - - /** - * Gets a regular bundle containing metadata file - * - * @return the url of the bundle - * @throws java.io.IOException - */ - public static String providerWithMetadata() throws IOException { - InputStream is = TinyBundles.bundle() - .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml")) - .add(MyProvider.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerWithMetadata"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - return out.toURI().toURL().toExternalForm(); - } - - /** - * Gets a regular bundle containing metadata file in the META-INF directory - * - * @return the url of the bundle - * @throws java.io.IOException - */ - public static String providerWithMetadataInMetaInf() throws IOException { - InputStream is = TinyBundles.bundle() - .add("META-INF/metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml")) - .add(MyProvider.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerWithMetadataInMetaInf"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - return out.toURI().toURL().toExternalForm(); - } - - /** - * Gets a provider bundle which does not contain the metadata file. - * - * @return the url of the bundle + metadata - * @throws java.io.IOException - */ - public static String providerWithoutMetadata() throws IOException { - InputStream is = TinyBundles.bundle() - //.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml")) - .add(MyProvider.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Provider") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerWithoutMetadata"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - String url = out.toURI().toURL().toExternalForm(); - - return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("provider.xml"); - } - - /** - * Gets a provider bundle which does not contain the metadata file and using annotations. - * - * @return the url of the bundle without metadata - * @throws java.io.IOException - */ - public static String providerUsingAnnotation() throws IOException { - InputStream is = TinyBundles.bundle() - //.addResource("metadata.xml", this.getClass().getClassLoader().getResource("provider.xml")) - .add(MyProviderWithAnnotations.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Provider-with-annotations") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerUsingAnnotations"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - String url = out.toURI().toURL().toExternalForm(); - - return url; - } - - /** - * Gets a consumer bundle using annotation containing the instance - * declaration in the metadata. - * - * @return the url of the bundle - * @throws java.io.IOException - */ - public static String consumerWithMetadata() throws IOException { - InputStream is = TinyBundles.bundle() - .add("metadata.xml", OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml")) - .add(Consumer.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("consumerWithMetadata"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - return out.toURI().toURL().toExternalForm(); - } - - /** - * Gets a consumer bundle using annotation containing the instance - * declaration in the metadata. - * - * @return the url of the bundle - * @throws java.io.IOException - */ - public static String providerUsingModules() throws IOException { - InputStream is = TinyBundles.bundle() - .add(FrenchHelloService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderUsingModules") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerUsingModules"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - return out.toURI().toURL().toExternalForm(); - } - - public static String providerUsingAnnotatedStereotype() throws IOException { - InputStream is = TinyBundles.bundle() - .add(GermanHelloService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderUsingAnnotatedStereotype") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("providerUsingAnnotatedStereotype"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - return out.toURI().toURL().toExternalForm(); - } - - /** - * Gets a consumer bundle using annotation that does not contain - * metadata - * - * @return the url of the bundle + metadata - * @throws java.io.IOException - */ - public static String consumerWithoutMetadata() throws IOException { - InputStream is = TinyBundles.bundle() - .add(Consumer.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Consumer") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.test.online.services") - .build(); - - File out = getTemporaryFile("consumerWithoutMetadata"); - StreamUtils.copyStream(is, new FileOutputStream(out), true); - String url = out.toURI().toURL().toExternalForm(); - - return url + "!" + OnlineManipulatorTest.class.getClassLoader().getResource("consumer.xml"); - } - - - public void dumpServices() throws InvalidSyntaxException { - ServiceReference[] refs = context.getAllServiceReferences(null, null); - System.out.println(" === Services === "); - for (ServiceReference ref : refs) { - String[] itf = (String[]) ref.getProperty(Constants.OBJECTCLASS); - System.out.println(itf[0]); - } - System.out.println("===="); - } - - public void dumpBundles() throws InvalidSyntaxException { - Bundle[] bundles = context.getBundles(); - System.out.println(" === Bundles === "); - for (Bundle bundle : bundles) { - String sn = bundle.getSymbolicName(); - System.out.println(sn); - } - System.out.println("===="); - } - - private void assertBundle(String sn) { - for (Bundle bundle : context.getBundles()) { - if (bundle.getSymbolicName().equals(sn) - && bundle.getState() == Bundle.ACTIVE) { - return; - } - - } - Assert.fail("Cannot find the bundle " + sn); - } - - private void assertValidity() { - try { - ServiceReference[] refs = context.getServiceReferences(Architecture.class.getName(), null); - Assert.assertNotNull(refs); - for (ServiceReference ref : refs) { - InstanceDescription id = ((Architecture) context.getService(ref)).getInstanceDescription(); - int state = id.getState(); - Assert.assertEquals("State of " + id.getName(), ComponentInstance.VALID, state); - } - } catch (InvalidSyntaxException e) { - Assert.fail(e.getMessage()); - } - - } - - /** - * Waits for stability: - *
    - *
  • all bundles are activated - *
  • service count is stable - *
- * If the stability can't be reached after a specified time, - * the method throws a {@link IllegalStateException}. - * - * @param context the bundle context - * @throws IllegalStateException when the stability can't be reach after a several attempts. - */ - private void waitForStability(BundleContext context) throws IllegalStateException { - // Wait for bundle initialization. - boolean bundleStability = getBundleStability(context); - int count = 0; - while (!bundleStability && count < 500) { - try { - Thread.sleep(200); - } catch (InterruptedException e) { - // Interrupted - } - count++; - bundleStability = getBundleStability(context); - } - - if (count == 500) { - System.err.println("Bundle stability isn't reached after 500 tries"); - throw new IllegalStateException("Cannot reach the bundle stability"); - } - - boolean serviceStability = false; - count = 0; - int count1 = 0; - int count2 = 0; - while (!serviceStability && count < 500) { - try { - ServiceReference[] refs = context.getServiceReferences((String) null, null); - count1 = refs.length; - Thread.sleep(1000); - refs = context.getServiceReferences((String) null, null); - count2 = refs.length; - serviceStability = count1 == count2; - } catch (Exception e) { - System.err.println(e); - serviceStability = false; - // Nothing to do, while recheck the condition - } - count++; - } - - if (count == 500) { - System.err.println("Service stability isn't reached after 500 tries (" + count1 + " != " + count2); - throw new IllegalStateException("Cannot reach the service stability"); - } - } - - /** - * Are bundle stables. - * - * @param bc the bundle context - * @return true if every bundles are activated. - */ - private boolean getBundleStability(BundleContext bc) { - boolean stability = true; - Bundle[] bundles = bc.getBundles(); - for (Bundle bundle : bundles) { - stability = stability && (bundle.getState() == Bundle.ACTIVE); - } - return stability; - } - - -} diff --git a/ipojo/manipulator/manipulator-it/pom.xml b/ipojo/manipulator/manipulator-it/pom.xml deleted file mode 100644 index 536f0124dd..0000000000 --- a/ipojo/manipulator/manipulator-it/pom.xml +++ /dev/null @@ -1,413 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - - 4.0.0 - org.apache.felix.ipojo.manipulator.manipulator-it - 1.13.1-SNAPSHOT - Apache Felix iPOJO Manipulator ~ Integration Tests - pom - - - - true - - 3.0.3 - 1.5.2 - - 4.4.0 - 3.9.0.v20130529-1710 - 6.0.2 - - - - ipojo-manipulator-manipulation-test - ipojo-manipulator-creation-test - ipojo-manipulator-manipulation-metadata-test - online-manipulator-it - - - - - - org.apache.felix - ipojo-manipulator-bom - ${project.version} - pom - import - - - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.8 - 1.8 - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.5.0 - - - generate-config - - generate-depends-file - - - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - src/it/**/target/** - - - - - - maven-deploy-plugin - - true - - - - - org.apache.maven.plugins - maven-surefire-plugin - - ${skipTestExecution} - - - ${TIME_FACTOR} - - ${pax.exam.framework} - - - - - - - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - junit - junit - 4.13.2 - test - - - - org.mockito - mockito-all - 1.9.5 - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - - - - xerces - xercesImpl - 2.12.2 - - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - test - - - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - - org.apache.felix - org.apache.felix.ipojo - - - - 1.12.0 - provided - - - - org.apache.felix - org.apache.felix.ipojo.manipulator.online - ${project.version} - provided - - - - - - org.apache.felix - org.apache.felix.configadmin - 1.6.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.1 - test - - - org.osgi - org.osgi.core - - - org.slf4j - slf4j-api - - - - - - org.apache.felix - org.apache.felix.log - 1.0.1 - - - org.osgi - org.osgi.core - - - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - org.easytesting - fest-assert - 1.4 - - - - - - default - - true - - - none - - - - org.osgi - org.osgi.compendium - 4.3.0 - - - org.osgi - org.osgi.core - 4.3.1 - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - https://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - ${knoperflerfish.version} - test - - - - org.osgi - org.osgi.core - 4.3.1 - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.osgi - org.osgi.compendium - 4.3.0 - - - org.eclipse.tycho - org.eclipse.osgi - ${equinox.version} - test - - - - org.osgi - org.osgi.core - 4.3.1 - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - ${felix.version} - - - - - - test - - false - - - - diff --git a/ipojo/manipulator/manipulator-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/manipulator-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/manipulator/manipulator/changelog.txt b/ipojo/manipulator/manipulator/changelog.txt deleted file mode 100644 index a78c45c0a9..0000000000 --- a/ipojo/manipulator/manipulator/changelog.txt +++ /dev/null @@ -1,249 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST - * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account. - * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata - * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames - * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable - * [FELIX-3574] - IPojo bytecode manipulation looses method argument names - * [FELIX-3621] - Two dimensional array as argument to a method in a component - -Changes from the 1.8.2 to 1.8.4 -------------------------------- - -** Bug - * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException - * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7 - * [FELIX-3389] - Bnd iPOJO Plugin ignores annotated components - * [FELIX-3391] - Unexpected warning when using bnd-ipojo-plugin - -** Improvement - * [FELIX-3384] - Ensure maven-ipojo-plugin is thread-safe for parallel maven builds - -Changes from the 1.8.0 to 1.8.2 -------------------------------- - -** Bug - * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files - * [FELIX-3012] - "Duplicate name&signature" problem - * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter - * [FELIX-3145] - VerifyError on Java 7 - * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest - -** Improvement - * [FELIX-3017] - The manipulator should return the original class if it's already manipulated - * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator - * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities - * [FELIX-3080] - Implement a BND plugin for iPOJO - * [FELIX-3131] - Elements and attributes should conserve the insertion order - * [FELIX-3204] - @Temporal should handle instantiation-time properties - * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible - -Changes from the 1.6.4 to 1.8.0 -------------------------------- -** Bug - * [FELIX-2779] - iPOJO manipulator badly supports custom annotation attributes of type Class - * [FELIX-2664] - Native methods should not be manipulated - -** Improvement - * [FELIX-1424] - Constructor Injection - * [FELIX-1428] - Constructor injection of Configuration properties - * [FELIX-2620] - Change iPojo annotation parameters to follow java naming conventions - * [FELIX-2621] - Rename annotations to remove collisions - * [FELIX-2622] - Support static service properties that are not mirrored into fields - * [FELIX-2630] - Rename @Component attributes to follow the java naming conventions - * [FELIX-2732] - [iPOJO] Service modified callback should define a default method name - * [FELIX-2742] - Constructor injection of service dependencies - * [FELIX-2743] - Modify Pojoization to be more easily customizable - * [FELIX-2755] - Allow the manipulator and the different front end to use several metadata files - -Changes from the 1.6.2 to 1.6.4 -------------------------------- -** Bug - * [FELIX-2430] - IPOJO manipulation (ant task) results in invalid classes throwing java.lang.VerifyError at runtime in InstanceManager - -** Improvement - * [FELIX-2420] - Enum support for @Property annotation - * [FELIX-2461] - Allow specifying the targeted service interface in the @ServiceController - * [FELIX-2485] - Improve the performance of the manipulator on large files - * [FELIX-2542] - Annotations on methods parameters are not moved on public methods after manipulation - -Changes from the 1.6.0 to 1.6.2 -------------------------------- -** Improvement - * [FELIX-2296] - Access to ServiceReference in iPOJO service. - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1646] - Add @Handler annotation to declare handlers without metadata.xml - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - -** Wish - * [FELIX-1940] - Add @Instance annotation to declare instances without metadata.xml - - -Changes from the 1.4.0 to 1.4.2 -------------------------------- -** Bug - * [FELIX-1411] - Issue on windows to find components inside bundle - * [FELIX-1518] - iPOJO manipulator is really slow even when annotation are ignored - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1302] - Manipulator never ignore annotations - * [FELIX-1319] - Issue in the metadata overiding analysis in iPOJO annotations - -** Improvement - * Update parent pom - * [FELIX-943] - Allow iPOJO manipulator to manipulate directories - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-788] - Failed to create object that extends super class with BundleContext argument - -** Improvement - * [FELIX-813] - Resolve XML-Schemas locally rather than from Internet - * [FELIX-830] - Simplify the "id/parent" resolution to compute the metadata hierarchy during annotation processing - * [FELIX-846] - Enhance the iPojo maven plugin to take metadata from pom. - * [FELIX-876] - Specification auto import is not supported for simple component types - - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Bug - * [FELIX-649] - "Expecting to find object/array on stack" Error when asking for instance of an iPOJO component - * [FELIX-697] - Generation of a duplicated field when using generics - * [FELIX-739] - iPOJO and annotations support when manipulating - * [FELIX-751] - Wrong access for setter methods - -** Improvement - * [FELIX-655] - Add a 'from' attribute in the service dependencies - * [FELIX-678] - Improve missing fields detection during the packaging process - * [FELIX-687] - Support inner and nested classes - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/manipulator/manipulator/pom.xml b/ipojo/manipulator/manipulator/pom.xml deleted file mode 100644 index 4df86442de..0000000000 --- a/ipojo/manipulator/manipulator/pom.xml +++ /dev/null @@ -1,197 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - bundle - org.apache.felix.ipojo.manipulator - 1.13.1-SNAPSHOT - Apache Felix iPOJO Manipulator - - - iPOJO bytecode manipulator. This manipulator is used to instrument java classes in order to be managed by iPOJO. - - - - [1.12.1,2.0.0) - 9.6 - - - - - org.ow2.asm - asm - ${asm.version} - - - org.ow2.asm - asm-tree - ${asm.version} - - - org.ow2.asm - asm-commons - ${asm.version} - - - org.ow2.asm - asm-util - ${asm.version} - - - org.apache.felix - org.apache.felix.ipojo.metadata - 1.6.0 - - - org.apache.felix - org.apache.felix.ipojo.annotations - ${project.version} - - - org.mockito - mockito-all - 1.9.5 - test - - - org.osgi - org.osgi.core - 4.2.0 - test - - - commons-io - commons-io - 2.14.0 - test - - - org.easytesting - fest-assert - 1.4 - test - - - - - commons-codec - commons-codec - 1.13 - test - - - - junit - junit - 4.13.2 - test - - - - - - src/main/resources - true - - - - - org.apache.felix - maven-bundle-plugin - 5.1.9 - true - - - iPOJO Manipulator - ${project.artifactId} - The Apache Software Foundation - iPOJO Manipulator - org.apache.felix.ipojo.manipulator.* - - org.apache.felix.ipojo.manipulation, - org.apache.felix.ipojo.xml.parser, org.objectweb.asm, - org.objectweb.asm.commons, org.objectweb.asm.tree - - - NONE - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module - - src/test/resources/MANIFEST.MF - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - - diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index caa7b23fd9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,11 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -III. Overall License Summary -- Apache License 2.0 -- BSD License diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index 9a2eac1d14..0000000000 --- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Manipulator: - -The Apache Felix iPOJO Manipulator includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 016e60dffa..0000000000 --- a/ipojo/manipulator/manipulator/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,3 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java deleted file mode 100644 index 4e3646de38..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassChecker.java +++ /dev/null @@ -1,857 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.objectweb.asm.*; - -import java.util.*; - -/** - * Checks that a POJO is already manipulated or not. - * Moreover it allows to get manipulation data about this class. - * - * @author Felix Project Team - */ -public class ClassChecker extends ClassVisitor implements Opcodes { - - /** - * True if the class is already manipulated. - */ - private boolean m_isAlreadyManipulated = false; - - /** - * Interfaces implemented by the component. - */ - private List m_itfs = new ArrayList(); - - /** - * Field map [field name, type] discovered in the component class. - */ - private Map m_fields = new TreeMap(); - - /** - * Collection of final fields - */ - private Set m_finalFields=new HashSet<>(); - - /** - * Method List of method descriptor discovered in the component class. - */ - private List m_methods = new ArrayList(); - - /** - * Super class if not java.lang.Object. - */ - private String m_superClass; - - /** - * Class name. - */ - private String m_className; - - /** - * List of visited inner class owned by the implementation class. - */ - private Map> m_inners = new LinkedHashMap>(); - - /** - * Class Version. - * Used to determine the frame format. - */ - private int m_classVersion; - - public ClassChecker() { - super(Opcodes.ASM9); - } - - /** - * Check if the _cm field already exists. - * Update the field list. - * - * @param access : access of the field - * @param name : name of the field - * @param desc : description of the field - * @param signature : signature of the field - * @param value : value of the field (for static field only) - * @return the field visitor - * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object) - */ - public FieldVisitor visitField(int access, String name, String desc, - String signature, Object value) { - if (name.equals(ClassManipulator.IM_FIELD) - && desc.equals("Lorg/apache/felix/ipojo/InstanceManager;")) { - m_isAlreadyManipulated = true; - } else if (name.startsWith("class$")) { // Does not add class$* field generated by 'x.class' - return null; - } else if ((access & ACC_STATIC) == ACC_STATIC) { - return null; - } - - if (isManipulatedField(name)) { - return null; - } - - Type type = Type.getType(desc); - if (type.getSort() == Type.ARRAY) { - if (type.getInternalName().startsWith("L")) { - String internalType = type.getInternalName().substring(1); - String nameType = internalType.replace('/', '.'); - m_fields.put(name, nameType + "[]"); - } else { - String nameType = type.getClassName().substring(0, - type.getClassName().length() - 2); - m_fields.put(name, nameType + "[]"); - } - } else { - m_fields.put(name, type.getClassName()); - } - if ((access & ACC_FINAL) == ACC_FINAL) { - m_finalFields.add(name); - } - - return null; - } - - private boolean isManipulatedField(String name) { - return ((ClassManipulator.IM_FIELD.equals(name)) - || (name.startsWith(ClassManipulator.FIELD_FLAG_PREFIX)) - || (name.startsWith(ClassManipulator.METHOD_FLAG_PREFIX))); - } - - /** - * Add the inner class to the list of inner class to manipulate. - * The method checks that the inner class is really owned by the implementation class. - * - * @param name inner class qualified name - * @param outerName outer class name (may be null for anonymous class) - * @param innerName inner class simple (i.e. short) name - * @param access inner class visibility - * @see org.objectweb.asm.ClassVisitor#visitInnerClass(java.lang.String, java.lang.String, java.lang.String, int) - */ - public void visitInnerClass(String name, String outerName, String innerName, int access) { - if (m_className.equals(outerName) || outerName == null) { // Anonymous classes does not have an outer class. - // Do not include inner static class - if (!((access & ACC_STATIC) == ACC_STATIC)) { - m_inners.put(name, new ArrayList()); - } - } - } - - - /** - * Check if the class was already manipulated. - * - * @return true if the class is already manipulated. - */ - public boolean isAlreadyManipulated() { - return m_isAlreadyManipulated; - } - - /** - * Gets the extracted class version - * - * @return the class version. - */ - public int getClassVersion() { - return m_classVersion; - } - - /** - * Visit the class. - * Update the implemented interface list. - * - * @param version : version of the class - * @param access : access of the class - * @param name : name of the class - * @param signature : signature of the class - * @param superName : super class of the class - * @param interfaces : implemented interfaces. - * @see org.objectweb.asm.ClassVisitor#visit(int, int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) - */ - public void visit(int version, int access, String name, String signature, - String superName, String[] interfaces) { - - m_classVersion = version; - - if (!superName.equals("java/lang/Object")) { - m_superClass = superName.replace('/', '.'); - } - - for (String anInterface : interfaces) { - if (!anInterface.equals("org/apache/felix/ipojo/Pojo")) { - m_itfs.add(anInterface.replace('/', '.')); - } - } - - m_className = name; - } - - /** - * Visit a method. - * Update the method list (except if it init or clinit. - * - * @param access - the method's access flags (see Opcodes). This parameter also indicates if the method is synthetic and/or deprecated. - * @param name - the method's name. - * @param desc - the method's descriptor (see Type). - * @param signature - the method's signature. May be null if the method parameters, return type and exceptions do not use generic types. - * @param exceptions - the internal names of the method's exception classes (see getInternalName). May be null. - * @return nothing. - * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) - */ - public MethodVisitor visitMethod(int access, String name, String desc, - String signature, String[] exceptions) { - if (!name.equals("")) { - - if (name.equals("")) { - if (!isGeneratedConstructor(name, desc)) { - final MethodDescriptor md = new MethodDescriptor("$init", desc, (access & ACC_STATIC) == ACC_STATIC); - m_methods.add(md); - return new MethodInfoCollector(md); - } - } else { - // no constructors. - if (!isGeneratedMethod(name, desc)) { - final MethodDescriptor md = new MethodDescriptor(name, desc, (access & ACC_STATIC) == ACC_STATIC); - m_methods.add(md); - return new MethodInfoCollector(md); - } - } - - } - - if (name.equals("")) { - return new InnerClassAssignedToStaticFieldDetector(); - } - - return null; - } - - public static boolean isGeneratedConstructor(String name, String desc) { - return ("".equals(name) && isFirstArgumentInstanceManager(desc)); - } - - public static boolean isFirstArgumentInstanceManager(String desc) { - Type[] types = Type.getArgumentTypes(desc); - return types != null && (types.length >= 1) - && Type.getType("Lorg/apache/felix/ipojo/InstanceManager;").equals(types[0]); - } - - public static boolean isGeneratedMethod(String name, String desc) { - return isGetterMethod(name, desc) - || isSetterMethod(name, desc) - || isSetInstanceManagerMethod(name) - || isGetComponentInstanceMethod(name, desc) - || isManipulatedMethod(name); - } - - private static boolean isGetterMethod(String name, String desc) { - // TYPE __getXXX() - Type[] arguments = Type.getArgumentTypes(desc); - return (name.startsWith("__get") - && (arguments.length == 0) - && !Type.VOID_TYPE.equals(Type.getReturnType(desc))); - } - - private static boolean isSetterMethod(String name, String desc) { - // void __setXXX(TYPE) - Type[] arguments = Type.getArgumentTypes(desc); - return (name.startsWith("__set") - && (arguments.length == 1) - && Type.VOID_TYPE.equals(Type.getReturnType(desc))); - } - - private static boolean isSetInstanceManagerMethod(String name) { - return name.startsWith("_setInstanceManager"); - } - - private static boolean isGetComponentInstanceMethod(String name, String desc) { - return (name.startsWith("getComponentInstance") - && Type.getType("Lorg/apache/felix/ipojo/ComponentInstance;").equals(Type.getReturnType(desc))); - } - - private static boolean isManipulatedMethod(String name) { - return (name.startsWith(ClassManipulator.PREFIX)); - } - - /** - * Get collected interfaces. - * - * @return the interfaces implemented by the component class. - */ - public List getInterfaces() { - return m_itfs; - } - - /** - * Get collected fields. - * - * @return the field map [field_name, type]. - */ - public Map getFields() { - return m_fields; - } - - public Set getFinalFields(){ - return m_finalFields; - } - /** - * Get collected methods. - * - * @return the method list of [method, signature]. - */ - public List getMethods() { - return m_methods; - } - - public String getSuperClass() { - return m_superClass; - } - - public Collection getInnerClasses() { - return m_inners.keySet(); - } - - public Map> getInnerClassesAndMethods() { - return m_inners; - } - - public String getClassName() { - return m_className; - } - - /** - * This class collects annotations in a method. - * This class creates an {@link AnnotationDescriptor} - * if an annotation is found during the visit. - * It also collects local variables definition. - * - * @author Felix Project Team - */ - private final class MethodInfoCollector extends MethodVisitor { - /** - * The method descriptor of the visited method. - */ - private MethodDescriptor m_method; - - /** - * Creates an annotation collector. - * - * @param md the method descriptor of the visited method. - */ - private MethodInfoCollector(MethodDescriptor md) { - super(Opcodes.ASM9); - m_method = md; - } - - /** - * Visits an annotation. - * This class checks the visibility. If the annotation is visible, - * creates the {@link AnnotationDescriptor} corresponding to this annotation - * to visit this annotation. This {@link AnnotationDescriptor} is added to - * the {@link MethodDescriptor} of the visited method. - * - * @param name the name of the annotation - * @param visible is the annotation visible at runtime - * @return the {@link AnnotationDescriptor} to visit this annotation or - * null if the annotation is not visible. - * @see org.objectweb.asm.MethodVisitor#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String name, boolean visible) { - if (visible) { - AnnotationDescriptor ann = new AnnotationDescriptor(name, true); - m_method.addAnnotation(ann); - return ann; - } - return null; - } - - public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { - m_method.addLocalVariable(name, desc, signature, index); - } - - public void visitEnd() { - m_method.end(); - } - - public AnnotationVisitor visitParameterAnnotation(int id, - String name, boolean visible) { - if (visible) { - AnnotationDescriptor ann = new AnnotationDescriptor(name, true); - m_method.addParameterAnnotation(id, ann); - return ann; - } - - /* - * It is harmless to keep injected parameter annotations on original constructor - * for correct property resolution in case of re-manipulation - */ - if (m_method.getName().equals("$init")) { - AnnotationDescriptor ann = new AnnotationDescriptor(name, false); - m_method.addParameterAnnotation(id, ann); - return ann; - } - - return null; - } - - - } - - /** - * Describes a method or constructor annotation. - * This allows creating a copy of the annotations found in the original class - * to move them on inserted method. This class implements an - * {@link AnnotationVisitor} in order to create the copy. - * This class contains a visit method re-injecting the - * annotation in the generated method. - * - * @author Felix Project Team - */ - public class AnnotationDescriptor extends AnnotationVisitor { - /** - * The name of the annotation. - */ - private String m_name; - /** - * Is the annotation visible at runtime? - */ - private boolean m_visible; - /** - * The description of the annotation. - * This attribute is set only for nested annotations. - */ - private String m_desc; - /** - * The list of 'simple' attributes. - */ - private List m_simples = new ArrayList(0); - /** - * The list of attribute containing an - * enumeration value. - */ - private List m_enums = new ArrayList(0); - /** - * The list of attribute which are - * annotations. - */ - private List m_nested = new ArrayList(0); - /** - * The list of attribute which are - * arrays. - */ - private List m_arrays = new ArrayList(0); - - - /** - * Creates an annotation descriptor. - * This constructor is used for 'root' annotations. - * - * @param name the name of the annotation - * @param visible the visibility of the annotation at runtime - */ - public AnnotationDescriptor(String name, boolean visible) { - super(Opcodes.ASM9); - m_name = name; - m_visible = visible; - } - - /** - * Creates an annotation descriptor. - * This constructor is used for nested annotations. - * - * @param name the name of the annotation - * @param desc the descriptor of the annotation - */ - public AnnotationDescriptor(String name, String desc) { - super(Opcodes.ASM9); - m_name = name; - m_visible = true; - m_desc = desc; - } - - - /** - * Visits a simple attribute. - * - * @param arg0 the attribute name - * @param arg1 the attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String arg0, Object arg1) { - m_simples.add(new SimpleAttribute(arg0, arg1)); - } - - - /** - * Visits a nested annotation. - * - * @param arg0 the attribute name - * @param arg1 the annotation descriptor - * @return the annotation visitor parsing the nested annotation - * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(java.lang.String, java.lang.String) - */ - public AnnotationVisitor visitAnnotation(String arg0, String arg1) { - AnnotationDescriptor ad = new AnnotationDescriptor(arg0, arg1); - m_nested.add(ad); - return ad; - } - - - /** - * Visits an array attribute. - * - * @param arg0 the name of the attribute - * @return the annotation visitor parsing the content of the array, - * uses a specific {@link ArrayAttribute} to parse this array - * @see org.objectweb.asm.AnnotationVisitor#visitArray(java.lang.String) - */ - public AnnotationVisitor visitArray(String arg0) { - ArrayAttribute aa = new ArrayAttribute(arg0); - m_arrays.add(aa); - return aa; - } - - - /** - * End of the visit. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - } - - - /** - * Visits an enumeration attribute. - * - * @param arg0 the attribute name - * @param arg1 the enumeration descriptor - * @param arg2 the attribute value - * @see org.objectweb.asm.AnnotationVisitor#visitEnum(java.lang.String, java.lang.String, java.lang.String) - */ - public void visitEnum(String arg0, String arg1, String arg2) { - m_enums.add(new EnumAttribute(arg0, arg1, arg2)); - } - - /** - * Methods allowing to recreate the visited (stored) annotation - * into the destination method. - * This method recreate the annotations itself and any other - * attributes. - * - * @param mv the method visitor visiting the destination method. - */ - public void visitAnnotation(MethodVisitor mv) { - AnnotationVisitor av = mv.visitAnnotation(m_name, m_visible); - for (SimpleAttribute simple : m_simples) { - simple.visit(av); - } - for (EnumAttribute en : m_enums) { - en.visit(av); - } - for (AnnotationDescriptor nested : m_nested) { - nested.visit(av); - } - for (ArrayAttribute array : m_arrays) { - array.visit(av); - } - av.visitEnd(); - } - - /** - * Methods allowing to recreate the visited (stored) parameter annotations - * into the destination method. - * This method recreate the annotations itself and any other - * attributes. - * - * @param id the paramter id - * @param mv the method visitor visiting the destination method. - */ - public void visitParameterAnnotation(int id, MethodVisitor mv) { - AnnotationVisitor av = mv.visitParameterAnnotation(id, m_name, m_visible); - for (SimpleAttribute simple : m_simples) { - simple.visit(av); - } - for (EnumAttribute en : m_enums) { - en.visit(av); - } - for (AnnotationDescriptor nested : m_nested) { - nested.visit(av); - } - for (ArrayAttribute array : m_arrays) { - array.visit(av); - } - av.visitEnd(); - } - - /** - * Method allowing to recreate the visited (stored) annotation - * into the destination annotation. This method is used only - * for nested annotation. - * - * @param mv the annotation visitor to populate with the stored - * annotation - */ - public void visit(AnnotationVisitor mv) { - AnnotationVisitor av = mv.visitAnnotation(m_name, m_desc); - for (SimpleAttribute simple : m_simples) { - simple.visit(av); - } - for (EnumAttribute enu : m_enums) { - enu.visit(av); - } - for (AnnotationDescriptor nested : m_nested) { - nested.visit(av); - } - for (ArrayAttribute array : m_arrays) { - array.visit(av); - } - av.visitEnd(); - } - - - } - - /** - * Describes an array attribute. - * This class is able to visit an annotation array attribute, and to - * recreate this array on another annotation. - * - * @author Felix Project Team - */ - public class ArrayAttribute extends AnnotationVisitor { - /** - * The name of the attribute. - */ - private String m_name; - /** - * The content of the parsed array. - */ - private List m_content = new ArrayList(); - - /** - * Creates an array attribute. - * - * @param name the name of the attribute. - */ - public ArrayAttribute(String name) { - super(Opcodes.ASM9); - m_name = name; - } - - /** - * Visits the content of the array. This method is called for - * simple values. - * - * @param arg0 null - * @param arg1 the value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String arg0, Object arg1) { - m_content.add(arg1); - } - - /** - * Visits the content of the array. This method is called for - * nested annotations (annotations contained in the array). - * - * @param arg0 null - * @param arg1 the annotation descriptor - * @return an {@link AnnotationDescriptor} which creates a copy of - * the contained annotation. - * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(String, String) - */ - public AnnotationVisitor visitAnnotation(String arg0, String arg1) { - AnnotationDescriptor ad = new AnnotationDescriptor(null, arg1); - m_content.add(ad); - return ad; - } - - /** - * Visits the content of the array. This method is called for - * nested arrays (arrays contained in the array). - * - * @param arg0 null - * @return an {@link AnnotationVisitor} which creates a copy of - * the contained array. - * @see org.objectweb.asm.AnnotationVisitor#visitArray(String) - */ - public AnnotationVisitor visitArray(String arg0) { - ArrayAttribute aa = new ArrayAttribute(null); - m_content.add(aa); - return aa; - } - - /** - * End of the array attribute visit. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - } - - /** - * Visits the content of the array. This method is called for - * enumeration values. - * - * @param arg0 null - * @param arg1 the enumeration descriptor - * @param arg2 the value - * @see org.objectweb.asm.AnnotationVisitor#visitEnum(String, String, String) - */ - public void visitEnum(String arg0, String arg1, String arg2) { - EnumAttribute ea = new EnumAttribute(null, arg1, arg2); - m_content.add(ea); - } - - /** - * Recreates the visited array attribute. This method - * handle the generation of the object embedded in the - * array. - * - * @param av the annotation visitor on which the array attribute - * needs to be injected. - */ - public void visit(AnnotationVisitor av) { - AnnotationVisitor content = av.visitArray(m_name); - for (Object component : m_content) { - if (component instanceof AnnotationDescriptor) { - ((AnnotationDescriptor) component).visit(content); - } else if (component instanceof EnumAttribute) { - ((EnumAttribute) component).visit(content); - } else if (component instanceof ArrayAttribute) { - ((ArrayAttribute) component).visit(content); - } else { // Simple - content.visit(null, component); - } - } - content.visitEnd(); - } - - } - - /** - * Describes a simple attribute. - * This class is able to visit an annotation simple attribute, and to - * recreate this attribute on another annotation. - * - * @author Felix Project Team - */ - public static final class SimpleAttribute { - /** - * The name of the attribute. - */ - private String m_name; - /** - * The value of the attribute. - */ - private Object m_value; - - /** - * Creates a simple attribute. - * - * @param name the name of the attribute - * @param object the value of the attribute - */ - private SimpleAttribute(String name, Object object) { - m_name = name; - m_value = object; - } - - /** - * Recreates the attribute on the given annotation. - * - * @param visitor the visitor on which the attribute needs - * to be injected. - */ - public void visit(AnnotationVisitor visitor) { - visitor.visit(m_name, m_value); - } - } - - /** - * Describes an attribute. The value of this attribute is an enumerated - * value. - * This class is able to visit an annotation enumeration attribute, and to - * recreate this attribute on another annotation. - * - * @author Felix Project Team - */ - public static final class EnumAttribute { - /** - * The name of the attribute. - */ - private String m_name; - /** - * The descriptor of the enumeration. - */ - private String m_desc; - /** - * The value of the attribute. - */ - private String m_value; - - /** - * Creates a enumeration attribute. - * - * @param name the name of the attribute. - * @param desc the descriptor of the {@link Enum} - * @param value the enumerated value - */ - private EnumAttribute(String name, String desc, String value) { - m_name = name; - m_value = value; - m_desc = desc; - } - - /** - * Recreates the attribute on the given annotation. - * - * @param visitor the visitor on which the attribute needs - * to be injected. - */ - public void visit(AnnotationVisitor visitor) { - visitor.visitEnum(m_name, m_desc, m_value); - } - - } - - - /** - * Class required to detect inner classes assigned to static field and thus must not be manipulated (FELIX-4347). - * If an inner class is assigned to a static field, it must not be manipulated. - *

- * However notice that this is only useful when AspectJ is used, because aspectJ is changing the 'staticity' of - * the inner class. - */ - private class InnerClassAssignedToStaticFieldDetector extends MethodVisitor { - - public InnerClassAssignedToStaticFieldDetector() { - super(Opcodes.ASM9); - } - - @Override - public void visitTypeInsn(int opcode, String type) { - if (opcode == NEW && m_inners.containsKey(type)) { - m_inners.remove(type); - } - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassLoaderAwareClassWriter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassLoaderAwareClassWriter.java deleted file mode 100644 index dc03688af8..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassLoaderAwareClassWriter.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.objectweb.asm.ClassWriter; - -/** - * An extension of {@link org.objectweb.asm.ClassWriter} that uses a specific classloader to load classes. - */ -public class ClassLoaderAwareClassWriter extends ClassWriter { - - private static final String OBJECT_INTERNAL_NAME = "java/lang/Object"; - private final String className; - private final String superClass; - private final ClassLoader classLoader; - - public ClassLoaderAwareClassWriter(int flags, String className, String superClass, ClassLoader loader) { - super(flags); - this.className = className; - this.superClass = superClass; - this.classLoader = loader; - } - - /** - * Implements the common super class lookup to be a bit more permissive. First we check is type1 == type2, - * because in this case, the lookup is done. Then, if one of the class is Object, - * returns object. If both checks failed, it returns Object. - * - * @param type1 the first class - * @param type2 the second class - * @return the common super class - */ - @Override - protected final String getCommonSuperClass(String type1, String type2) { - //If the two are equal then return either - if (type1.equals(type2)) { - return type1; - } - - //If either is Object, then Object must be the answer - if (type1.equals(OBJECT_INTERNAL_NAME) || type2.equals(OBJECT_INTERNAL_NAME)) { - return OBJECT_INTERNAL_NAME; - } - - // If either of these class names are the current class then we can short - // circuit to the superclass (which we already know) - if (type1.equals(className.replace(".", "/")) && superClass != null) { - return getCommonSuperClass(superClass.replace(".", "/"), type2); - } else if (type2.equals(className.replace(".", "/")) && superClass != null) - return getCommonSuperClass(type1, superClass.replace(".", "/")); - - Class c, d; - try { - c = classLoader.loadClass(type1.replace('/', '.')); - d = classLoader.loadClass(type2.replace('/', '.')); - } catch (Exception e) { - throw new RuntimeException(e.toString()); - } - if (c.isAssignableFrom(d)) { - return type1; - } - if (d.isAssignableFrom(c)) { - return type2; - } - if (c.isInterface() || d.isInterface()) { - return "java/lang/Object"; - } else { - do { - c = c.getSuperclass(); - } while (!c.isAssignableFrom(d)); - return c.getName().replace('.', '/'); - } - } -} - diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java deleted file mode 100644 index be509a82d9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ClassManipulator.java +++ /dev/null @@ -1,1184 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.apache.felix.ipojo.manipulation.ClassChecker.AnnotationDescriptor; -import org.objectweb.asm.*; -import org.objectweb.asm.commons.GeneratorAdapter; -import org.objectweb.asm.tree.LocalVariableNode; - -import java.util.*; - -/** - * iPOJO Class Adapter. - * This class adapt the visited class to link the class with the container. - * @author Felix Project Team - */ -public class ClassManipulator extends ClassVisitor implements Opcodes { - - /** - * Instance Manager Field. - */ - public static final String IM_FIELD = "__IM"; - - /** - * All POJO method will be renamed by using this prefix. - */ - public static final String PREFIX = "__M_"; - - /** - * POJO class. - */ - private static final String POJO = "org/apache/felix/ipojo/Pojo"; - - /** - * Filed flag prefix. - */ - public static final String FIELD_FLAG_PREFIX = "__F"; - - /** - * Method flag prefix. - */ - public static final String METHOD_FLAG_PREFIX = "__M"; - - /** - * onEntry method name. - */ - public static final String ENTRY = "onEntry"; - - /** - * onExit method name. - */ - public static final String EXIT = "onExit"; - - /** - * on Error method name. - */ - public static final String ERROR = "onError"; - - /** - * onGet method name. - */ - private static final String GET = "onGet"; - - /** - * onSet method name. - */ - private static final String SET = "onSet"; - - /** - * The manipulator. It has already collected all the metadata about the class. - */ - private final Manipulator m_manipulator; - - /** - * Name of the current manipulated class. - */ - private String m_owner; - - /** - * Set of fields detected in the class. - * (this set is given by the previous analysis) - */ - private Set m_fields; - - /** - * Set of final fields detected in the class - */ - private Set m_finalFields; - - /** - * List of methods contained in the class. - * This set contains method id. - */ - private List m_methods = new ArrayList(); - - /** - * List of fields injected as method flag in the class. - * This set contains field name generate from method id. - */ - private List m_methodFlags = new ArrayList(); - - /** - * The list of methods visited during the previous analysis. - * This list allows getting annotations to move to generated - * method. - */ - private List m_visitedMethods = new ArrayList(); - - /** - * Set to true when a suitable constructor - * is found. If not set to true at the end - * of the visit, the manipulator injects a constructor. - */ - private boolean m_foundSuitableConstructor = false; - - /** - * Name of the super class. - */ - private String m_superclass; - - /** - * Constructor. - * @param visitor : class visitor. - * @param manipulator : the manipulator having analyzed the class. - */ - public ClassManipulator(ClassVisitor visitor, Manipulator manipulator) { - super(Opcodes.ASM9, visitor); - m_manipulator = manipulator; - m_fields = manipulator.getFields().keySet(); - m_finalFields = manipulator.getFinalFields(); - m_visitedMethods = manipulator.getMethods(); - } - - /** - * Visit method. - * This method store the current class name. - * Moreover the POJO interface is added to the list of implemented interface. - * Then the Instance manager field is added. - * @param version : version - * @param access : access flag - * @param name : class name - * @param signature : signature - * @param superName : parent class - * @param interfaces : implemented interface - * @see org.objectweb.asm.ClassVisitor#visit(int, int, java.lang.String, java.lang.String, java.lang.String, - * java.lang.String[]) - */ - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - m_owner = name; - m_superclass = superName; - addPOJOInterface(version, access, name, signature, superName, interfaces); - addIMField(); - addFlagsForInnerClassMethods(); - } - - /** - * A method is visited. - * This method does not manipulate clinit and class$ methods. - * In the case of a constructor, this method will generate a constructor with the instance manager - * and will adapt the current constructor to call this constructor. - * For standard method, this method will create method header, rename the current method and adapt it. - * @param access : access flag. - * @param name : name of the method - * @param desc : method descriptor - * @param signature : signature - * @param exceptions : declared exceptions. - * @return the MethodVisitor wich will visit the method code. - * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, - * java.lang.String[]) - */ - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - // Avoid manipulating special methods - if (name.equals("") || name.equals("class$")) { return super.visitMethod(access, name, desc, signature, exceptions); } - // The constructor is manipulated separately - if (name.equals("")) { - MethodDescriptor md = getMethodDescriptor("$init", desc); - // 1) change the constructor descriptor (add a component manager arg as first argument) - String newDesc = desc.substring(1); - newDesc = "(Lorg/apache/felix/ipojo/InstanceManager;" + newDesc; - - Type[] args = Type.getArgumentTypes(desc); - - // TODO HERE ! => All constructor matches, no distinction between the different constructors. - generateConstructor(access, desc, signature, exceptions, md.getAnnotations(), - md.getParameterAnnotations(), md.getLocals()); - - if (args.length == 0) { - m_foundSuitableConstructor = true; - } else if (args.length == 1 && args[0].getClassName().equals("org.osgi.framework.BundleContext")) { - m_foundSuitableConstructor = true; - } - - // Insert the new constructor - MethodVisitor mv = super.visitMethod(ACC_PRIVATE, "", newDesc, signature, exceptions); - return new ConstructorCodeAdapter(mv, m_owner, m_fields, m_finalFields, ACC_PRIVATE, name, newDesc, m_superclass); - } - - if ((access & ACC_SYNTHETIC) == ACC_SYNTHETIC && name.startsWith("access$")) { - MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - return new MethodCodeAdapter(mv, m_owner, access, name, desc, m_fields); - } - - // Do nothing on static methods - if ((access & ACC_STATIC) == ACC_STATIC) { return super.visitMethod(access, name, desc, signature, exceptions); } - - // Do nothing on native methods - if ((access & ACC_NATIVE) == ACC_NATIVE) { return super.visitMethod(access, name, desc, signature, exceptions); } - - MethodDescriptor md = getMethodDescriptor(name, desc); - if (md == null) { - generateMethodHeader(access, name, desc, signature, exceptions, null, null, null); - } else { - generateMethodHeader(access, name, desc, signature, exceptions, md.getArgumentLocalVariables(), - md.getAnnotations(), md.getParameterAnnotations()); - } - - // TODO Also add the method flags for inner class methods. - String id = generateMethodFlag(name, desc); - if (! m_methodFlags.contains(id)) { - FieldVisitor flagField = cv.visitField(0, id, "Z", null, null); - flagField.visitEnd(); - m_methodFlags.add(id); - } - - MethodVisitor mv = super.visitMethod(ACC_PRIVATE, PREFIX + name, desc, signature, exceptions); - return new MethodCodeAdapter(mv, m_owner, ACC_PRIVATE, PREFIX + name, desc, m_fields); - } - - /** - * Gets the method descriptor for the specified name and descriptor. - * The method descriptor is looked inside the - * {@link ClassManipulator#m_visitedMethods} - * @param name the name of the method - * @param desc the descriptor of the method - * @return the method descriptor or null if not found. - */ - private MethodDescriptor getMethodDescriptor(String name, String desc) { - for (MethodDescriptor md : m_visitedMethods) { - if (md.getName().equals(name) && md.getDescriptor().equals(desc)) { - return md; - } - } - return null; - } - - /** - * Visit a Field. - * This field access is replaced by an invocation to the getter method or to the setter method. - * (except for static field). - * Inject the getter and the setter method for this field. - * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, java.lang.Object) - * @param access : access modifier - * @param name : name of the field - * @param desc : description of the field - * @param signature : signature of the field - * @param value : value of the field - * @return FieldVisitor : null - */ - public FieldVisitor visitField(final int access, final String name, final String desc, final String signature, final Object value) { - if ((access & ACC_STATIC) == 0) { - FieldVisitor flag = cv.visitField(ACC_PRIVATE, FIELD_FLAG_PREFIX + name, "Z", null, null); - flag.visitEnd(); - - Type type = Type.getType(desc); - - if (type.getSort() == Type.ARRAY) { - String gDesc = "()" + desc; - createArrayGetter(name, gDesc); - - // Generates setter method - String sDesc = "(" + desc + ")V"; - createArraySetter(access, name, sDesc); - - } else { - // Generate the getter method - String gDesc = "()" + desc; - createSimpleGetter(name, gDesc, type); - - // Generates setter method - String sDesc = "(" + desc + ")V"; - createSimpleSetter(access, name, sDesc, type); - } - } - return cv.visitField(access, name, desc, signature, value); - } - - /** - * Modify the given constructor to be something like: - * - * this(null, params...); - * return; - * - * The actual constructor is modified to support the instance manager argument. - * @param access : access flag - * @param descriptor : the original constructor descriptor - * @param signature : method signature - * @param exceptions : declared exception - * @param annotations : the annotations to move to this constructor. - * @param locals : the local variables from the original constructors. - */ - private void generateConstructor(int access, String descriptor, String signature, String[] exceptions, - List annotations, Map> paramAnnotations, LinkedHashMap locals) { - GeneratorAdapter mv = new GeneratorAdapter( - cv.visitMethod(access, "", descriptor, signature, exceptions), - access, "", descriptor); - // Compute the new signature - String newDesc = descriptor.substring(1); // Remove the first ( - newDesc = "(Lorg/apache/felix/ipojo/InstanceManager;" + newDesc; - - mv.visitCode(); - Label start = new Label(); - mv.visitLabel(start); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ACONST_NULL); - mv.loadArgs(); - mv.visitMethodInsn(INVOKESPECIAL, m_owner, "", newDesc, false); - mv.visitInsn(RETURN); - Label stop = new Label(); - mv.visitLabel(stop); - - // Move annotations - if (annotations != null) { - for (AnnotationDescriptor ad : annotations) { - ad.visitAnnotation(mv); - } - } - - // Move parameter annotations if any - if (paramAnnotations != null && ! paramAnnotations.isEmpty()) { - for (Integer id : paramAnnotations.keySet()) { - List ads = paramAnnotations.get(id); - for (AnnotationDescriptor ad : ads) { - ad.visitParameterAnnotation(id, mv); - } - } - } - - // Add local variables for the arguments. - for (Map.Entry local : locals.entrySet()) { - // Write the parameter name. Only write the local variable that are either `this` or parameters from the - // initial descriptor. - if (local.getValue().index <= Type.getArgumentTypes(descriptor).length) { - mv.visitLocalVariable(local.getValue().name, local.getValue().desc, local.getValue().signature, start,stop, - local.getValue().index); - } - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Generate the method header of a POJO method. - * This method header encapsulate the POJO method call to - * signal entry exit and error to the container. - * @param access : access flag. - * @param name : method name. - * @param desc : method descriptor. - * @param signature : method signature. - * @param exceptions : declared exceptions. - * @param localVariables : the local variable nodes. - * @param annotations : the annotations to move to this method. - * @param paramAnnotations : the parameter annotations to move to this method. - */ - private void generateMethodHeader(int access, String name, String desc, String signature, String[] exceptions, - List localVariables, List annotations, - Map> paramAnnotations) { - GeneratorAdapter mv = new GeneratorAdapter(cv.visitMethod(access, name, desc, signature, exceptions), access, name, desc); - mv.visitCode(); - - // If we have variables, we wraps the code within labels. The `lifetime` of the variables are bound to those - // two variables. - boolean hasArgumentLabels = localVariables != null && !localVariables.isEmpty(); - Label start = null; - if (hasArgumentLabels) { - start = new Label(); - mv.visitLabel(start); - } - - mv.visitCode(); - - Type returnType = Type.getReturnType(desc); - - // Compute result and exception stack location - int result = -1; - int exception; - - //int arguments = mv.newLocal(Type.getType((new Object[0]).getClass())); - - if (returnType.getSort() != Type.VOID) { - // The method returns something - result = mv.newLocal(returnType); - exception = mv.newLocal(Type.getType(Throwable.class)); - } else { - exception = mv.newLocal(Type.getType(Throwable.class)); - } - - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, generateMethodFlag(name, desc), "Z"); - mv.visitJumpInsn(IFNE, l0); - - mv.visitVarInsn(ALOAD, 0); - mv.loadArgs(); - mv.visitMethodInsn(INVOKESPECIAL, m_owner, PREFIX + name, desc, false); - mv.visitInsn(returnType.getOpcode(IRETURN)); - - // end of the non intercepted method invocation. - - mv.visitLabel(l0); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(generateMethodId(name, desc)); - mv.loadArgArray(); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ENTRY, - "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V", false); - - mv.visitVarInsn(ALOAD, 0); - - // Do not allow argument modification : just reload arguments. - mv.loadArgs(); - mv.visitMethodInsn(INVOKESPECIAL, m_owner, PREFIX + name, desc, false); - - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ISTORE), result); - } - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(generateMethodId(name, desc)); - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ILOAD), result); - mv.box(returnType); - } else { - mv.visitInsn(ACONST_NULL); - } - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", EXIT, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - mv.visitLabel(l1); - Label l7 = new Label(); - mv.visitJumpInsn(GOTO, l7); - mv.visitLabel(l2); - - mv.visitVarInsn(ASTORE, exception); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(generateMethodId(name, desc)); - mv.visitVarInsn(ALOAD, exception); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ERROR, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Throwable;)V", false); - mv.visitVarInsn(ALOAD, exception); - mv.visitInsn(ATHROW); - - mv.visitLabel(l7); - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ILOAD), result); - } - mv.visitInsn(returnType.getOpcode(IRETURN)); - - // If we had arguments, we mark the end of the lifetime. - Label end = null; - if (hasArgumentLabels) { - end = new Label(); - mv.visitLabel(end); - } - - // Move annotations - if (annotations != null) { - for (AnnotationDescriptor ad : annotations) { - ad.visitAnnotation(mv); - } - } - - // Move parameter annotations - if (paramAnnotations != null && ! paramAnnotations.isEmpty()) { - for (Integer id : paramAnnotations.keySet()) { - List ads = paramAnnotations.get(id); - for (AnnotationDescriptor ad : ads) { - ad.visitParameterAnnotation(id, mv); - } - } - } - - // Write the arguments name. - if (hasArgumentLabels) { - for (LocalVariableNode var : localVariables) { - mv.visitLocalVariable(var.name, var.desc, var.signature, start, end, var.index); - } - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Generate a method flag name. - * @param name : method name. - * @param desc : method descriptor. - * @return the method flag name - */ - private String generateMethodFlag(String name, String desc) { - return METHOD_FLAG_PREFIX + generateMethodId(name, desc); - } - - private String generateMethodFlagForMethodFromInnerClass(String name, String desc, String inner) { - return METHOD_FLAG_PREFIX + generateMethodIdForMethodFromInnerClass(name, desc, inner); - } - - /** - * Generate the method id based on the given method name and method descriptor. - * The method Id is unique for this method and serves to create the flag field (so - * must follow field name Java restrictions). - * @param name : method name - * @param desc : method descriptor - * @return method ID - */ - private String generateMethodId(String name, String desc) { - StringBuilder id = new StringBuilder(name); - Type[] args = Type.getArgumentTypes(desc); - for (Type type : args) { - String arg = type.getClassName(); - if (arg.endsWith("[]")) { - // We have to replace all [] - String acc = ""; - while (arg.endsWith("[]")) { - arg = arg.substring(0, arg.length() - 2); - acc += "__"; - } - id.append("$").append(arg.replace('.', '_')).append(acc); - } else { - id.append("$").append(arg.replace('.', '_')); - } - } - if (!m_methods.contains(id.toString())) { - m_methods.add(id.toString()); - } - return id.toString(); - } - - private String generateMethodIdForMethodFromInnerClass(String name, String desc, String inner) { - StringBuilder id = new StringBuilder(inner); - id.append("___"); // Separator - id.append(name); - - Type[] args = Type.getArgumentTypes(desc); - for (Type type : args) { - String arg = type.getClassName(); - if (arg.endsWith("[]")) { - // We have to replace all [] - String acc = ""; - while (arg.endsWith("[]")) { - arg = arg.substring(0, arg.length() - 2); - acc += "__"; - } - id.append("$").append(arg.replace('.', '_')).append(acc); - } else { - id.append("$").append(arg.replace('.', '_')); - } - } - - if (!m_methods.contains(id.toString())) { - m_methods.add(id.toString()); - } - - return id.toString(); - } - - /** - * Add the instance manager field (__im). - */ - private void addIMField() { - FieldVisitor fv = super.visitField(0, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;", null, null); - fv.visitEnd(); - } - - /** - * Add the boolean flag fields for methods from inner classes. - */ - private void addFlagsForInnerClassMethods() { - for (Map.Entry> entry : m_manipulator.getInnerClassesAndMethods().entrySet()) { - for (MethodDescriptor descriptor : entry.getValue()) { - String id = generateMethodFlagForMethodFromInnerClass( - descriptor.getName(), - descriptor.getDescriptor(), - entry.getKey()); - if (! m_methodFlags.contains(id)) { - FieldVisitor flagField = cv.visitField(0, id, "Z", null, null); - flagField.visitEnd(); - m_methodFlags.add(id); - } - } - } - } - - /** - * Add the POJO interface to the visited class. - * @param version : class version - * @param access : class access - * @param name : class name - * @param signature : class signature - * @param superName : super class - * @param interfaces : implemented interfaces. - */ - private void addPOJOInterface(int version, int access, String name, String signature, String superName, String[] interfaces) { - - // Add the POJO interface to the interface list - // Check that the POJO interface is not already in the list - boolean found = false; - for (String anInterface : interfaces) { - if (anInterface.equals(POJO)) { - found = true; - } - } - String[] itfs; - if (!found) { - itfs = new String[interfaces.length + 1]; - System.arraycopy(interfaces, 0, itfs, 0, interfaces.length); - itfs[interfaces.length] = POJO; - } else { - itfs = interfaces; - } - cv.visit(version, access, name, signature, superName, itfs); - } - - /** - * Visit end. - * Create helper methods. - * @see org.objectweb.asm.ClassVisitor#visitEnd() - */ - public void visitEnd() { - // Create the component manager setter method - createSetInstanceManagerMethod(); - - // Add the getComponentInstance - createGetComponentInstanceMethod(); - - // Need to inject a constructor? - if (! m_foundSuitableConstructor) { // No adequate constructor, create one. - createSimpleConstructor(); - } - - m_methods.clear(); - m_methodFlags.clear(); - - cv.visitEnd(); - } - - /** - * Creates a simple constructor with an instance manager - * in argument if no suitable constructor is found during - * the visit. - */ - private void createSimpleConstructor() { - MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "", - "(Lorg/apache/felix/ipojo/InstanceManager;)V", null, null); - mv.visitCode(); - - // Super call - mv.visitVarInsn(ALOAD, 0); - mv.visitMethodInsn(INVOKESPECIAL, m_superclass, "", "()V", false); - - // Call set instance manager - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKEVIRTUAL, m_owner, "_setInstanceManager", - "(Lorg/apache/felix/ipojo/InstanceManager;)V", false); - - mv.visitInsn(RETURN); - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create the setter method for the __cm field. - */ - private void createSetInstanceManagerMethod() { - MethodVisitor mv = cv.visitMethod(ACC_PRIVATE, "_setInstanceManager", "(Lorg/apache/felix/ipojo/InstanceManager;)V", null, null); - mv.visitCode(); - - // If the given instance manager is null, just returns. - mv.visitVarInsn(ALOAD, 1); - Label l1 = new Label(); - mv.visitJumpInsn(IFNONNULL, l1); - mv.visitInsn(RETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn(PUTFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredFields", - "()Ljava/util/Set;", false); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - Label endif = new Label(); - mv.visitJumpInsn(IFNULL, endif); - for (String field : m_fields) { - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn(field); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true); - Label l3 = new Label(); - mv.visitJumpInsn(IFEQ, l3); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ICONST_1); - mv.visitFieldInsn(PUTFIELD, m_owner, FIELD_FLAG_PREFIX + field, "Z"); - mv.visitLabel(l3); - } - mv.visitLabel(endif); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", "getRegistredMethods", - "()Ljava/util/Set;", false); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - Label endif2 = new Label(); - mv.visitJumpInsn(IFNULL, endif2); - - for (String methodId : m_methods) { - if (!methodId.equals("")) { - mv.visitVarInsn(ALOAD, 2); - mv.visitLdcInsn(methodId); - mv.visitMethodInsn(INVOKEINTERFACE, "java/util/Set", "contains", "(Ljava/lang/Object;)Z", true); - Label l3 = new Label(); - mv.visitJumpInsn(IFEQ, l3); - mv.visitVarInsn(ALOAD, 0); - mv.visitInsn(ICONST_1); - mv.visitFieldInsn(PUTFIELD, m_owner, METHOD_FLAG_PREFIX + methodId, "Z"); - mv.visitLabel(l3); - } - } - - mv.visitLabel(endif2); - mv.visitInsn(RETURN); - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create the getComponentInstance method. - */ - private void createGetComponentInstanceMethod() { - MethodVisitor mv = cv.visitMethod(ACC_PUBLIC, "getComponentInstance", "()Lorg/apache/felix/ipojo/ComponentInstance;", null, null); - mv.visitCode(); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitInsn(ARETURN); - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create a getter method for an array. - * @param access - * @param name : field name - * @param desc : method description - */ - private void createArraySetter(int access, String name, String desc) { - MethodVisitor mv = cv.visitMethod(0, "__set" + name, desc, null, null); - mv.visitCode(); - boolean isFinal = (access & ACC_FINAL) == ACC_FINAL; - String internalType = desc.substring(1); - internalType = internalType.substring(0, internalType.length() - 2); - - Label l1 = new Label(); - mv.visitLabel(l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l2 = new Label(); - mv.visitJumpInsn(IFNE, l2); - - if(!isFinal) { - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn(PUTFIELD, m_owner, name, internalType); - } - mv.visitInsn(RETURN); - mv.visitLabel(l2); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - mv.visitInsn(RETURN); - - // End - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create a setter method for an array. - * @param name : field name - * @param desc : method description - */ - private void createArrayGetter(String name, String desc) { - String methodName = "__get" + name; - MethodVisitor mv = cv.visitMethod(0, methodName, desc, null, null); - mv.visitCode(); - - String internalType = desc.substring(2); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, internalType); - mv.visitInsn(ARETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", GET, - "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, internalType); - mv.visitInsn(ARETURN); - - // End - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create the getter for a field. - * @param name : field of the dependency - * @param desc : description of the getter method - * @param type : type to return - */ - private void createSimpleGetter(String name, String desc, Type type) { - String methodName = "__get" + name; - MethodVisitor mv = cv.visitMethod(0, methodName, desc, null, null); - mv.visitCode(); - - switch (type.getSort()) { - case Type.BOOLEAN: - case Type.CHAR: - case Type.BYTE: - case Type.SHORT: - case Type.INT: - - String internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - String boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - String unboxingMethod = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][2]; - - Label l0 = new Label(); - mv.visitLabel(l0); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, internalName); - mv.visitInsn(IRETURN); - - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitVarInsn(ASTORE, 1); - - mv.visitVarInsn(ALOAD, 1); - mv.visitTypeInsn(CHECKCAST, boxingType); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false); - mv.visitInsn(type.getOpcode(IRETURN)); - break; - - case Type.LONG: - internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - unboxingMethod = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][2]; - - l0 = new Label(); - mv.visitLabel(l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, internalName); - mv.visitInsn(LRETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitVarInsn(ASTORE, 1); - - mv.visitVarInsn(ALOAD, 1); - mv.visitTypeInsn(CHECKCAST, boxingType); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false); - mv.visitInsn(LRETURN); - - break; - - case Type.DOUBLE: - internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - unboxingMethod = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][2]; - - l0 = new Label(); - mv.visitLabel(l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, internalName); - mv.visitInsn(DRETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitVarInsn(ASTORE, 1); - - mv.visitVarInsn(ALOAD, 1); - mv.visitTypeInsn(CHECKCAST, boxingType); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false); - mv.visitInsn(DRETURN); - - break; - - case Type.FLOAT: - internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - unboxingMethod = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][2]; - - l0 = new Label(); - mv.visitLabel(l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, internalName); - mv.visitInsn(FRETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitVarInsn(ASTORE, 1); - - mv.visitVarInsn(ALOAD, 1); - mv.visitTypeInsn(CHECKCAST, boxingType); - mv.visitVarInsn(ASTORE, 2); - - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, boxingType, unboxingMethod, "()" + internalName, false); - mv.visitInsn(FRETURN); - - break; - - case Type.OBJECT: - l0 = new Label(); - mv.visitLabel(l0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - l1 = new Label(); - mv.visitJumpInsn(IFNE, l1); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, name, "L" + type.getInternalName() + ";"); - mv.visitInsn(ARETURN); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - GET, "(Ljava/lang/Object;Ljava/lang/String;)Ljava/lang/Object;", false); - mv.visitTypeInsn(CHECKCAST, type.getInternalName()); - mv.visitInsn(ARETURN); - - break; - - default: - ManipulationProperty.getLogger().log(ManipulationProperty.SEVERE, "Manipulation problem in " + m_owner + " : a type is not implemented : " + type); - break; - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Create the setter method for one property. The name of the method is _set+name of the field - * @param access - * @param name : name of the field representing a property - * @param desc : description of the setter method - * @param type : type of the property - */ - private void createSimpleSetter(int access, String name, String desc, Type type) { - MethodVisitor mv = cv.visitMethod(0, "__set" + name, desc, null, null); - mv.visitCode(); - boolean isFinal = (access & ACC_FINAL) == ACC_FINAL; - - switch (type.getSort()) { - case Type.BOOLEAN: - case Type.CHAR: - case Type.BYTE: - case Type.SHORT: - case Type.INT: - case Type.FLOAT: - - String internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - String boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - - Label l1 = new Label(); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l22 = new Label(); - mv.visitJumpInsn(IFNE, l22); - if (!isFinal) { - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(type.getOpcode(ILOAD), 1); - mv.visitFieldInsn(PUTFIELD, m_owner, name, internalName); - } - mv.visitInsn(RETURN); - mv.visitLabel(l22); - - mv.visitTypeInsn(NEW, boxingType); - mv.visitInsn(DUP); - mv.visitVarInsn(type.getOpcode(ILOAD), 1); - mv.visitMethodInsn(INVOKESPECIAL, boxingType, "", "(" + internalName + ")V", false); - mv.visitVarInsn(ASTORE, 2); - - - Label l2 = new Label(); - mv.visitLabel(l2); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitVarInsn(ALOAD, 2); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - Label l3 = new Label(); - mv.visitLabel(l3); - mv.visitInsn(RETURN); - break; - - case Type.LONG: - case Type.DOUBLE: - internalName = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][0]; - boxingType = ManipulationProperty.PRIMITIVE_BOXING_INFORMATION[type.getSort()][1]; - - l1 = new Label(); - mv.visitLabel(l1); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l23 = new Label(); - mv.visitJumpInsn(IFNE, l23); - - if(!isFinal) { - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(type.getOpcode(ILOAD), 1); - mv.visitFieldInsn(PUTFIELD, m_owner, name, internalName); - } - mv.visitInsn(RETURN); - mv.visitLabel(l23); - - mv.visitTypeInsn(NEW, boxingType); - mv.visitInsn(DUP); - mv.visitVarInsn(type.getOpcode(ILOAD), 1); - mv.visitMethodInsn(INVOKESPECIAL, boxingType, "", "(" + internalName + ")V", false); - mv.visitVarInsn(ASTORE, 3); // Double space - - l2 = new Label(); - mv.visitLabel(l2); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitVarInsn(ALOAD, 3); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - SET, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - l3 = new Label(); - mv.visitLabel(l3); - mv.visitInsn(RETURN); - break; - - case Type.OBJECT: - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, FIELD_FLAG_PREFIX + name, "Z"); - Label l24 = new Label(); - mv.visitJumpInsn(IFNE, l24); - - if (!isFinal) { - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 1); - mv.visitFieldInsn(PUTFIELD, m_owner, name, "L" + type.getInternalName() + ";"); - } - mv.visitInsn(RETURN); - mv.visitLabel(l24); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_owner, IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(name); - mv.visitVarInsn(ALOAD, 1); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", SET, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - mv.visitInsn(RETURN); - break; - default: - ManipulationProperty.getLogger().log(ManipulationProperty.SEVERE, "Manipulation Error : Cannot create the setter method for the field : " + name + " (" + type + ")"); - break; - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java deleted file mode 100644 index 097d9f887d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ConstructorCodeAdapter.java +++ /dev/null @@ -1,300 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.GeneratorAdapter; - -import java.util.Set; - - -/** - * Constructor Adapter. - * This class adds an instance manager argument (so switch variable index). - * Moreover, it adapts field accesses to delegate accesses to the instance - * manager if needed. - * - * @author Felix Project Team - */ -public class ConstructorCodeAdapter extends GeneratorAdapter implements Opcodes { - - /** - * The class containing the field. - * m_owner : String - */ - private String m_owner; - - /** - * Is the super call detected ? - */ - private boolean m_superDetected; - - /** - * The super class. - */ - private String m_superClass; - - /** - * Set of contained fields. - */ - private Set m_fields; - - /** - * Set of contained final fields - */ - private Set m_finalFields; - - - /** - * PropertyCodeAdapter constructor. - * A new FiledCodeAdapter should be create for each method visit. - * - * @param mv the MethodVisitor - * @param owner the name of the class - * @param fields the list of contained fields - * @param finalFields the list of contained final fields - * @param access the constructor access - * @param name the name - * @param desc the constructor descriptor - */ - public ConstructorCodeAdapter(final MethodVisitor mv, final String owner, Set fields, Set finalFields, int access, String name, String desc, String superClass) { - super(Opcodes.ASM9, mv, access, name, desc); - m_owner = owner; - m_superDetected = false; - m_fields = fields; - m_finalFields = finalFields; - m_superClass = superClass; - } - - /** - * Visits an annotation. - * If the annotation is visible, the annotation is removed. In fact - * the annotation was already moved to the method replacing this one. - * If the annotation is not visible, this annotation is kept on this method. - * - * @param name the name of the annotation - * @param visible the annotation visibility - * @return the null if the annotation is visible, otherwise returns - * {@link GeneratorAdapter#visitAnnotation(String, boolean)} - * @see org.objectweb.asm.commons.GeneratorAdapter#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String name, boolean visible) { - // Annotations are moved to the injected constructor. - if (visible) { - return null; - } else { - return super.visitAnnotation(name, false); - } - } - - /** - * Visits a parameter annotation. - * Parameter annotations are moved to replacing constructor except - * they are injection annotations(-@Property and -@Requires). - * Because injection annotations shouldn't be copied to generated one - * in case of re-manipulation, since this is caused to wrong type resolution - * of injected parameters. - * - * @param parameter parameter index - * @param desc annotation description(annotation name) - * @param visible is parameter annotation visible - * @return @AnnotationVisitor - */ - public AnnotationVisitor visitParameterAnnotation( - final int parameter, - final String desc, - final boolean visible) { - - /* - * Generated constructor shouldn't inherit injection annotations - */ - if (desc.equals("Lorg/apache/felix/ipojo/annotations/Property;") - || desc.equals("Lorg/apache/felix/ipojo/annotations/Requires;") - || Names.isCustomAnnotation(desc)) { - return null; - } else { - return super.visitParameterAnnotation(parameter, desc, visible); - } - - } - - - /** - * Adapts field accesses. - * If the field is owned by the visited class: - *

    - *
  • GETFIELD are changed to a __getX invocation.
  • - *
  • SETFIELD are changed to a __setX invocation.
  • - *
- * - * @param opcode the visited operation code - * @param owner the owner of the field - * @param name the name of the field - * @param desc the descriptor of the field - * @see org.objectweb.asm.MethodVisitor#visitFieldInsn(int, String, String, String) - */ - public void visitFieldInsn( - final int opcode, - final String owner, - final String name, - final String desc) { - if (m_fields.contains(name) && m_owner.equals(owner)) { - if (opcode == GETFIELD) { - String gDesc = "()" + desc; - mv.visitMethodInsn(INVOKEVIRTUAL, owner, "__get" + name, gDesc, false); - return; - } else if (opcode == PUTFIELD) { - if (m_finalFields.contains(name)) { - mv.visitFieldInsn(PUTFIELD, owner, name, desc); - mv.visitVarInsn(ALOAD, 0); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, owner, name, desc); - } - String sDesc = "(" + desc + ")V"; - mv.visitMethodInsn(INVOKEVIRTUAL, owner, "__set" + name, sDesc, false); - return; - } - } - super.visitFieldInsn(opcode, owner, name, desc); - } - - /** - * Visits a method invocation instruction. - * After the super constructor invocation, insert the _setComponentManager invocation. - * Otherwise, the method invocation doesn't change - * - * @param opcode the opcode - * @param owner the class owning the invoked method - * @param name the method name - * @param desc the method descriptor - * @param itf if the method's owner class is an interface - * @see org.objectweb.asm.commons.GeneratorAdapter#visitMethodInsn(int, java.lang.String, java.lang.String, java.lang.String) - */ - public void visitMethodInsn(int opcode, String owner, String name, String desc, boolean itf) { - - // A method call is detected, check if it is the super call : - // the first init is not necessary the super call, so check that it is really the super class. - if (!m_superDetected && name.equals("") && owner.equals(m_superClass)) { - m_superDetected = true; - // The first invocation is the super call - // 1) Visit the super constructor : - - //mv.visitVarInsn(ALOAD, 0); The ALOAD 0 was already visited. This previous visit allows - // Super constructor parameters. - mv.visitMethodInsn(opcode, owner, name, desc, false); // Super constructor invocation - - // 2) Load the object and the component manager argument - mv.visitVarInsn(ALOAD, 0); - //mv.visitVarInsn(ALOAD, Type.getArgumentTypes(m_constructorDesc).length); - mv.visitVarInsn(ALOAD, 1); // CM is always the first argument - // 3) Initialize the field - mv.visitMethodInsn(INVOKESPECIAL, m_owner, "_setInstanceManager", - "(Lorg/apache/felix/ipojo/InstanceManager;)V", false); - - } else { - if (opcode == INVOKEINTERFACE || (opcode == INVOKESTATIC && itf)) { - mv.visitMethodInsn(opcode, owner, name, desc, true); - } else { - mv.visitMethodInsn(opcode, owner, name, desc, false); - } - } - } - - /** - * Visits a variable instruction. - * This method increments the variable index if - * it is not this (i.e. 0). This increment - * is due to the instance manager parameter added in the method - * signature. - * - * @param opcode the opcode - * @param var the variable index - * @see org.objectweb.asm.commons.GeneratorAdapter#visitVarInsn(int, int) - */ - public void visitVarInsn(int opcode, int var) { - if (var == 0) { - mv.visitVarInsn(opcode, var); // ALOAD 0 (THIS) - } else { - mv.visitVarInsn(opcode, var + 1); // All other variable index must be incremented (due to - // the instance manager argument - } - - } - - /** - * Visits an increment instruction. - * This method increments the variable index if - * it is not this (i.e. 0). This increment - * is due to the instance manager parameter added in the method - * signature. - * - * @param var the variable index - * @param increment the increment - * @see org.objectweb.asm.commons.GeneratorAdapter#visitIincInsn(int, int) - */ - public void visitIincInsn(int var, int increment) { - if (var != 0) { - mv.visitIincInsn(var + 1, increment); - } else { - mv.visitIincInsn(var, increment); // Increment the current object ??? - } - } - - /** - * Visits a local variable. - * Adds _manager and increment others variable indexes. - * This variable has the same scope than this and - * has the 1 index. - * - * @param name the variable name - * @param desc the variable descriptor - * @param signature the variable signature - * @param start the beginning label - * @param end the ending label - * @param index the variable index - * @see org.objectweb.asm.commons.GeneratorAdapter#visitLocalVariable(java.lang.String, java.lang.String, java.lang.String, org.objectweb.asm.Label, org.objectweb.asm.Label, int) - */ - public void visitLocalVariable(String name, String desc, String signature, Label start, Label end, int index) { - if (index == 0) { - mv.visitLocalVariable(name, desc, signature, start, end, index); - mv.visitLocalVariable("_manager", "Lorg/apache/felix/ipojo/InstanceManager;", null, start, end, 1); - } else { - mv.visitLocalVariable(name, desc, signature, start, end, index + 1); - } - } - - /** - * Visit max method. - * The stack size is incremented of 1. The - * local variable count is incremented of 2. - * - * @param maxStack the stack size. - * @param maxLocals the local variable count. - * @see org.objectweb.asm.commons.GeneratorAdapter#visitMaxs(int, int) - */ - public void visitMaxs(int maxStack, int maxLocals) { - mv.visitMaxs(maxStack + 1, maxLocals + 2); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java deleted file mode 100644 index c437fcd867..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassAdapter.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.objectweb.asm.*; -import org.objectweb.asm.commons.GeneratorAdapter; -import org.objectweb.asm.tree.LocalVariableNode; - -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * Adapts a inner class in order to allow accessing outer class fields. - * A manipulated inner class has access to the managed field of the outer class. - * - * Only non-static inner classes are manipulated, others are not. - * - * @author Felix Project Team - */ -public class InnerClassAdapter extends ClassVisitor implements Opcodes { - - /** - * The manipulator having manipulated the outer class. - * We add method descriptions to this manipulator. - */ - private final Manipulator m_manipulator; - - /** - * The name of the inner class. This name is only define in the outer class. - */ - private final String m_name; - - /** - * The ismple name of the class. - */ - private final String m_simpleName; - - /** - * Implementation class name. - */ - private String m_outer; - /** - * List of fields of the implementation class. - */ - private Set m_fields; - - /** - * Creates the inner class adapter. - * - * @param name the inner class name (internal name) - * @param visitor parent class visitor - * @param outerClassName outer class (implementation class) - * @param manipulator the manipulator having manipulated the outer class. - */ - public InnerClassAdapter(String name, ClassVisitor visitor, String outerClassName, - Manipulator manipulator) { - super(Opcodes.ASM9, visitor); - m_name = name; - m_simpleName = m_name.substring(m_name.indexOf("$") + 1); - m_outer = outerClassName; - m_manipulator = manipulator; - m_fields = manipulator.getFields().keySet(); - } - - /** - * Visits a method. - * This methods create a code visitor manipulating outer class field accesses. - * - * @param access method visibility - * @param name method name - * @param desc method descriptor - * @param signature method signature - * @param exceptions list of exceptions thrown by the method - * @return a code adapter manipulating field accesses - * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, - * java.lang.String[]) - */ - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - // Do nothing on static methods, should not happen in non-static inner classes. - if ((access & ACC_STATIC) == ACC_STATIC) { - return super.visitMethod(access, name, desc, signature, exceptions); - } - - // Do nothing on native methods - if ((access & ACC_NATIVE) == ACC_NATIVE) { - return super.visitMethod(access, name, desc, signature, exceptions); - } - - - // Do not re-manipulate. - if (! m_manipulator.isAlreadyManipulated()) { - - if (name.equals("")) { - // We change the field access from the constructor, but we don't generate the wrapper. - MethodVisitor mv = super.visitMethod(access, name, desc, signature, exceptions); - return new MethodCodeAdapter(mv, m_outer, access, name, desc, m_fields); - } - - // For all non constructor methods - - MethodDescriptor md = getMethodDescriptor(name, desc); - if (md == null) { - generateMethodWrapper(access, name, desc, signature, exceptions, null, null, - null); - } else { - generateMethodWrapper(access, name, desc, signature, exceptions, - md.getArgumentLocalVariables(), - md.getAnnotations(), md.getParameterAnnotations()); - } - - // The new name is the method name prefixed by the PREFIX. - MethodVisitor mv = super.visitMethod(ACC_PRIVATE, ClassManipulator.PREFIX + name, desc, signature, - exceptions); - return new MethodCodeAdapter(mv, m_outer, ACC_PRIVATE, ClassManipulator.PREFIX + name, desc, m_fields); - } else { - return super.visitMethod(access, name, desc, signature, exceptions); - } - } - - private String getMethodFlagName(String name, String desc) { - return ClassManipulator.METHOD_FLAG_PREFIX + getMethodId(name, desc); - } - - private String getMethodId(String name, String desc) { - StringBuilder id = new StringBuilder(m_simpleName); - id.append("___"); // Separator - id.append(name); - - Type[] args = Type.getArgumentTypes(desc); - for (Type type : args) { - String arg = type.getClassName(); - if (arg.endsWith("[]")) { - // We have to replace all [] - String acc = ""; - while (arg.endsWith("[]")) { - arg = arg.substring(0, arg.length() - 2); - acc += "__"; - } - id.append("$").append(arg.replace('.', '_')).append(acc); - } else { - id.append("$").append(arg.replace('.', '_')); - } - } - return id.toString(); - } - - /** - * Generate the method header of a POJO method. - * This method header encapsulate the POJO method call to - * signal entry exit and error to the container. - * - * The instance manager and flag are accessed using method calls. - * @param access : access flag. - * @param name : method name. - * @param desc : method descriptor. - * @param signature : method signature. - * @param exceptions : declared exceptions. - * @param localVariables : the local variable nodes. - * @param annotations : the annotations to move to this method. - * @param paramAnnotations : the parameter annotations to move to this method. - */ - private void generateMethodWrapper(int access, String name, String desc, String signature, String[] exceptions, - List localVariables, List annotations, - Map> paramAnnotations) { - GeneratorAdapter mv = new GeneratorAdapter(cv.visitMethod(access, name, desc, signature, exceptions), access, name, desc); - - // If we have variables, we wraps the code within labels. The `lifetime` of the variables are bound to those - // two variables. - boolean hasArgumentLabels = localVariables != null && !localVariables.isEmpty(); - Label start = null; - if (hasArgumentLabels) { - start = new Label(); - mv.visitLabel(start); - } - - mv.visitCode(); - - Type returnType = Type.getReturnType(desc); - - // Compute result and exception stack location - int result = -1; - int exception; - - //int arguments = mv.newLocal(Type.getType((new Object[0]).getClass())); - - if (returnType.getSort() != Type.VOID) { - // The method returns something - result = mv.newLocal(returnType); - exception = mv.newLocal(Type.getType(Throwable.class)); - } else { - exception = mv.newLocal(Type.getType(Throwable.class)); - } - - Label l0 = new Label(); - Label l1 = new Label(); - Label l2 = new Label(); - - mv.visitTryCatchBlock(l0, l1, l2, "java/lang/Throwable"); - - // Access the flag from the outer class - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";"); - mv.visitFieldInsn(GETFIELD, m_outer, getMethodFlagName(name, desc), "Z"); - mv.visitJumpInsn(IFNE, l0); - - mv.visitVarInsn(ALOAD, 0); - mv.loadArgs(); - mv.visitMethodInsn(INVOKESPECIAL, m_name, ClassManipulator.PREFIX + name, desc, false); - mv.visitInsn(returnType.getOpcode(IRETURN)); - - // end of the non intercepted method invocation. - - mv.visitLabel(l0); - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";"); - mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(getMethodId(name, desc)); - mv.loadArgArray(); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ClassManipulator.ENTRY, - "(Ljava/lang/Object;Ljava/lang/String;[Ljava/lang/Object;)V", false); - - mv.visitVarInsn(ALOAD, 0); - - // Do not allow argument modification : just reload arguments. - mv.loadArgs(); - mv.visitMethodInsn(INVOKESPECIAL, m_name, ClassManipulator.PREFIX + name, desc, false); - - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ISTORE), result); - } - - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";"); - mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(getMethodId(name, desc)); - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ILOAD), result); - mv.box(returnType); - } else { - mv.visitInsn(ACONST_NULL); - } - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", - ClassManipulator.EXIT, "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Object;)V", false); - - mv.visitLabel(l1); - Label l7 = new Label(); - mv.visitJumpInsn(GOTO, l7); - mv.visitLabel(l2); - - mv.visitVarInsn(ASTORE, exception); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, m_name, "this$0", "L" + m_outer + ";"); - mv.visitFieldInsn(GETFIELD, m_outer, ClassManipulator.IM_FIELD, "Lorg/apache/felix/ipojo/InstanceManager;"); - mv.visitVarInsn(ALOAD, 0); - mv.visitLdcInsn(getMethodId(name, desc)); - mv.visitVarInsn(ALOAD, exception); - mv.visitMethodInsn(INVOKEVIRTUAL, "org/apache/felix/ipojo/InstanceManager", ClassManipulator.ERROR, - "(Ljava/lang/Object;Ljava/lang/String;Ljava/lang/Throwable;)V", false); - mv.visitVarInsn(ALOAD, exception); - mv.visitInsn(ATHROW); - - mv.visitLabel(l7); - if (returnType.getSort() != Type.VOID) { - mv.visitVarInsn(returnType.getOpcode(ILOAD), result); - } - mv.visitInsn(returnType.getOpcode(IRETURN)); - - // If we had arguments, we mark the end of the lifetime. - Label end = null; - if (hasArgumentLabels) { - end = new Label(); - mv.visitLabel(end); - } - - // Move annotations - if (annotations != null) { - for (ClassChecker.AnnotationDescriptor ad : annotations) { - ad.visitAnnotation(mv); - } - } - - // Move parameter annotations - if (paramAnnotations != null && ! paramAnnotations.isEmpty()) { - for (Integer id : paramAnnotations.keySet()) { - List ads = paramAnnotations.get(id); - for (ClassChecker.AnnotationDescriptor ad : ads) { - ad.visitParameterAnnotation(id, mv); - } - } - } - - // Write the arguments name. - if (hasArgumentLabels) { - for (LocalVariableNode var : localVariables) { - mv.visitLocalVariable(var.name, var.desc, var.signature, start, end, var.index); - } - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Gets the method descriptor for the specified name and descriptor. - * The method descriptor is looked inside the - * {@link ClassManipulator#m_visitedMethods} - * @param name the name of the method - * @param desc the descriptor of the method - * @return the method descriptor or null if not found. - */ - private MethodDescriptor getMethodDescriptor(String name, String desc) { - for (MethodDescriptor md : m_manipulator.getMethodsFromInnerClass(m_name)) { - if (md.getName().equals(name) && md.getDescriptor().equals(desc)) { - return md; - } - } - return null; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassChecker.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassChecker.java deleted file mode 100644 index 2fbbef8cad..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/InnerClassChecker.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Analyze an inner class. - * This visit collects the methods from the inner class. - * @author Felix Project Team - */ -public class InnerClassChecker extends ClassVisitor implements Opcodes { - - private final String m_name; - private final Manipulator m_manipulator; - - public InnerClassChecker(String name, Manipulator manipulator) { - super(Opcodes.ASM9); - m_name = name; - m_manipulator = manipulator; - } - - @Override - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - // Do not collect static and native method. - if ((access & ACC_STATIC) == ACC_STATIC) { - return null; - } - - if ((access & ACC_NATIVE) == ACC_NATIVE) { - return null; - } - - // Don't add generated methods, and constructors - if (!ClassChecker.isGeneratedMethod(name, desc) && ! name.endsWith("")) { - final MethodDescriptor md = new MethodDescriptor(name, desc, (access & ACC_STATIC) == ACC_STATIC); - m_manipulator.addMethodToInnerClass(m_name, md); - } - - return null; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java deleted file mode 100644 index 76b083f334..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/ManipulationProperty.java +++ /dev/null @@ -1,124 +0,0 @@ -/* - * 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.ipojo.manipulation; - -/** - * Store properties for the manipulation process. - * - * @author Felix Project Team - * - */ -public class ManipulationProperty { - - /** - * Logger info level. - */ - public static final int INFO = 0; - - /** - * Logger warning level. - */ - public static final int WARNING = 1; - - /** - * Logger severe level. - */ - public static final int SEVERE = 2; - - /** - * Activator internal package name. - */ - protected static final String IPOJO_INTERNAL_PACKAGE_NAME = "org/apache/felix/ipojo/"; - - /** - * Ipojo internal package name for internal descriptor. - */ - protected static final String IPOJO_INTERNAL_DESCRIPTOR = "L" + IPOJO_INTERNAL_PACKAGE_NAME; - - /** - * iPOJO Package name. - */ - protected static final String IPOJO_PACKAGE_NAME = "org.apache.felix.ipojo"; - - /** - * Helper array for byte code manipulation of primitive type. - */ - static final String[][] PRIMITIVE_BOXING_INFORMATION = new String[][] { - {"V", "ILLEGAL", "ILLEGAL"}, - {"Z", "java/lang/Boolean", "booleanValue"}, - {"C", "java/lang/Character", "charValue"}, - {"B", "java/lang/Byte", "byteValue"}, - {"S", "java/lang/Short", "shortValue"}, - {"I", "java/lang/Integer", "intValue"}, - {"F", "java/lang/Float", "floatValue"}, - {"J", "java/lang/Long", "longValue"}, - {"D", "java/lang/Double", "doubleValue"} - }; - - /** - * Internal logger implementation. - */ - protected static class Logger { - /** - * Log method. - * @param level : level - * @param message : message to log - */ - public void log(int level, String message) { - if (level >= LOG_LEVEL) { - switch (level) { - case INFO: - System.err.println("[INFO] " + message); - break; - case WARNING: - System.err.println("[WARNING] " + message); - break; - case SEVERE: - System.err.println("[SEVERE] " + message); - break; - default: - System.err.println("[SEVERE] " + message); - break; - } - } - } - } - - /** - * Manipulator logger. - */ - private static Logger LOGGER; - - /** - * Default logger level. - */ - private static int LOG_LEVEL = WARNING; - - - /** - * Get the manipulator logger. - * @return the logger used by the manipulator. - */ - public static Logger getLogger() { - if (LOGGER == null) { - LOGGER = new Logger(); - } - return LOGGER; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java deleted file mode 100644 index de92381400..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/Manipulator.java +++ /dev/null @@ -1,314 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.util.CheckClassAdapter; - -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.*; - -/** - * iPOJO Byte code Manipulator. - * @author Felix Project Team - * - */ -public class Manipulator { - /** - * A classloader used to compute frames. - */ - private final ClassLoader m_classLoader; - /** - * Store the visited fields : [name of the field, type of the field]. - */ - private Map m_fields; - - /** - * Store th visited final fields - */ - private Set m_finalFields; - - /** - * Store the interface implemented by the class. - */ - private List m_interfaces; - - /** - * Store the methods list. - */ - private List m_methods; - - /** - * Pojo super class. - */ - private String m_superClass; - - /** - * List of owned inner classes and internal methods. - */ - private Map> m_inners; - - /** - * Java byte code version. - */ - private int m_version; - - /** - * Was the class already manipulated. - */ - private boolean m_alreadyManipulated; - - /** - * The manipulated class name. - */ - private String m_className; - - public Manipulator(ClassLoader loader) { - // No classloader set, use current one. - m_classLoader = loader; - } - - /** - * Checks the given bytecode, determines if the class was already manipulated, and collect the metadata about the - * class. - * @param origin the bytecode - */ - public void prepare(byte[] origin) throws IOException { - InputStream is = new ByteArrayInputStream(origin); - - // First check if the class is already manipulated : - ClassReader ckReader = new ClassReader(is); - ClassChecker ck = new ClassChecker(); - ckReader.accept(ck, ClassReader.SKIP_FRAMES); - is.close(); - - m_fields = ck.getFields(); // Get visited fields (contains only POJO fields) - m_finalFields = ck.getFinalFields(); - m_className = ck.getClassName(); - - // Get interfaces and super class. - m_interfaces = ck.getInterfaces(); - m_superClass = ck.getSuperClass(); - - // Get the methods list - m_methods = ck.getMethods(); - - // Methods are not yet collected, but the structure is ready. - m_inners = ck.getInnerClassesAndMethods(); - - m_version = ck.getClassVersion(); - - m_alreadyManipulated = ck.isAlreadyManipulated(); - } - - /** - * Manipulate the given byte array. - * @param origin : original class. - * @return the manipulated class, if the class is already manipulated, the original class. - * @throws IOException : if an error occurs during the manipulation. - */ - public byte[] manipulate(byte[] origin) throws IOException { - if (!m_alreadyManipulated) { - InputStream is2 = new ByteArrayInputStream(origin); - ClassReader reader = new ClassReader(is2); - ClassWriter writer = new ClassLoaderAwareClassWriter(ClassWriter.COMPUTE_FRAMES, m_className, m_superClass, - m_classLoader); - ClassManipulator process = new ClassManipulator(new CheckClassAdapter(writer, false), this); - if (m_version >= Opcodes.V1_6) { - reader.accept(process, ClassReader.EXPAND_FRAMES); - } else { - reader.accept(process, 0); - } - is2.close(); - return writer.toByteArray(); - } else { - return origin; - } - } - - /** - * Checks whether the class was already manipulated. - * @return {@code true} if the class was already manipulated, {@code false} otherwise - */ - public boolean isAlreadyManipulated() { - return m_alreadyManipulated; - } - - public static String toQualifiedName(String clazz) { - return clazz.replace("/", "."); - } - - /** - * Compute component type manipulation metadata. - * @return the manipulation metadata of the class. - */ - public Element getManipulationMetadata() { - Element elem = new Element("Manipulation", ""); - - elem.addAttribute(new Attribute("className", toQualifiedName(m_className))); - - if (m_superClass != null) { - elem.addAttribute(new Attribute("super", m_superClass)); - } - - for (String m_interface : m_interfaces) { - Element itf = new Element("Interface", ""); - Attribute att = new Attribute("name", m_interface); - itf.addAttribute(att); - elem.addElement(itf); - } - - for (Map.Entry f : m_fields.entrySet()) { - Element field = new Element("Field", ""); - Attribute attName = new Attribute("name", f.getKey()); - Attribute attType = new Attribute("type", f.getValue()); - field.addAttribute(attName); - field.addAttribute(attType); - elem.addElement(field); - } - - for (MethodDescriptor method : m_methods) { - elem.addElement(method.getElement()); - } - - for (Map.Entry> inner : m_inners.entrySet()) { - Element element = new Element("Inner", ""); - Attribute name = new Attribute("name", extractInnerClassName(toQualifiedName(inner.getKey()))); - element.addAttribute(name); - - for (MethodDescriptor method : inner.getValue()) { - element.addElement(method.getElement()); - } - elem.addElement(element); - } - - return elem; - } - - /** - * Extracts the inner class simple name from the qualified name. It extracts the part after the `$` character. - * @param clazz the qualified class name - * @return the simple inner class name - */ - public static String extractInnerClassName(String clazz) { - if (!clazz.contains("$")) { - return clazz; - } else { - return clazz.substring(clazz.indexOf("$") +1); - } - } - - public Map getFields() { - return m_fields; - } - - public Set getFinalFields(){ - return m_finalFields; - } - - public List getMethods() { - return m_methods; - } - - public Collection getInnerClasses() { - return new ArrayList(m_inners.keySet()); - } - - public int getClassVersion() { - return m_version; - } - - /** - * Adds a method to an inner class. - * @param name the inner class name - * @param md the method descriptor to add - */ - public void addMethodToInnerClass(String name, MethodDescriptor md) { - List list = m_inners.get(name); - if (list == null) { - list = new ArrayList(); - m_inners.put(name, list); - } - list.add(md); - } - - /** - * Analyzes the given inner class. - * @param inner the inner class name - * @param bytecode the bytecode of the inner class - */ - public void prepareInnerClass(String inner, byte[] bytecode) throws IOException { - InputStream is = new ByteArrayInputStream(bytecode); - ClassReader ckReader = new ClassReader(is); - InnerClassChecker ck = new InnerClassChecker(inner, this); - ckReader.accept(ck, ClassReader.SKIP_FRAMES); - is.close(); - // The metadata are collected during the visit. - } - - /** - * Manipulates the inner class. If the outer class was already manipulated does not re-manipulate the inner class. - * We consider that the manipulation cycle of the outer and inner classes are the same. - * @param inner the inner class name - * @param bytecode input (i.e. original) class - * @return the manipulated class - * @throws IOException the class cannot be read correctly - */ - public byte[] manipulateInnerClass(String inner, byte[] bytecode) throws IOException { - if (!m_alreadyManipulated) { - InputStream is1 = new ByteArrayInputStream(bytecode); - - ClassReader cr = new ClassReader(is1); - ClassWriter cw = new ClassLoaderAwareClassWriter(ClassWriter.COMPUTE_FRAMES, inner, null, m_classLoader); - InnerClassAdapter adapter = new InnerClassAdapter(inner, cw, m_className, this); - if (m_version >= Opcodes.V1_6) { - cr.accept(adapter, ClassReader.EXPAND_FRAMES); - } else { - cr.accept(adapter, 0); - } - is1.close(); - - return cw.toByteArray(); - } else { - // Return the unchanged inner class - return bytecode; - } - } - - public List getMethodsFromInnerClass(String innerClassInternalName) { - return m_inners.get(innerClassInternalName); - } - - public Map> getInnerClassesAndMethods() { - // Transform the map to use the simple name of the inner classes. - Map> map = new HashMap>(); - for (Map.Entry> entry : m_inners.entrySet()) { - String name = extractInnerClassName(toQualifiedName(entry.getKey())); - map.put(name, entry.getValue()); - } - return map; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java deleted file mode 100644 index 09cc1ea621..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodCodeAdapter.java +++ /dev/null @@ -1,122 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import java.util.Set; - -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.commons.GeneratorAdapter; - -/** - * Insert code calling callbacks at the entry and before the exit of a method. - * Moreover it replaces all GETFIELD and SETFIELD by getter and setter invocation. - * @author Felix Project Team - */ -public class MethodCodeAdapter extends GeneratorAdapter implements Opcodes { - - /** - * The owner class of the field. m_owner : String - */ - private String m_owner; - - /** - * Contained fields. - */ - private Set m_fields; - - /** - * MethodCodeAdapter constructor. - * @param mv : MethodVisitor - * @param owner : Name of the class - * @param access : Method access - * @param name : Method name - * @param desc : Method descriptor - * @param fields : Contained fields - */ - public MethodCodeAdapter(final MethodVisitor mv, final String owner, int access, String name, String desc, Set fields) { - super(Opcodes.ASM9, mv, access, name, desc); - m_owner = owner; - m_fields = fields; - } - - /** - * Visit an instruction modifying a method (GETFIELD/PUTFIELD). - * @see org.objectweb.asm.MethodVisitor#visitFieldInsn(int, String, String, String) - * @param opcode : visited operation code - * @param owner : owner of the field - * @param name : name of the field - * @param desc : descriptor of the field - */ - public void visitFieldInsn(final int opcode, final String owner, final String name, final String desc) { - if (owner.equals(m_owner) && m_fields.contains(name)) { - if (opcode == GETFIELD) { - String gDesc = "()" + desc; - visitMethodInsn(INVOKEVIRTUAL, owner, "__get" + name, gDesc, false); - return; - } else if (opcode == PUTFIELD) { - String sDesc = "(" + desc + ")V"; - visitMethodInsn(INVOKEVIRTUAL, owner, "__set" + name, sDesc, false); - return; - } - } - super.visitFieldInsn(opcode, owner, name, desc); - } - - /** - * Visits an annotation. - * If the annotation is visible, the annotation is removed. In fact - * the annotation was already moved to the method replacing this one. - * If the annotation is not visible, this annotation is kept on this method. - * @param name the name of the annotation - * @param visible the annotation visibility - * @return the null if the annotation is visible, otherwise returns - * {@link GeneratorAdapter#visitAnnotation(String, boolean)} - * @see org.objectweb.asm.commons.GeneratorAdapter#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String name, boolean visible) { - // Annotations are moved to the injected constructor. - if (visible) { - return null; - } else { - return super.visitAnnotation(name, false); - } - } - - /** - * Visits a parameter annotation. - * @param id the parameter number. - * @param name the annotation name - * @param visible if te annotation visibility - * @return the null if the annotation is visible, otherwise returns - * {@link GeneratorAdapter#visitAnnotation(String, boolean)} - * @see org.objectweb.asm.commons.GeneratorAdapter#visitParameterAnnotation(int, java.lang.String, boolean) - */ - public AnnotationVisitor visitParameterAnnotation(int id, String name, - boolean visible) { - if (visible) { - return null; - } else { - return super.visitParameterAnnotation(id, name, false); - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java deleted file mode 100644 index 28e9ccd4d3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulation/MethodDescriptor.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import java.util.*; - -import org.apache.felix.ipojo.manipulation.ClassChecker.AnnotationDescriptor; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.LocalVariableNode; - -/** - * Method Descriptor describe a method. - * @author Felix Project Team - */ -public class MethodDescriptor { - /** - * Method name. - */ - private final String m_name; - - /** - * Returned type. - */ - private final String m_returnType; - - /** - * Argument types. - */ - private final String[] m_arguments; - - /** - * The descriptor of the method. - */ - private final String m_desc; - - - /** - * The list of {@link AnnotationDescriptor} attached to this - * method. - */ - private List m_annotations; - - /** - * The association argument (number) - {@link AnnotationDescriptor}. - */ - private Map> m_parameterAnnotations = new HashMap>(); - - /** - * The arguments variables. - */ - private List m_argLocalVariables; - - /** - * The stack size to keep of the arguments. - */ - private final int m_argsVarLength; - - /** - * Flag indicating is the described method is static. - */ - private final boolean m_isStatic; - - /** - * The local variables by index. - * This map is used to detect the argument names. - */ - private LinkedHashMap m_locals = new LinkedHashMap(); - - /** - * Constructor. - * @param name : name of the method. - * @param desc : descriptor of the method. - * @param isStatic : is the method static - */ - public MethodDescriptor(String name, String desc, boolean isStatic) { - m_name = name; - m_desc = desc; - m_isStatic = isStatic; - Type ret = Type.getReturnType(desc); - Type[] args = Type.getArgumentTypes(desc); - - m_returnType = getType(ret); - m_arguments = new String[args.length]; - int argsVarLength = args.length; - if (!m_isStatic) { - argsVarLength++; - } - for (int i = 0; i < args.length; i++) { - String type = getType(args[i]); - m_arguments[i] = type; - if ("long".equals(type) || "double".equals(type)) { - argsVarLength++; - } - } - m_argsVarLength = argsVarLength; - } - - /** - * Add an annotation to the current method. - * @param ann annotation to add - */ - public void addAnnotation(AnnotationDescriptor ann) { - if (m_annotations == null) { - m_annotations = new ArrayList(); - } - m_annotations.add(ann); - } - - /** - * Add an annotation to the current method. - * @param ann annotation to add - */ - public void addParameterAnnotation(int id, AnnotationDescriptor ann) { - List list = m_parameterAnnotations.get(new Integer(id)); - if (list == null) { - list = new ArrayList(); - m_parameterAnnotations.put(new Integer(id), list); - } - list.add(ann); - } - - public List getAnnotations() { - return m_annotations; - } - - public Map> getParameterAnnotations() { - return m_parameterAnnotations; - } - - public String getDescriptor() { - return m_desc; - } - - /** - * Compute method manipulation metadata. - * @return the element containing metadata about this method. - */ - public Element getElement() { - Element method = new Element("method", ""); - method.addAttribute(new Attribute("name", m_name)); - - // Add return - if (!m_returnType.equals("void")) { - method.addAttribute(new Attribute("return", m_returnType)); - } - - // Add arguments - if (m_arguments.length > 0) { - StringBuilder args = new StringBuilder("{"); - StringBuilder names = new StringBuilder("{"); - args.append(m_arguments[0]); - if (m_locals.containsKey(1)) { - names.append(m_locals.get(1).name); // index +1 as the 0 is this - } - for (int i = 1; i < m_arguments.length; i++) { - args.append(",").append(m_arguments[i]); - if (m_locals.containsKey(i +1)) { - names.append(",").append(m_locals.get(i +1).name); - } - } - args.append("}"); - names.append("}"); - - method.addAttribute(new Attribute("arguments", args.toString())); - method.addAttribute(new Attribute("names", names.toString())); - } - - return method; - } - - /** - * Get the iPOJO internal type for the given type. - * @param type : type. - * @return the iPOJO internal type. - */ - private String getType(Type type) { - switch (type.getSort()) { - case Type.ARRAY: - // Append brackets. - String brackets = ""; - for (int i = 0; i < type.getDimensions(); i++) { - brackets += "[]"; - } - Type elemType = type.getElementType(); - return getType(elemType) + brackets; - case Type.BOOLEAN: - return "boolean"; - case Type.BYTE: - return "byte"; - case Type.CHAR: - return "char"; - case Type.DOUBLE: - return "double"; - case Type.FLOAT: - return "float"; - case Type.INT: - return "int"; - case Type.LONG: - return "long"; - case Type.OBJECT: - return type.getClassName(); - case Type.SHORT: - return "short"; - case Type.VOID: - return "void"; - default: - return "unknown"; - } - } - - public String getName() { - return m_name; - } - - public void addLocalVariable(String name, String desc, String signature, int index) { - m_locals.put(index, new LocalVariableNode(name, desc, signature, null, null, index)); - if (index >= m_argsVarLength) { - // keep only argument-related local variables definitions (others relate to code which isn't in this method) - return; - } - if (m_argLocalVariables == null) { - m_argLocalVariables = new ArrayList(); - } - m_argLocalVariables.add(new LocalVariableNode(name, desc, signature, null, null, index)); - } - - public void end() { - if (m_argLocalVariables != null && m_argLocalVariables.size() > 1) { - // sort them by index, even if from experience, argument-related variables (and only those) are already sorted - Collections.sort(m_argLocalVariables, new Comparator(){ - public int compare(LocalVariableNode o1, LocalVariableNode o2) { - return o1.index - o2.index; - } - }); - } - } - - public List getArgumentLocalVariables() { - return m_argLocalVariables; - } - - public LinkedHashMap getLocals() { - return m_locals; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestAttributeFilter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestAttributeFilter.java deleted file mode 100644 index c8af7f5f5d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestAttributeFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.metadata.Attribute; - -/** - * Defines a filter to be tested against Attribute contained - * in the Manifest. - * If one filter accept the attribute, others are ignored. - * @author Felix Project Team - */ -public interface ManifestAttributeFilter { - - /** - * Tests if the given Attribute is recognized by the filter - * @param attribute the tested attribute. - * @return true if the filter accept the - * value, false otherwise. - */ - public boolean accept(final Attribute attribute); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestProvider.java deleted file mode 100644 index 9a1a56b959..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManifestProvider.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.util.jar.Manifest; - -/** - * A {@code ManifestProvider} is responsible of providing the original - * {@link Manifest} of the manipulated Bundle. - * - * @author Felix Project Team - */ -public interface ManifestProvider { - - /** - * Returns the original bundle's Manifest. - * @return Manifest of the bundle - */ - Manifest getManifest(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationEngine.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationEngine.java deleted file mode 100644 index 7e723091f5..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationEngine.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.manipulation.Manipulator; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -/** - * A {@code ManipulationEngine} is responsible to drive the component's - * classes manipulation. - * - * @author Felix Project Team - */ -public class ManipulationEngine { - - /** - * The classloader given to the manipulator to load classes. - */ - private final ClassLoader m_classLoader; - /** - * List of component types. - */ - private List m_manipulationUnits = new ArrayList(); - - /** - * Error reporting. - */ - private Reporter m_reporter; - - /** - * Bytecode store. - */ - private ResourceStore m_store; - - /** - * The visitor handling output result. - */ - private ManipulationVisitor m_manipulationVisitor; - - public ManipulationEngine(ClassLoader classLoader) { - m_classLoader = classLoader; - } - - /** - * Add information related to a discovered component that will be manipulated. - * @param component additional component - */ - public void addManipulationUnit(ManipulationUnit component) { - m_manipulationUnits.add(component); - } - - public void setManipulationVisitor(ManipulationVisitor manipulationVisitor) { - m_manipulationVisitor = manipulationVisitor; - } - - /** - * @param reporter Feedback reporter. - */ - public void setReporter(Reporter reporter) { - m_reporter = reporter; - } - - /** - * Provides the bytecode store that allows to retrieve bytecode of the - * component's related resources (inner classes for example). - * @param store Helps to locate bytecode for classes. - */ - public void setResourceStore(ResourceStore store) { - m_store = store; - } - - /** - * Manipulates classes of all the given component's. - */ - public void generate() { - - // Iterates over the list of discovered components - // Note that this list includes components from metadata.xml AND from annotations - - for (ManipulationUnit info : m_manipulationUnits) { - - byte[] bytecode; - try { - bytecode = m_store.read(info.getResourcePath()); - } catch (IOException e) { - m_reporter.error("Cannot find bytecode for class '" + info.getClassName() + "': no bytecode found."); - return; - } - - // Is the visitor interested in this component ? - ManipulationResultVisitor result = m_manipulationVisitor.visitManipulationResult(info.getComponentMetadata()); - - if (result != null) { - // Should always be the case - - // Manipulation preparation - Manipulator manipulator = new Manipulator(m_classLoader); - try { - manipulator.prepare(bytecode); - } catch (IOException e) { - m_reporter.error("Cannot analyze the class " + info.getClassName() + " : " + e.getMessage()); - return; - } - - // Inner class preparation - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - String outerClassInternalName = info.getClassName().replace('.', '/'); - byte[] innerClassBytecode; - try { - innerClassBytecode = m_store.read(resourcePath); - manipulator.prepareInnerClass(inner, innerClassBytecode); - } catch (IOException e) { - m_reporter.error("Cannot find or analyze inner class '" + resourcePath + "'"); - return; - } - } - - // Now manipulate the classes. - try { - byte[] out = manipulator.manipulate(bytecode); - // Call the visitor - result.visitManipulatedResource(info.getResourcePath(), out); - } catch (IOException e) { - m_reporter.error("Cannot manipulate the class " + info.getClassName() + " : " + e.getMessage()); - return; - } - - // Visit inner classes - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - String outerClassInternalName = info.getClassName().replace('.', '/'); - byte[] innerClassBytecode; - try { - innerClassBytecode = m_store.read(resourcePath); - } catch (IOException e) { - m_reporter.error("Cannot find inner class '" + resourcePath + "'"); - return; - } - - // Manipulate inner class - // Notice that (for performance reason) re-use the class version information - // discovered in the main class instead of re-parsing the inner class to find - // its own class version - try { - byte[] manipulated = manipulator.manipulateInnerClass(inner, innerClassBytecode); - // Propagate manipulated resource - result.visitManipulatedResource(resourcePath, manipulated); - } catch (IOException e) { - m_reporter.error("Cannot manipulate inner class '" + resourcePath + "'"); - return; - } - } - - // Compute manipulation metadata - result.visitClassStructure(manipulator.getManipulationMetadata()); - - // All resources have been manipulated for this component - result.visitEnd(); - } - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationResultVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationResultVisitor.java deleted file mode 100644 index c186bd7c59..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationResultVisitor.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Visit manipulation results. - * - * @author Felix Project Team - */ -public interface ManipulationResultVisitor { - - /** - * Called once per visitor with the class' structure discovered during manipulation. - * @param structure Component's structure (discovered during manipulation, not the data from metadata.xml) - */ - void visitClassStructure(Element structure); - - /** - * Accept a manipulated resource (main component class or inner classes). - * @param type type name - * @param resource manipulated bytecode - */ - void visitManipulatedResource(String type, byte[] resource); - - /** - * Called when all resources from this manipulation result have been processed. - */ - void visitEnd(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationUnit.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationUnit.java deleted file mode 100644 index c5558b6e8b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationUnit.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Component Info. - * Represent a component type to be manipulated or already manipulated. - * @author Felix Project Team - */ -public class ManipulationUnit { - - private Element m_componentMetadata; - - private String m_resourcePath; - - private String m_className; - - /** - * Constructor. - * @param resourcePath class name - * @param meta component type metadata - */ - public ManipulationUnit(String resourcePath, Element meta) { - m_resourcePath = resourcePath; - m_componentMetadata = meta; - m_className = Strings.asClassName(resourcePath); - } - - /** - * @return Component Type metadata. - */ - public Element getComponentMetadata() { - return m_componentMetadata; - } - - /** - * @return Resource path - */ - public String getResourcePath() { - return m_resourcePath; - } - - /** - * @return Fully qualified class name - */ - public String getClassName() { - return m_className; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationVisitor.java deleted file mode 100644 index 6dcfd9e636..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ManipulationVisitor.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Visit manipulation results. - * - * @author Felix Project Team - */ -public interface ManipulationVisitor { - - /** - * Accept a manipulation result for the given component metadata. - * @param metadata component's metadata (from XML or annotations) - * @return a ManipulationResultVisitor if interested in theses manipulation results - */ - ManipulationResultVisitor visitManipulationResult(Element metadata); - - /** - * Visit metadata not associated with a component (ie no bytecode manipulation needed). - * @param metadata usually {@code instance}/{@code composite} metadata - */ - void visitMetadata(Element metadata); - - /** - * Called when all metadata have been processed. - */ - void visitEnd(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/MetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/MetadataProvider.java deleted file mode 100644 index 66c7a00c6c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/MetadataProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.io.IOException; -import java.util.List; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code MetadataProvider} is responsible to provide iPOJO's metadata. - * - * @author Felix Project Team - */ -public interface MetadataProvider { - - /** - * Gather all the metadata. - * @return a list of iPOJO metadata (never return null) - * @throws IOException if something wet wrong during gathering. - */ - List getMetadatas() throws IOException; -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java deleted file mode 100644 index 445caf25b9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Pojoization.java +++ /dev/null @@ -1,388 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import org.apache.felix.ipojo.manipulator.manifest.FileManifestProvider; -import org.apache.felix.ipojo.manipulator.metadata.*; -import org.apache.felix.ipojo.manipulator.render.MetadataRenderer; -import org.apache.felix.ipojo.manipulator.reporter.SystemReporter; -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.provider.ServiceLoaderModuleProvider; -import org.apache.felix.ipojo.manipulator.store.DirectoryResourceStore; -import org.apache.felix.ipojo.manipulator.store.JarFileResourceStore; -import org.apache.felix.ipojo.manipulator.store.builder.DefaultManifestBuilder; -import org.apache.felix.ipojo.manipulator.store.mapper.WABResourceMapper; -import org.apache.felix.ipojo.manipulator.util.Constants; -import org.apache.felix.ipojo.manipulator.util.Metadatas; -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.apache.felix.ipojo.manipulator.visitor.check.CheckFieldConsistencyVisitor; -import org.apache.felix.ipojo.manipulator.visitor.writer.ManipulatedResourcesWriter; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.xml.parser.SchemaResolver; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.util.List; -import java.util.jar.JarFile; - -/** - * Pojoization allows creating an iPOJO bundle from a "normal" bundle. - * - * @author Felix Project Team - */ -public class Pojoization { - - /** - * Flag describing if we need or not compute annotations. - * By default, compute the annotations. - */ - private boolean m_ignoreAnnotations; - - /** - * Flag describing if we need or not use local XSD files - * (i.e. use the {@link SchemaResolver} or not). - * If true the local XSD are used (default to {@literal false}). - */ - private boolean m_useLocalXSD = false; - - /** - * Reporter for error reporting. - */ - private final Reporter m_reporter; - - private final ModuleProvider m_moduleProvider; - - public Pojoization() { - this(new SystemReporter()); - } - - public Pojoization(ModuleProvider provider) { - this(new SystemReporter(), provider); - } - - public Pojoization(Reporter reporter) { - this(reporter, new ServiceLoaderModuleProvider()); - } - - public Pojoization(Reporter reporter, final ModuleProvider moduleProvider) { - m_reporter = reporter; - m_moduleProvider = moduleProvider; - m_reporter.info("Apache Felix iPOJO Manipulator - " + Constants.getVersion()); - } - - /** - * Activates annotation processing. - */ - public void disableAnnotationProcessing() { - m_ignoreAnnotations = true; - } - - /** - * Activates the entity resolver loading - * XSD files from the classloader. - */ - public void setUseLocalXSD() { - m_useLocalXSD = true; - } - - /** - * @return all the errors (fatal) reported by the manipulation process. - */ - public List getErrors() { - // Simple delegation for backward compatibility - return m_reporter.getErrors(); - } - - /** - * @return all the warnings (non fatal) reported by the manipulation process. - */ - public List getWarnings() { - // Simple delegation for backward compatibility - return m_reporter.getWarnings(); - } - - /** - * Manipulates an input bundle. - * This method creates an iPOJO bundle based on the given metadata file. - * The original and final bundles must be different. - *

- * This method does not use the classloader parameter, and use the classloader having loaded the - * {@link org.apache.felix.ipojo.manipulator.Pojoization} class. It's definitely not recommended. - * - * @param in the original bundle. - * @param out the final bundle. - * @param metadata the iPOJO metadata input stream. - * @deprecated - */ - public void pojoization(File in, File out, InputStream metadata) { - pojoization(in, out, metadata, this.getClass().getClassLoader()); - } - - /** - * Manipulates an input bundle. - * This method creates an iPOJO bundle based on the given metadata file. - * The original and final bundles must be different. - * - * @param in the original bundle. - * @param out the final bundle. - * @param metadata the iPOJO metadata input stream. - * @param loader the classloader used to compute the bytecode frames. - */ - public void pojoization(File in, File out, InputStream metadata, ClassLoader loader) { - StreamMetadataProvider provider = new StreamMetadataProvider(metadata, m_reporter); - provider.setValidateUsingLocalSchemas(m_useLocalXSD); - - ResourceStore store; - try { - JarFile origin = new JarFile(in); - JarFileResourceStore jfrs = new JarFileResourceStore(origin, out); - jfrs.setClassLoader(loader); - if (in.getName().endsWith(".war")) { - // this is a war file, use the right mapper - jfrs.setResourceMapper(new WABResourceMapper()); - } - jfrs.setManifest(origin.getManifest()); - DefaultManifestBuilder dmb = new DefaultManifestBuilder(); - dmb.setMetadataRenderer(new MetadataRenderer()); - jfrs.setManifestBuilder(dmb); - store = jfrs; - } catch (IOException e) { - m_reporter.error("The input file " + in.getAbsolutePath() + " is not a Jar file"); - return; - } - - ManipulationVisitor visitor = createDefaultVisitorChain(store); - - pojoization(store, provider, visitor, loader); - } - - private ManipulationVisitor createDefaultVisitorChain(ResourceStore store) { - ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter(); - writer.setReporter(m_reporter); - writer.setResourceStore(store); - - CheckFieldConsistencyVisitor checkFieldConsistencyVisitor = new CheckFieldConsistencyVisitor(writer); - checkFieldConsistencyVisitor.setReporter(m_reporter); - return checkFieldConsistencyVisitor; - } - - /** - * Manipulates an input bundle. - * This method creates an iPOJO bundle based on the given metadata file. - * The original and final bundles must be different. - *

- * This method does not use the classloader parameter, and use the classloader having loaded the - * {@link org.apache.felix.ipojo.manipulator.Pojoization} class. It's definitely not recommended. - * - * @param in the original bundle. - * @param out the final bundle. - * @param metadataFile the iPOJO metadata file (XML). - * @deprecated - */ - public void pojoization(File in, File out, File metadataFile) { - pojoization(in, out, metadataFile, this.getClass().getClassLoader()); - } - - /** - * Manipulates an input bundle. - * This method creates an iPOJO bundle based on the given metadata file. - * The original and final bundles must be different. - * - * @param in the original bundle. - * @param out the final bundle. - * @param metadataFile the iPOJO metadata file (XML). - * @param loader the classloader used to compute the bytecode frames. - */ - public void pojoization(File in, File out, File metadataFile, ClassLoader loader) { - MetadataProvider provider = new EmptyMetadataProvider(); - if (metadataFile != null) { - FileMetadataProvider fileMetadataProvider = new FileMetadataProvider(metadataFile, m_reporter); - fileMetadataProvider.setValidateUsingLocalSchemas(m_useLocalXSD); - provider = fileMetadataProvider; - } - - ResourceStore store; - try { - JarFile origin = new JarFile(in); - JarFileResourceStore jfrs = new JarFileResourceStore(origin, out); - jfrs.setClassLoader(loader); - if (in.getName().endsWith(".war")) { - // this is a war file, use the right mapper - jfrs.setResourceMapper(new WABResourceMapper()); - } - jfrs.setManifest(origin.getManifest()); - DefaultManifestBuilder dmb = new DefaultManifestBuilder(); - dmb.setMetadataRenderer(new MetadataRenderer()); - jfrs.setManifestBuilder(dmb); - store = jfrs; - } catch (IOException e) { - m_reporter.error("The input file " + in.getAbsolutePath() + " is not a Jar file"); - return; - } - - ManipulationVisitor visitor = createDefaultVisitorChain(store); - - pojoization(store, provider, visitor, loader); - } - - /** - * Manipulates an expanded bundles. - * Classes are in the specified directory. - * this method allows to update a customized manifest. - *

- * This method does not use the classloader parameter, and use the classloader having loaded the - * {@link org.apache.felix.ipojo.manipulator.Pojoization} class. It's definitely not recommended. - * - * @param directory the directory containing classes - * @param metadataFile the metadata file - * @param manifestFile the manifest file. null to use directory/META-INF/MANIFEST.mf - * @deprecated - */ - public void directoryPojoization(File directory, File metadataFile, File manifestFile) { - directoryPojoization(directory, metadataFile, manifestFile, this.getClass().getClassLoader()); - } - - /** - * Manipulates an expanded bundles. - * Classes are in the specified directory. - * this method allows to update a customized manifest. - * - * @param directory the directory containing classes - * @param metadataFile the metadata file - * @param manifestFile the manifest file. null to use directory/META-INF/MANIFEST.mf - * @param loader the classloader used to compute the bytecode frames. - */ - public void directoryPojoization(File directory, File metadataFile, File manifestFile, ClassLoader loader) { - // Get the metadata.xml location if not null - MetadataProvider provider = new EmptyMetadataProvider(); - if (metadataFile != null) { - FileMetadataProvider fileMetadataProvider = new FileMetadataProvider(metadataFile, m_reporter); - fileMetadataProvider.setValidateUsingLocalSchemas(m_useLocalXSD); - provider = fileMetadataProvider; - } - - ManifestProvider manifestProvider; - File selectedManifestFile; - if (manifestFile != null) { - if (manifestFile.isFile()) { - try { - manifestProvider = new FileManifestProvider(manifestFile); - selectedManifestFile = manifestFile; - } catch (IOException e) { - m_reporter.error("Cannot read Manifest from '" + manifestFile.getAbsolutePath() + "'"); - return; - } - } else { - m_reporter.error("The manifest file " + manifestFile.getAbsolutePath() + " does not exist"); - return; - } - } else { - // If the manifest is not specified, the m_dir/META-INF/MANIFEST.MF is used. - File metaInf = new File(directory, "META-INF"); - File original = new File(metaInf, "MANIFEST.MF"); - if (original.isFile()) { - try { - manifestProvider = new FileManifestProvider(original); - selectedManifestFile = original; - } catch (IOException e) { - m_reporter.error("Cannot read Manifest from '" + original.getAbsolutePath() + "'"); - return; - } - } else { - m_reporter.error("The manifest file " + original.getAbsolutePath() + " does not exist"); - return; - } - } - - DirectoryResourceStore store; - if (directory.exists() && directory.isDirectory()) { - store = new DirectoryResourceStore(directory); - File webinf = new File(directory, "WEB-INF"); - if (directory.getName().endsWith(".war") || webinf.isDirectory()) { - // this is a war file, use the right mapper - store.setResourceMapper(new WABResourceMapper()); - } - store.setManifest(manifestProvider.getManifest()); - store.setManifestFile(selectedManifestFile); - DefaultManifestBuilder dmb = new DefaultManifestBuilder(); - dmb.setMetadataRenderer(new MetadataRenderer()); - store.setManifestBuilder(dmb); - } else { - m_reporter.error("The directory " + directory.getAbsolutePath() + " does not exist or is not a directory."); - return; - } - - ManipulationVisitor visitor = createDefaultVisitorChain(store); - - pojoization(store, provider, visitor, loader); - - } - - public void pojoization(final ResourceStore store, - final MetadataProvider metadata, - final ManipulationVisitor visitor, - final ClassLoader loader) { - - ManipulationEngine engine = new ManipulationEngine(loader); - engine.setResourceStore(store); - engine.setReporter(m_reporter); - engine.setManipulationVisitor(visitor); - - try { - - // Creates a composite to store multiple metadata providers - CompositeMetadataProvider composite = new CompositeMetadataProvider(m_reporter); - composite.addMetadataProvider(metadata); - - if (!m_ignoreAnnotations) { - composite.addMetadataProvider(new AnnotationMetadataProvider(store, m_moduleProvider, m_reporter)); - } - - // Get metadata - List metadatas = composite.getMetadatas(); - - // Construct ManipulationUnits - // And collect non-component metadata - for (Element meta : metadatas) { - String name = Metadatas.getComponentType(meta); - if (name != null) { - // Only handler and component have a classname attribute - String path = Strings.asResourcePath(name); - engine.addManipulationUnit(new ManipulationUnit(path, meta)); - } else { - visitor.visitMetadata(meta); - } - } - - } catch (IOException e) { - m_reporter.error("Cannot load metadata " + e.getMessage()); - return; - } - - // Start the manipulation - engine.generate(); - - // Tell the visitor that we have finished - visitor.visitEnd(); - - } -} - diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java deleted file mode 100644 index ba221d3128..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/QuotedTokenizer.java +++ /dev/null @@ -1,200 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.util.ArrayList; -import java.util.List; - -/** - * Parse on OSGi Manifest clause. - * @author Felix Project Team - */ -public class QuotedTokenizer { - /** - * String to parse. - */ - String m_string; - - /** - * Index. - */ - int m_index = 0; - - /** - * Default separator to use. - */ - String m_separators; - - /** - * Does the tokenizer returns token. - */ - boolean m_returnTokens; - - /** - * Peek. - */ - String m_peek; - - /** - * Separator. - */ - char m_separator; - - /** - * Constructors. - * @param string : input String. - * @param separators : separators. - * @param returnTokens : should the tokenizer return tokens ? - */ - public QuotedTokenizer(String string, String separators, boolean returnTokens) { - if (string == null) { - throw new IllegalArgumentException("string argument must be not null"); - } - this.m_string = string; - this.m_separators = separators; - this.m_returnTokens = returnTokens; - } - - /** - * Constructors. - * Set returnTokens to false. - * @param string : input String. - * @param separators : separators - */ - public QuotedTokenizer(String string, String separators) { - this(string, separators, false); - } - - /** - * Get the next token. - * @param separators : separators to used. - * @return : the next token. - */ - public String nextToken(String separators) { - m_separator = 0; - if (m_peek != null) { - String tmp = m_peek; - m_peek = null; - return tmp; - } - - if (m_index == m_string.length()) { return null; } - - StringBuffer sb = new StringBuffer(); - - while (m_index < m_string.length()) { - char c = m_string.charAt(m_index++); - - if (Character.isWhitespace(c)) { - if (m_index == m_string.length()) { - break; - } else { - continue; - } - } - - if (separators.indexOf(c) >= 0) { - if (m_returnTokens) { - m_peek = Character.toString(c); - } else { - m_separator = c; - } - break; - } - - switch (c) { - case '"': - case '\'': - quotedString(sb, c); - break; - - default: - sb.append(c); - } - } - String result = sb.toString().trim(); - if (result.length() == 0 && m_index == m_string.length()) { return null; } - return result; - } - - /** - * Get the next token. - * Used the defined separators. - * @return the next token. - */ - public String nextToken() { - return nextToken(m_separators); - } - - /** - * Append the next quote to the given String Buffer. - * @param sb : accumulator. - * @param c : quote. - */ - private void quotedString(StringBuffer sb, char c) { - char quote = c; - while (m_index < m_string.length()) { - c = m_string.charAt(m_index++); - if (c == quote) { break; } - if (c == '\\' && m_index < m_string.length() && m_string.charAt(m_index + 1) == quote) { - c = m_string.charAt(m_index++); - } - sb.append(c); - } - } - - public String[] getTokens() { - return getTokens(0); - } - - /** - * Get the list of tokens. - * @param cnt : array length. - * @return : the array of token. - */ - private String[] getTokens(int cnt) { - String token = nextToken(); - if (token == null) { - return new String[cnt]; - } - - String[] result = getTokens(cnt + 1); - result[cnt] = token; - return result; - } - - public char getSeparator() { - return m_separator; - } - - /** - * Get token list. - * @return the list of token. - */ - public List getTokenSet() { - List list = new ArrayList(); - String token = nextToken(); - while (token != null) { - list.add(token); - token = nextToken(); - } - return list; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Reporter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Reporter.java deleted file mode 100644 index 74cc79a4a7..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/Reporter.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.util.List; - -/** - * A {@code Reporter} is responsible to handle feedback from within the - * manipulation process in order to let API consumers deal with errors - * and warnings. - * - * @author Felix Project Team - */ -public interface Reporter { - - /** - * Add aa trace message - * It accepts a {@link Throwable} as last argument. - * @param message trace message. - * @param args message's argument - */ - void trace(String message, Object... args); - - /** - * Add an informative message - * It accepts a {@link Throwable} as last argument. - * @param message info message. - * @param args message's argument - */ - void info(String message, Object... args); - - /** - * Add a message in the warning list. - * It accepts a {@link Throwable} as last argument. - * @param message warning message. - * @param args message's argument - */ - void warn(String message, Object... args); - - /** - * Add a message in the error list. - * It accepts a {@link Throwable} as last argument. - * @param message error message. - * @param args message's argument - */ - void error(String message, Object... args); - - /** - * @return all the errors (fatal) reported by the manipulation process. - */ - List getErrors(); - - /** - * @return all the warnings (non fatal) reported by the manipulation process. - */ - List getWarnings(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceStore.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceStore.java deleted file mode 100644 index 4ae549527c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceStore.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.io.IOException; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Abstract input/output for the manipulation process. - * - * @author Felix Project Team - */ -public interface ResourceStore { - - /** - * Return the bytecode of the given class name. - * @param path normalized resource path (format: {@literal org/objectweb/asm/Visitor.class}) - * @return the byte array representing the given class - * @throws IOException if resource was not found - */ - byte[] read(String path) throws IOException; - - /** - * Browse all resources available in this store. - * @param visitor is called for each available resource - */ - void accept(ResourceVisitor visitor); - - /** - * Notify the store that resource will be written. - * @throws IOException if there was an error - */ - void open() throws IOException; - - /** - * Writes the given Element into this store. - * Typically a store implementation will use this to build a Manifest. - * @param metadata Element metadata to be inserted - */ - void writeMetadata(Element metadata); - - /** - * Notify the builder that a new resource has been built and should - * be stored in the resulting bundle. - * @param resourcePath resource name of the class (format: {@literal org/objectweb/asm/Visitor.class}) - * @param resource content of the resource - * @throws IOException if there was an error storing the resource - */ - void write(String resourcePath, byte[] resource) throws IOException; - - /** - * Close the store: no methods will be called anymore on this instance. - * @throws IOException if close failed - */ - void close() throws IOException; - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceVisitor.java deleted file mode 100644 index d94c665444..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/ResourceVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.manipulator; - -/** - * A {@code ResourceVisitor} is invoked when a potential class is - * - * @author Felix Project Team - */ -public interface ResourceVisitor { - - /** - * Visit a resource discovered in the original bundle. - * @param name resource's name (format: {@literal org/objectweb/asm/Visitor.class}) - */ - void visit(String name); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProvider.java deleted file mode 100644 index 8468124a7b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.manipulator.manifest; - -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.manipulator.ManifestProvider; - -/** - * A {@code DirectManifestProvider} simply serves an already available {@link Manifest}. - * - * @author Felix Project Team - */ -public class DirectManifestProvider implements ManifestProvider { - - /** - * Served Manifest. - */ - private Manifest m_manifest; - - /** - * Construct a provider servicing the given manifest. - * @param manifest Manifest to be serviced - */ - public DirectManifestProvider(Manifest manifest) { - m_manifest = manifest; - } - - public Manifest getManifest() { - return m_manifest; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProvider.java deleted file mode 100644 index 23d441e789..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProvider.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.manipulator.manifest; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.manipulator.ManifestProvider; -import org.apache.felix.ipojo.manipulator.util.Streams; - -/** - * A {@code FileManifestProvider} reads a {@link Manifest} from the given input {@link File}. - * - * @author Felix Project Team - */ -public class FileManifestProvider implements ManifestProvider { - - /** - * Read manifest. - */ - private Manifest m_manifest; - - /** - * Read the manifest from the given input file - * @param resource File pointing to a Manifest file - * @throws IOException if there is an error during File IO operations - * or if the file is not a valid manifest. - */ - public FileManifestProvider(File resource) throws IOException { - m_manifest = new Manifest(); - InputStream is = null; - try { - is = new FileInputStream(resource); - m_manifest.read(is); - } finally { - Streams.close(is); - } - } - - public Manifest getManifest() { - return m_manifest; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProvider.java deleted file mode 100644 index 218cf10225..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProvider.java +++ /dev/null @@ -1,126 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ClassMetadataCollector; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.apache.felix.ipojo.manipulator.spi.provider.CoreModuleProvider; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.ClassReader; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Bindings.newBindingRegistry; - -/** - * A {@code AnnotationMetadataProvider} loads iPOJO metadata from bytecode of classes. - * - * @author Felix Project Team - */ -public class AnnotationMetadataProvider implements MetadataProvider { - - private ResourceStore m_store; - - private Reporter m_reporter; - private BindingRegistry m_registry; - - public AnnotationMetadataProvider(final ResourceStore store, - final Reporter reporter) { - this(store, new CoreModuleProvider(), reporter); - } - - public AnnotationMetadataProvider(final ResourceStore store, - final ModuleProvider provider, - final Reporter reporter) { - this(store, newBindingRegistry(reporter, store, provider), reporter); - } - - public AnnotationMetadataProvider(final ResourceStore store, - final BindingRegistry registry, - final Reporter reporter) { - this.m_store = store; - this.m_registry = registry; - this.m_reporter = reporter; - } - - public List getMetadatas() throws IOException { - - final List metadata = new ArrayList(); - - - m_store.accept(new ResourceVisitor() { - public void visit(String name) { - if (name.endsWith(".class")) { - - // Read file's content - byte[] data = null; - try { - data = m_store.read(name); - } catch (IOException e) { - m_reporter.warn("Cannot read content of %s", name); - } - - // We check the array size to avoid manipulating empty files - // produced by incremental compilers (like Eclipse Compiler) - if (data != null && data.length > 0) { - computeAnnotations(name, data, metadata); - } else { - m_reporter.error("Cannot compute annotations from %s : Empty file", name); - } - } - } - }); - - return metadata; - } - - /** - * Parse the content of the class to detect annotated classes. - * @param name Resource's name - * @param bytecode the class' content to inspect. - * @param metadata list of metadata to be filled - */ - private void computeAnnotations(String name, byte[] bytecode, List metadata) { - - ClassReader cr = new ClassReader(bytecode); - ClassMetadataCollector collector = new ClassMetadataCollector(m_registry, m_reporter); - cr.accept(collector, 0); - - if (collector.getComponentMetadata() != null) { - metadata.add(collector.getComponentMetadata()); - - // Instantiate ? - Element instance = collector.getInstanceMetadata(); - if (instance != null) { - m_reporter.trace("Declaring an instance of %s", instance.getAttribute("component")); - metadata.add(instance); - } - } - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProvider.java deleted file mode 100644 index 50416b3d6c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProvider.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code CacheableMetadataProvider} provides simple caching methods to avoid - * calling {@link MetadataProvider#getMetadatas()} twice. - * - * TODO Do we really need this ? ATM it is not used ... - * - * @author Felix Project Team - */ -public class CacheableMetadataProvider implements MetadataProvider { - - /** - * Delegate. - */ - private MetadataProvider m_delegate; - - /** - * Cached elements. - */ - private List m_cached; - - public CacheableMetadataProvider(MetadataProvider delegate) { - m_delegate = delegate; - } - - public List getMetadatas() throws IOException { - - // Only ask the delegate if cache is empty - if (m_cached == null) { - m_cached = new ArrayList(); - m_cached.addAll(m_delegate.getMetadatas()); - } - return m_cached; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProvider.java deleted file mode 100644 index 619683753d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProvider.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code CompositeMetadataProvider} is responsible to detect duplicates - * component's declaration. - * - * @author Felix Project Team - */ -public class CompositeMetadataProvider implements MetadataProvider { - - private List m_providers = new ArrayList(); - private Reporter m_reporter; - - public CompositeMetadataProvider(Reporter reporter) { - m_reporter = reporter; - } - - public void addMetadataProvider(MetadataProvider provider) { - m_providers.add(provider); - } - - public List getMetadatas() throws IOException { - List metadata = new ArrayList(); - for (MetadataProvider provider : m_providers) { - - List loaded = provider.getMetadatas(); - - // Analyze each newly loaded metadata - // And find duplicate component definition - - for (Element meta : loaded) { - if (isInstance(meta)) { - // This is an instance, just add it to the list - metadata.add(meta); - } else { - // Handler or Component - // Finds duplicate (if any) - String name = getComponentName(meta); - if (name != null) { - if (isDuplicate(metadata, name)) { - // TODO Try to add more information here, but what ? - m_reporter.warn("The component type " + name + " is duplicated."); - } else { - metadata.add(meta); - } - } else { - // no name, strange, but add it to the list - metadata.add(meta); - } - } - } - } - return metadata; - } - - private boolean isDuplicate(List elements, String name) { - for (Element element : elements) { - if (!isInstance(element) && name.equals(getComponentName(element))) { - return true; - } - } - return false; - } - - private String getComponentName(Element element) { - return element.getAttribute("name"); - } - - private boolean isInstance(Element element) { - return "instance".equals(element.getName()); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProvider.java deleted file mode 100644 index 2fa1acf08b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code EmptyMetadataProvider} simply returns an empty list of Element. - * - * @author Felix Project Team - */ -public class EmptyMetadataProvider implements MetadataProvider { - - public List getMetadatas() throws IOException { - // Do not use Collections.emptyList() as the manipulator - // adds discovered components in this list - // TODO maybe the manipulator can have it's own list add we simply addAll() ? - return new ArrayList(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProvider.java deleted file mode 100644 index 18d851bffe..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProvider.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code FileMetadataProvider} is responsible of loading all the {@literal .xml} files in the given directory. - * It also accepts a direct reference to a {@literal metadata.xml} file. - * - * @author Felix Project Team - */ -public class FileMetadataProvider implements MetadataProvider { - - /** - * Metadata source (file or directory). - */ - private File m_source; - - /** - * Feedback reporter. - */ - private Reporter m_reporter; - - /** - * Validate using local schemas or not ? - */ - private boolean m_validateUsingLocalSchemas = false; - - /** - * Constructs a metadata provider using the given source File (directory - * or file) to load iPOJO metadata. - * @param source source of the metadata - * @param reporter feedback reporter - */ - public FileMetadataProvider(File source, Reporter reporter) { - m_source = source; - m_reporter = reporter; - } - - public void setValidateUsingLocalSchemas(boolean validateUsingLocalSchemas) { - m_validateUsingLocalSchemas = validateUsingLocalSchemas; - } - - public List getMetadatas() throws IOException { - - List metadata = new ArrayList(); - traverse(m_source, metadata); - return metadata; - } - - private void traverse(File file, List metadata) { - if (file.isDirectory()) { - // Traverse the directory and parse all files. - File[] files = file.listFiles(); - for (File child : files) { - traverse(child, metadata); - } - } else if (file.getName().endsWith(".xml")) { // Detect XML by extension, - // others are ignored. - loadFileMetadata(file, metadata); - } - - } - - private void loadFileMetadata(File file, List metadata) { - try { - // Sanity check, should be OK, but we never know ... - InputStream stream = null; - URL url = file.toURI().toURL(); - stream = url.openStream(); - StreamMetadataProvider provider = new StreamMetadataProvider(stream, m_reporter); - provider.setValidateUsingLocalSchemas(m_validateUsingLocalSchemas); - metadata.addAll(provider.getMetadatas()); - } catch (MalformedURLException e) { - m_reporter.error("Cannot open the metadata input stream from " + m_source.getAbsolutePath() + ": " + e.getMessage()); - } catch (IOException e) { - m_reporter.error("Cannot open the metadata input stream: " + m_source.getAbsolutePath() + ": " + e.getMessage()); - } - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProvider.java deleted file mode 100644 index 034257eca8..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProvider.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.xml.parser.ParseException; -import org.apache.felix.ipojo.xml.parser.SchemaResolver; -import org.apache.felix.ipojo.xml.parser.XMLMetadataParser; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; -import org.xml.sax.XMLReader; -import org.xml.sax.helpers.XMLReaderFactory; - -/** - * A {@code StreamManifestProvider} knows how to load metadata from an InputStream. - * - * @author Felix Project Team - */ -public class StreamMetadataProvider implements MetadataProvider { - - private InputStream m_stream; - - private Reporter m_reporter; - - private boolean m_validateUsingLocalSchemas = false; - - public StreamMetadataProvider(InputStream stream, Reporter reporter) { - m_stream = stream; - m_reporter = reporter; - } - - /** - * Force XML schemas resolution to be performed locally - */ - public void setValidateUsingLocalSchemas(boolean validateUsingLocalSchemas) { - m_validateUsingLocalSchemas = validateUsingLocalSchemas; - } - - public List getMetadatas() throws IOException { - - // First time we've been called: parse the XML Stream - List metadata = new ArrayList(); - - try { - XMLMetadataParser handler = new XMLMetadataParser(); - - XMLReader parser = XMLReaderFactory.createXMLReader(); - parser.setContentHandler(handler); - parser.setFeature("http://xml.org/sax/features/validation", true); - parser.setFeature("http://apache.org/xml/features/validation/schema", true); - parser.setErrorHandler(handler); - if (m_validateUsingLocalSchemas) { - parser.setEntityResolver(new SchemaResolver()); - } - - // Parse the XML - InputSource is = new InputSource(m_stream); - parser.parse(is); - Element[] meta = handler.getMetadata(); - - // Add parsed metadata - if (meta != null) { - metadata.addAll(Arrays.asList(meta)); - } - - // Output a warning message if no metadata was found - if (meta == null || meta.length == 0) { - m_reporter.warn("Neither component types, nor instances in the XML metadata"); - } - - } catch (IOException e) { - m_reporter.error("Cannot open the metadata input stream: " + e.getMessage()); - } catch (ParseException e) { - m_reporter.error("Parsing error when parsing the XML file: " + e.getMessage()); - } catch (SAXParseException e) { - m_reporter.error("Error during metadata parsing at line " + e.getLineNumber() + " : " + e.getMessage()); - } catch (SAXException e) { - m_reporter.error("Parsing error when parsing (Sax Error) the XML file: " + e.getMessage()); - } finally { - Streams.close(m_stream); - } - - return metadata; - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java deleted file mode 100644 index 632b8dd64d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ClassMetadataCollector.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.*; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -/** - * @author Felix Project Team - */ -public class ClassMetadataCollector extends ClassVisitor { - - /** - * Binding's registry. - */ - private BindingRegistry registry; - - /** - * Output information. - */ - private Reporter reporter; - - /** - * Workbench where produced Elements will be merged and hierarchically organized. - */ - private ComponentWorkbench workbench; - - /** - * Class currently being analyzed. - */ - private ClassNode node; - - private Element componentMetadata; - - private Element instanceMetadata; - - public ClassMetadataCollector(BindingRegistry registry, Reporter reporter) { - super(Opcodes.ASM9); - this.registry = registry; - this.reporter = reporter; - node = new ClassNode(); - } - - /** - * Build metadata. May be {@literal null} if no "component type" was found. - * - * @return Build metadata. May be {@literal null} if no "component type" was found. - */ - public Element getComponentMetadata() { - return componentMetadata; - } - - /** - * Build instance metadata. May be {@literal null} if no "component type" was found. - * - * @return Build metadata. May be {@literal null} if no "component type" was found. - */ - public Element getInstanceMetadata() { - return instanceMetadata; - } - - @Override - public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { - node.visit(version, access, name, signature, superName, interfaces); - workbench = new ComponentWorkbench(registry, node); - } - - /** - * Visit class annotations. - * This method detects @component and @provides annotations. - * - * @param desc : annotation descriptor. - * @param visible : is the annotation visible at runtime. - * @return the annotation visitor. - * @see org.objectweb.asm.ClassVisitor#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - //TODO we should find a better way to do this. - // Cannot retrieve the class object as @Configuration is in iPOJO runtime. - if (Type.getType(desc).getClassName().equals("org.apache.felix.ipojo.configuration.Configuration")) { - workbench.ignore(true); - return null; - } - - // Return the visitor to be executed (may be null) - return registry.selection(workbench) - .type(this, node) - .annotatedWith(desc) - .get(); - - } - - /** - * Visit a field. - * Call the field collector visitor. - * - * @param access : field access. - * @param name : field name - * @param desc : field descriptor - * @param signature : field signature - * @param value : field value (static field only) - * @return the field visitor. - * @see org.objectweb.asm.ClassVisitor#visitField(int, java.lang.String, java.lang.String, java.lang.String, - * java.lang.Object) - */ - public FieldVisitor visitField(int access, String name, String desc, String signature, Object value) { - return new FieldMetadataCollector(workbench, new FieldNode(access, name, desc, signature, value)); - } - - /** - * Visit a method. - * Call the method collector visitor. - * - * @param access : method access - * @param name : method name - * @param desc : method descriptor - * @param signature : method signature - * @param exceptions : method exceptions - * @return the Method Visitor. - * @see org.objectweb.asm.ClassVisitor#visitMethod(int, java.lang.String, java.lang.String, java.lang.String, java.lang.String[]) - */ - public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { - return new MethodMetadataCollector(workbench, new MethodNode(access, name, desc, signature, exceptions), reporter); - } - - /** - * End of the visit : compute final elements. - * - * @see org.objectweb.asm.ClassVisitor#visitEnd() - */ - @Override - public void visitEnd() { - // Only process real class (no annotations, no interfaces) - if (!(is(Opcodes.ACC_ANNOTATION) || is(Opcodes.ACC_INTERFACE) || is(Opcodes.ACC_ABSTRACT))) { - if (workbench.getRoot() == null) { - // No 'top-level' element has been contributed - - if (workbench.ignore()) { - // Ignore this class. - return; - } - - if (!workbench.getElements().isEmpty()) { - // There are other annotation's contribution on this type (additional handler declaration/configuration) - // That means that there is a missing 'component type' annotation - - reporter.warn("Class %s has not been marked as a component type (no @Component, @Handler, " + - "...). It will be ignored by the iPOJO manipulator.", - workbench.getType().getClassName() - ); - return; - } // else: no root and no elements - return; - } - - componentMetadata = workbench.build(); - instanceMetadata = workbench.getInstance(); - - // If we have an instance declared and the component metadata has a name, we update the component's attribute - // of the instance (https://issues.apache.org/jira/browse/FELIX-4052). - if (componentMetadata != null && componentMetadata.containsAttribute("name") && instanceMetadata != null) { - // Update the component attribute - instanceMetadata.addAttribute(new Attribute("component", componentMetadata.getAttribute("name"))); - } - - } - } - - private boolean is(int flags) { - return (node.access & flags) == flags; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java deleted file mode 100644 index 421bbbada0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbench.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.ClassNode; - -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.TreeMap; - -/** - * @author Felix Project Team - */ -public class ComponentWorkbench { - - /** - * Root element (usually or ). - * Maybe null until set. - */ - private Element root; - - /** - * Instance element (may be {@literal null}). - */ - private Element instance; - - /** - * Map of [element ids, element]. - * This map is used to easily get an already created element. - */ - private Map m_ids = new TreeMap(); - - /** - * Map of [element, referto]. - * This map is used to recreate the element hierarchy. - * Stored element are added under referred element. - */ - private Map m_elements = new LinkedHashMap(); - - private Type type; - - private BindingRegistry bindingRegistry; - - private ClassNode classNode; - - /** - * A flag indicating if the class needs to be ignored. - */ - private boolean toIgnore; - - public ComponentWorkbench(BindingRegistry bindingRegistry, ClassNode node) { - this.bindingRegistry = bindingRegistry; - this.classNode = node; - this.type = Type.getObjectType(node.name); - } - - public Type getType() { - return type; - } - - public BindingRegistry getBindingRegistry() { - return bindingRegistry; - } - - public ClassNode getClassNode() { - return classNode; - } - - /** - * The identified root Element. May be null if at the visit time, the root as not been identified. - * - * @return the root Element. or {@literal null} if not defined at the execution time. - */ - public Element getRoot() { - return root; - } - - public void setRoot(Element root) { - // TODO check if root already assigned - this.root = root; - } - - public Element getInstance() { - return instance; - } - - public void setInstance(Element instance) { - this.instance = instance; - } - - public Map getIds() { - return m_ids; - } - - public Map getElements() { - return m_elements; - } - - public Element build() { - - if (root == null) { - // No 'top level' component Element has been registered - return null; - } - - // Iterates on all contributed Elements - for (Element current : m_elements.keySet()) { - - // If the traversed Element has a reference to another Element, - // it has to be moved inside that referenced Element - // This is useful for contributing data to other handlers - - String refId = m_elements.get(current); - if (refId == null) { - // No reference provided, just add it a a direct child - root.addElement(current); - } else { - - // Get the referenced Element (if any) - Element ref = m_ids.get(refId); - if (ref == null) { - // Add to the root Element - root.addElement(current); - } else { - // Add as child of the referenced Element - ref.addElement(current); - } - } - } - - // Clear - m_ids.clear(); - m_elements.clear(); - - return root; - - } - - /** - * Checks whether this class must be ignored. - * - * @return {@code true} if the class is ignored. - */ - public boolean ignore() { - return toIgnore; - } - - /** - * Sets the 'ignore' aspect of the current class. - * - * @param ignore whether or not the class must be ignored. - */ - public void ignore(boolean ignore) { - this.toIgnore = ignore; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java deleted file mode 100644 index 184c714890..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/FieldMetadataCollector.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.FieldNode; - -/** - * @author Felix Project Team - */ -public class FieldMetadataCollector extends FieldVisitor { - - /** - * Binding's registry. - */ - private BindingRegistry registry; - - /** - * The workbench currently in use. - */ - private ComponentWorkbench workbench; - - /** - * Visited field. - */ - private FieldNode node; - - public FieldMetadataCollector(ComponentWorkbench workbench, FieldNode node) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.node = node; - this.registry = workbench.getBindingRegistry(); - } - - /** - * Visit annotations on the current field. - * @param desc : annotation name - * @param visible : is the annotation a runtime annotation. - * @return the annotation visitor visiting the annotation - * @see org.objectweb.asm.FieldVisitor#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - - // Return the visitor to be executed (may be null) - return registry.selection(workbench) - .field(this, node) - .annotatedWith(desc) - .get(); - - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java deleted file mode 100644 index fed92f2a75..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/MethodMetadataCollector.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.tree.MethodNode; - -/** - * @author Felix Project Team - */ -public class MethodMetadataCollector extends MethodVisitor { - - /** - * Binding's registry. - */ - private BindingRegistry registry; - - /** - * The workbench currently in use. - */ - private ComponentWorkbench workbench; - - /** - * Visited field. - */ - private MethodNode node; - - public MethodMetadataCollector(ComponentWorkbench workbench, MethodNode node, Reporter reporter) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.node = node; - this.registry = workbench.getBindingRegistry(); - } - - /** - * Visit method annotations. - * - * @param desc : annotation name. - * @param visible : is the annotation visible at runtime. - * @return the visitor paring the visited annotation. - * @see org.objectweb.asm.MethodVisitor#visitAnnotation(java.lang.String, boolean) - */ - public AnnotationVisitor visitAnnotation(String desc, boolean visible) { - // Return the visitor to be executed (may be null) - return registry.selection(workbench) - .method(this, node) - .annotatedWith(desc) - .get(); - - } - - /** - * Visit a parameter annotation. - * - * @see org.objectweb.asm.MethodVisitor#visitParameterAnnotation(int, java.lang.String, boolean) - */ - public AnnotationVisitor visitParameterAnnotation(int index, - String desc, - boolean visible) { - // Only process annotations on constructor - if (node.name.equals("")) { - - // Return the visitor to be executed (may be null) - return registry.selection(workbench) - .parameter(this, node, index) - .annotatedWith(desc) - .get(); - - } - return super.visitParameterAnnotation(index, desc, visible); - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java deleted file mode 100644 index 9a533b645e..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationDiscovery.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model; - -import org.objectweb.asm.AnnotationVisitor; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 14:42 - */ -public interface AnnotationDiscovery { - AnnotationVisitor visitAnnotation(String desc); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java deleted file mode 100644 index 4fcbd73757..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/AnnotationType.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model; - -import java.util.ArrayList; -import java.util.List; - -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 27/06/13 - * Time: 13:37 - */ -public class AnnotationType { - private final Type type; - private final List m_playbacks = new ArrayList(); - - public AnnotationType(final Type type) { - this.type = type; - } - - public Type getType() { - return type; - } - - public List getPlaybacks() { - return m_playbacks; - } - - public void traverse(AnnotationDiscovery visitor) { - for (Playback playback : m_playbacks) { - playback.accept(visitor); - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java deleted file mode 100644 index 12802f013e..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/Playback.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; - -/** - * User: guillaume - * Date: 08/07/13 - * Time: 16:30 - */ -public interface Playback { - void accept(FieldVisitor visitor); - - void accept(ClassVisitor visitor); - - void accept(MethodVisitor visitor); - - void accept(MethodVisitor visitor, int index); - - void accept(AnnotationDiscovery visitor); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java deleted file mode 100644 index caea0b1c54..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/ChainedAnnotationDiscovery.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.discovery; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.apache.felix.ipojo.manipulator.util.ChainedAnnotationVisitor; -import org.objectweb.asm.AnnotationVisitor; - -/** - * User: guillaume - * Date: 10/07/13 - * Time: 10:48 - */ -public class ChainedAnnotationDiscovery implements AnnotationDiscovery { - - private List m_discoveries = new ArrayList(); - - public List getDiscoveries() { - return m_discoveries; - } - - public AnnotationVisitor visitAnnotation(final String desc) { - ChainedAnnotationVisitor chain = null; - for (AnnotationDiscovery discovery : m_discoveries) { - AnnotationVisitor visitor = discovery.visitAnnotation(desc); - if (visitor != null) { - if (chain == null) { - chain = new ChainedAnnotationVisitor(); - } - chain.getVisitors().add(visitor); - } - } - return chain; - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java deleted file mode 100644 index 36c4058909..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/HandlerBindingDiscovery.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.discovery; - -import org.apache.felix.ipojo.annotations.HandlerBinding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * The annotation visitor responsible for parsing the {@link org.apache.felix.ipojo.annotations.HandlerBinding} - * annotation. - */ -public class HandlerBindingDiscovery extends AnnotationVisitor implements AnnotationDiscovery { - - public static final String HANDLER_BINDING_DESCRIPTOR = Type.getType(HandlerBinding.class).getDescriptor(); - - private boolean m_handlerBinding = false; - private String m_value = null; - private String m_namespace = null; - - /** - * Constructs a new {@link org.objectweb.asm.AnnotationVisitor}. - */ - public HandlerBindingDiscovery() { - super(Opcodes.ASM9); - } - - public AnnotationVisitor visitAnnotation(final String desc) { - if (HANDLER_BINDING_DESCRIPTOR.equals(desc)) { - m_handlerBinding = true; - return this; - } - return null; - } - - @Override - public void visit(final String name, final Object value) { - if ("value".equals(name)) { - m_value = (String) value; - } - if ("namespace".equals(name)) { - m_namespace = (String) value; - } - } - - public boolean isHandlerBinding() { - return m_handlerBinding; - } - - public String getValue() { - return m_value; - } - - public String getNamespace() { - return m_namespace; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java deleted file mode 100644 index 71c7cc0b73..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/IgnoredDiscovery.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.discovery; - -import org.apache.felix.ipojo.annotations.Ignore; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 14:52 - */ -public class IgnoredDiscovery implements AnnotationDiscovery { - - public static final String IGNORE_DESCRIPTOR = Type.getType(Ignore.class).getDescriptor(); - - private boolean m_ignore = false; - - public AnnotationVisitor visitAnnotation(final String desc) { - if (IGNORE_DESCRIPTOR.equals(desc)) { - m_ignore = true; - } - return null; - } - - public boolean isIgnore() { - return m_ignore; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java deleted file mode 100644 index a8438dac49..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/discovery/StereotypeDiscovery.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.discovery; - -import org.apache.felix.ipojo.annotations.Stereotype; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 14:52 - */ -public class StereotypeDiscovery implements AnnotationDiscovery { - - public static final String STEREOTYPE_DESCRIPTOR = Type.getType(Stereotype.class).getDescriptor(); - - private boolean m_stereotype = false; - - public AnnotationVisitor visitAnnotation(final String desc) { - if (STEREOTYPE_DESCRIPTOR.equals(desc)) { - m_stereotype = true; - } - return null; - } - - public boolean isStereotype() { - return m_stereotype; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java deleted file mode 100644 index 3b7a529e44..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlayback.java +++ /dev/null @@ -1,264 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal; - -import static java.lang.String.format; -import static org.objectweb.asm.Type.getType; - -import java.io.Serializable; -import java.lang.annotation.Annotation; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 08/07/13 - * Time: 17:15 - */ -public class AnnotationPlayback implements Playback { - - public static final List> BOXED_TYPES = Arrays.asList(Byte.class, Long.class, Character.class, Boolean.class, Double.class, Float.class, Integer.class, Short.class); - private final Annotation m_annotation; - private final Type m_annotationType; - - public AnnotationPlayback(final Annotation annotation) { - m_annotation = annotation; - m_annotationType = Type.getType(annotation.annotationType()); - } - - private Map getValues() { - Map values = new HashMap(); - for (Method method : m_annotation.annotationType().getDeclaredMethods()) { - try { - values.put(method.getName(), method.invoke(m_annotation)); - } catch (Throwable t) { - throw new IllegalStateException( - format("Cannot get value of the %s.%s attribute", - m_annotation.annotationType().getSimpleName(), - method.getName()), - t - ); - } - } - return values; - } - public void accept(final FieldVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(), - true); - if (av != null) { - accept(av); - } - } - - public void accept(final ClassVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(), - true); - if (av != null) { - accept(av); - } - } - - public void accept(final MethodVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor(), - true); - if (av != null) { - accept(av); - } - } - - public void accept(final MethodVisitor visitor, final int index) { - AnnotationVisitor av = visitor.visitParameterAnnotation(index, - m_annotationType.getDescriptor(), - true); - if (av != null) { - accept(av); - } - } - - public void accept(final AnnotationDiscovery visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_annotationType.getDescriptor()); - if (av != null) { - accept(av); - } - } - - private void accept(final AnnotationVisitor visitor) { - // As per the ASM doc, visit methods must be called in a given order: - // 1. visit() - // 2. visitEnum() - // 3. visitAnnotation() - // 4. visitArray() - - // So values must be sorted - Map values = getValues(); - accept(values, visitor); - acceptEnum(values, visitor); - acceptAnnotation(values, visitor); - acceptArray(values, visitor); - - // Do not forget to visitEnd() - visitor.visitEnd(); - - // TODO This should disappear, only useful for testing - if (!values.isEmpty()) { - // We missed something during serialization - throw new IllegalStateException( - format("Attributes of @%s could not be serialized: %s", - m_annotation.annotationType().getSimpleName(), - values.keySet()) - ); - } - } - - private void acceptAnnotation(final Map values, final AnnotationVisitor visitor) { - Map copy = new HashMap(values); - for (Map.Entry entry : copy.entrySet()) { - - Class type = entry.getValue().getClass(); - if (Annotation.class.isAssignableFrom(type)) { - - Annotation annotation = (Annotation) entry.getValue(); - AnnotationVisitor annotationVisitor = visitor.visitAnnotation(entry.getKey(), - getType(annotation.annotationType()).getDescriptor()); - if (annotationVisitor != null) { - AnnotationPlayback playback = new AnnotationPlayback(annotation); - playback.accept(annotationVisitor); - } - - values.remove(entry.getKey()); - } - } - } - - private void acceptEnum(final Map values, final AnnotationVisitor visitor) { - - Map copy = new HashMap(values); - for (Map.Entry entry : copy.entrySet()) { - - Class type = entry.getValue().getClass(); - if (type.isEnum()) { - Enum enumValue = (Enum) entry.getValue(); - visitor.visitEnum(entry.getKey(), - getType(type).getDescriptor(), - enumValue.name()); - - values.remove(entry.getKey()); - } - } - } - - private void accept(final Map values, final AnnotationVisitor visitor) { - - Map copy = new HashMap(values); - for (Map.Entry entry : copy.entrySet()) { - - Class type = entry.getValue().getClass(); - if (isSimpleType(type)) { - - // Accept Byte, Boolean, Character, Short, Integer, Long, Float, Double - // Accept String - // Accept Array of byte, boolean, char, short, int, long, float, double - visitor.visit(entry.getKey(), transform(entry.getValue())); - - values.remove(entry.getKey()); - } - } - } - - private boolean isSimpleType(final Class type) { - return isPrimitive(type) || - String.class.equals(type) || - Class.class.equals(type) || - (type.isArray() && isPrimitive(type.getComponentType())); - } - - private boolean isPrimitive(final Class type) { - if (type.isPrimitive()) { - return true; - } - - if (BOXED_TYPES.contains(type)) { - return true; - } - - return false; - } - - private void acceptArray(final Map values, final AnnotationVisitor visitor) { - Map copy = new HashMap(values); - for (Map.Entry entry : copy.entrySet()) { - - Class type = entry.getValue().getClass(); - if (type.isArray()) { - - // Simple arrays have been visited using AnnotationVisitor.visit(String, Object) - - AnnotationVisitor arrayVisitor = visitor.visitArray(entry.getKey()); - if (arrayVisitor != null) { - Object[] array = (Object[]) entry.getValue(); - Class componentType = array.getClass().getComponentType(); - Type asmType = Type.getType(componentType); - - if (componentType.isEnum()) { - for (Object o : array) { - Enum eValue = (Enum) o; - arrayVisitor.visitEnum(null, asmType.getDescriptor(), eValue.name()); - } - } else if (componentType.isAnnotation()) { - for (Object o : array) { - Annotation annotation = (Annotation) o; - AnnotationVisitor annotationVisitor = arrayVisitor.visitAnnotation(null, asmType.getDescriptor()); - if (annotationVisitor != null) { - AnnotationPlayback playback = new AnnotationPlayback(annotation); - playback.accept(annotationVisitor); - } - } - } else { - for (Object o : array) { - arrayVisitor.visit(null, transform(o)); - } - } - - arrayVisitor.visitEnd(); - } - - values.remove(entry.getKey()); - } - } - } - - private Object transform(final Object value) { - if (value instanceof Class) { - return getType((Class) value); - } - return value; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java deleted file mode 100644 index fdb000dbc6..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationParser.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.objectweb.asm.ClassReader; - -/** - * User: guillaume - * Date: 01/07/13 - * Time: 15:49 - */ -public class AnnotationParser { - public AnnotationType read(byte[] resource) { - ClassReader reader = new ClassReader(resource); - AnnotationTypeVisitor visitor = new AnnotationTypeVisitor(); - reader.accept(visitor, ClassReader.SKIP_CODE); - return visitor.getAnnotationType(); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java deleted file mode 100644 index 4d0fe580cc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/AnnotationTypeVisitor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.replay.AnnotationVisitorPlayback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * - */ -public class AnnotationTypeVisitor extends ClassVisitor { - - private AnnotationType annotationType; - - public AnnotationTypeVisitor() { - super(Opcodes.ASM9); - } - - @Override - public void visit(final int version, final int access, final String name, final String signature, final String superName, final String[] interfaces) { - annotationType = new AnnotationType(Type.getObjectType(name)); - } - - @Override - public AnnotationVisitor visitAnnotation(final String desc, final boolean visible) { - // Build annotations of this annotation type - AnnotationVisitorPlayback playback = new AnnotationVisitorPlayback(desc, visible); - annotationType.getPlaybacks().add(playback); - return playback; - } - - public AnnotationType getAnnotationType() { - return annotationType; - } - - // Note: if we override visitMethod here, we could get the annotation's default values. -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java deleted file mode 100644 index c5b95746f4..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorder.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -import java.util.ArrayList; -import java.util.List; - -/** - * Record annotation to be replayed later. - */ -public class AnnotationRecorder extends AnnotationVisitor implements Replay { - - private List m_replays = new ArrayList(); - - public AnnotationRecorder() { - super(Opcodes.ASM9); - } - - public void visit(final String name, final Object value) { - m_replays.add(new Visit(name, value)); - } - - public void visitEnum(final String name, final String desc, final String value) { - m_replays.add(new VisitEnum(name, desc, value)); - } - - public AnnotationVisitor visitAnnotation(final String name, final String desc) { - AnnotationRecorder sub = new AnnotationRecorder(); - m_replays.add(new VisitAnnotation(name, desc, sub)); - return sub; - } - - public AnnotationVisitor visitArray(final String name) { - AnnotationRecorder sub = new AnnotationRecorder(); - m_replays.add(new VisitArray(name, sub)); - return sub; - } - - public void visitEnd() { - m_replays.add(new VisitEnd()); - } - - public void accept(final AnnotationVisitor visitor) { - for (Replay replay : m_replays) { - replay.accept(visitor); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java deleted file mode 100644 index 95dd6ebb70..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationVisitorPlayback.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; - -/** - * User: guillaume - * Date: 08/07/13 - * Time: 16:07 - */ -public class AnnotationVisitorPlayback extends AnnotationRecorder implements Playback { - private final String m_desc; - private final boolean m_visible; - - public AnnotationVisitorPlayback(final String desc, final boolean visible) { - m_desc = desc; - m_visible = visible; - } - - public void accept(final FieldVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible); - if (av != null) { - accept(av); - } - } - - public void accept(final ClassVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible); - if (av != null) { - accept(av); - } - } - - public void accept(final MethodVisitor visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_desc, m_visible); - if (av != null) { - accept(av); - } - } - - public void accept(final MethodVisitor visitor, int index) { - AnnotationVisitor av = visitor.visitParameterAnnotation(index, m_desc, m_visible); - if (av != null) { - accept(av); - } - } - - public void accept(final AnnotationDiscovery visitor) { - AnnotationVisitor av = visitor.visitAnnotation(m_desc); - if (av != null) { - accept(av); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java deleted file mode 100644 index 1597936874..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Replay.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:23 -*/ -public interface Replay { - void accept(AnnotationVisitor visitor); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java deleted file mode 100644 index 4c3eff22d7..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/Visit.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:23 -*/ -public class Visit implements Replay { - private final String m_name; - private final Object m_value; - - public Visit(final String name, final Object value) { - m_name = name; - m_value = value; - } - - public void accept(AnnotationVisitor visitor) { - visitor.visit(m_name, m_value); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitAnnotation.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitAnnotation.java deleted file mode 100644 index 59a30e5184..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitAnnotation.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:24 -*/ -public class VisitAnnotation implements Replay { - private final String m_name; - private final String m_desc; - private final AnnotationRecorder m_sub; - - public VisitAnnotation(final String name, final String desc, final AnnotationRecorder sub) { - m_name = name; - m_desc = desc; - m_sub = sub; - } - - public void accept(final AnnotationVisitor visitor) { - AnnotationVisitor child = visitor.visitAnnotation(m_name, m_desc); - if (child != null) { - m_sub.accept(child); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitArray.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitArray.java deleted file mode 100644 index 5a4149ee5a..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitArray.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:24 -*/ -public class VisitArray implements Replay { - private final String m_name; - private final AnnotationRecorder m_sub; - - public VisitArray(final String name, final AnnotationRecorder sub) { - m_name = name; - m_sub = sub; - } - - public void accept(final AnnotationVisitor visitor) { - AnnotationVisitor child = visitor.visitArray(m_name); - if (child != null) { - m_sub.accept(child); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnd.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnd.java deleted file mode 100644 index 2bdebd5f45..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnd.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:24 -*/ -public class VisitEnd implements Replay { - - public void accept(final AnnotationVisitor visitor) { - visitor.visitEnd(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnum.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnum.java deleted file mode 100644 index ce044d248d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/VisitEnum.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 30/05/13 -* Time: 17:23 -*/ -public class VisitEnum implements Replay { - private final String m_name; - private final String m_desc; - private final String m_value; - - public VisitEnum(final String name, final String desc, final String value) {m_name = name; - m_desc = desc; - m_value = value; - } - - public void accept(final AnnotationVisitor visitor) { - visitor.visitEnum(m_name, m_desc, m_value); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java deleted file mode 100644 index caa45f4fed..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/module/DefaultBindingModule.java +++ /dev/null @@ -1,290 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.module; - -import org.apache.felix.ipojo.annotations.*; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.*; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.Action; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.MethodBindVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.bind.ParameterBindVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names; -import org.apache.felix.ipojo.manipulator.spi.AbsBindingModule; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.tree.MethodNode; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import java.lang.annotation.ElementType; - -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.on; - -/** - * @author Felix Project Team - */ -public class DefaultBindingModule extends AbsBindingModule { - - /** - * Configure all the iPOJO's default annotation's bindings. - */ - public void configure() { - - // Class level annotations - // -------------------------------- - bind(Component.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new ComponentVisitor(context.getWorkbench(), context.getReporter()); - } - }); - - bind(Handler.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new HandlerVisitor(context.getWorkbench(), context.getReporter()); - } - }); - - bind(Provides.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new ProvidesVisitor(context.getWorkbench()); - } - }); - - - bind(HandlerDeclaration.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - Reporter reporter = context.getReporter(); - return new HandlerDeclarationVisitor(context.getWorkbench(), getFreshDocumentBuilder(reporter), reporter); - } - }); - - bind(Instantiate.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new InstantiateVisitor(context.getWorkbench()); - } - }); - - // Field level annotations - // -------------------------------- - bind(Requires.class) - .when(on(ElementType.FIELD)) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new RequiresVisitor(context.getWorkbench(), context.getFieldNode().name); - } - }) - .when(on(ElementType.PARAMETER)) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new ParameterBindVisitor(context.getWorkbench(), Action.BIND, context.getParameterIndex()); - } - }); - - bind(Controller.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - return new ControllerVisitor(context.getWorkbench(), context.getFieldNode().name); - } - }); - - bind(ServiceProperty.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - String name = context.getFieldNode().name; - ComponentWorkbench workbench = context.getWorkbench(); - - if (!workbench.getIds().containsKey("provides")) { - // The provides annotation is already computed. - context.getReporter().warn("The component does not provide services, skip ServiceProperty for {}", name); - return null; - } else { - // Get the provides element - Element provides = workbench.getIds().get("provides"); - return new FieldPropertyVisitor(name, provides); - } - - } - }); - - bind(ServiceController.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - String name = context.getFieldNode().name; - ComponentWorkbench workbench = context.getWorkbench(); - - if (!workbench.getIds().containsKey("provides")) { // The provides annotation is already computed. - context.getReporter().warn("The component does not provide services, skip @ServiceController for {}", name); - return null; - } else { - // Get the provides element - Element provides = workbench.getIds().get("provides"); - return new ServiceControllerVisitor(name, provides); - } - - } - }); - - bind(Property.class) - .when(on(ElementType.FIELD)) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - - ComponentWorkbench workbench = context.getWorkbench(); - Element properties = Elements.getPropertiesElement(workbench); - String name = context.getFieldNode().name; - return new FieldPropertyVisitor(name, properties); - } - - }) - .when(on(ElementType.METHOD)) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - - ComponentWorkbench workbench = context.getWorkbench(); - // @Property on method parameter - Element properties = Elements.getPropertiesElement(workbench); - String name = context.getMethodNode().name; - return new MethodPropertyVisitor(properties, name); - } - }) - .when(on(ElementType.PARAMETER)) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - - ComponentWorkbench workbench = context.getWorkbench(); - // @Property on method parameter - Element properties = Elements.getPropertiesElement(workbench); - MethodNode method = context.getMethodNode(); - return new ParameterPropertyVisitor(properties, method, context.getParameterIndex()); - } - }); - - bind(Validate.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new LifecycleVisitor(context.getWorkbench(), - Names.computeEffectiveMethodName(node.name), - LifecycleVisitor.Transition.VALIDATE); - } - }); - - bind(Invalidate.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new LifecycleVisitor(context.getWorkbench(), - Names.computeEffectiveMethodName(node.name), - LifecycleVisitor.Transition.INVALIDATE); - } - }); - - bind(Updated.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new UpdatedVisitor(context.getWorkbench(), - Names.computeEffectiveMethodName(node.name)); - } - }); - - bind(Bind.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new MethodBindVisitor(context.getWorkbench(), Action.BIND, node, context.getReporter()); - } - }); - - bind(Unbind.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new MethodBindVisitor(context.getWorkbench(), Action.UNBIND, node, context.getReporter()); - } - }); - - bind(Modified.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new MethodBindVisitor(context.getWorkbench(), Action.MODIFIED, node, context.getReporter()); - } - }); - - bind(PostRegistration.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new PostRegistrationVisitor(context.getWorkbench(), node.name); - } - }); - - bind(PostUnregistration.class) - .to(new AnnotationVisitorFactory() { - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - MethodNode node = context.getMethodNode(); - return new PostUnregistrationVisitor(context.getWorkbench(), node.name); - } - }); - - bind(Context.class).to(new GenericVisitorFactory("context", "")); - } - - private DocumentBuilder m_builder; - - - /** - * Creates a 'fresh' document builder. - * @return a new document builder is not already created, else reset - * the created one, and return it. - */ - protected DocumentBuilder getFreshDocumentBuilder(Reporter reporter) { - if (m_builder == null) { - - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - try { - m_builder = factory.newDocumentBuilder(); - } catch (ParserConfigurationException e) { - // TODO GSA is this acceptable to throw a RuntimeException here ? - reporter.warn("Cannot get a fresh DocumentBuilder", e); - } - - return m_builder; - } - - // The builder has to be reset - m_builder.reset(); - - return m_builder; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Binding.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Binding.java deleted file mode 100644 index fc6a963b4d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Binding.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static java.lang.String.format; - -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.Predicate; -import org.objectweb.asm.Type; - -import java.lang.annotation.Annotation; - -/** - * Triple storing the source annotation, the associated factory and the predicate for conditional support. - * @author Felix Project Team - */ -public class Binding { - private Type annotationType; - private AnnotationVisitorFactory factory; - private Predicate predicate; - - public Type getAnnotationType() { - return annotationType; - } - - public void setAnnotationType(Type annotationType) { - this.annotationType = annotationType; - } - - public AnnotationVisitorFactory getFactory() { - return factory; - } - - public void setFactory(AnnotationVisitorFactory factory) { - this.factory = factory; - } - - public Predicate getPredicate() { - return predicate; - } - - public void setPredicate(Predicate predicate) { - this.predicate = predicate; - } - - @Override - public String toString() { - return format("Binding[@%s->%s]", annotationType.getClassName(), factory); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistry.java deleted file mode 100644 index 0c80ce7962..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/BindingRegistry.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import java.util.List; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 16:12 - */ -public interface BindingRegistry { - void addBindings(Iterable bindings); - - Selection selection(ComponentWorkbench workbench); - - /** - * Find the list of {@link Binding} registered with the given annotation type. - * This method returns an empty List if no bindings are registered. - * @param descriptor denotes the annotation's type - * @return the list of {@link Binding} registered with the given descriptor, the list may be empty if no bindings are found. - */ - List getBindings(String descriptor); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistry.java deleted file mode 100644 index 398db41f20..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistry.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import java.util.List; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 16:09 - */ -public abstract class CompletableBindingRegistry implements BindingRegistry { - private final BindingRegistry m_delegate; - private final Reporter m_reporter; - - public CompletableBindingRegistry(final BindingRegistry delegate, final Reporter reporter) { - m_delegate = delegate; - m_reporter = reporter; - } - - public List getBindings(final String descriptor) { - List bindings = m_delegate.getBindings(descriptor); - if (bindings.isEmpty()) { - List ignored = createBindings(Type.getType(descriptor)); - m_delegate.addBindings(ignored); - return ignored; - } - return bindings; - } - - protected abstract List createBindings(final Type type); - - public void addBindings(final Iterable bindings) { - m_delegate.addBindings(bindings); - } - - public Selection selection(final ComponentWorkbench workbench) { - return new Selection(this, workbench, m_reporter); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistry.java deleted file mode 100644 index f76ec6a354..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistry.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static java.util.Collections.emptyList; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.objectweb.asm.Type; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -/** - * Stores all the {@link Binding}s coming from the {@link org.apache.felix.ipojo.manipulator.spi.Module}. - * @author Felix Project Team - */ -public class DefaultBindingRegistry implements BindingRegistry { - private final Map> tree = new HashMap>(); - protected final Reporter reporter; - - public DefaultBindingRegistry(Reporter reporter) { - this.reporter = reporter; - } - - /** - * Stores the given Bindings - */ - public void addBindings(Iterable bindings) { - for (Binding binding : bindings) { - Type type = binding.getAnnotationType(); - - List potential = tree.get(type.getDescriptor()); - if (potential == null) { - // Annotation is not already found in supported list - potential = new ArrayList(); - tree.put(type.getDescriptor(), potential); - } - - //reporter.trace("Registered @%s", type.getClassName()); - potential.add(binding); - } - } - - /** - * Initiate a {@link Selection} for the given workbench. - */ - public Selection selection(ComponentWorkbench workbench) { - return new Selection(this, workbench, reporter); - } - - public List getBindings(String descriptor) { - List bindings = tree.get(descriptor); - if (bindings == null) { - bindings = emptyList(); - } - return bindings; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistry.java deleted file mode 100644 index ca84dcb017..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistry.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static java.util.Collections.singletonList; - -import java.util.List; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 16:09 - */ -public class IgnoreAllBindingRegistry extends CompletableBindingRegistry { - - public IgnoreAllBindingRegistry(final BindingRegistry delegate, final Reporter reporter) { - super(delegate, reporter); - } - - @Override - protected List createBindings(final Type type) { - return singletonList((Binding) new NullBinding(type)); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java deleted file mode 100644 index 0c7d59e547..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistry.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.FieldGenericVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.MethodGenericVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.ParameterGenericVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.TypeGenericVisitor; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; - -import java.util.List; -import java.util.regex.Pattern; - -import static java.util.Collections.emptyList; -import static java.util.Collections.singletonList; -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.alwaysTrue; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 16:09 - */ -public class LegacyGenericBindingRegistry extends CompletableBindingRegistry { - public static final Pattern CUSTOM_HANDLER_PATTERN = Pattern.compile("(.*\\.ipojo\\..*)|(.*\\.handler\\..*)"); - - public LegacyGenericBindingRegistry(final BindingRegistry delegate, final Reporter reporter) { - super(delegate, reporter); - } - - @Override - protected List createBindings(final Type type) { - if (CUSTOM_HANDLER_PATTERN.matcher(type.getClassName()).matches()) { - Binding binding = new Binding(); - binding.setAnnotationType(type); - binding.setPredicate(alwaysTrue()); - binding.setFactory(new AnnotationVisitorFactory() { - // Need to build a new Element instance for each created visitor - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - if (context.getClassNode() != null) { - return new TypeGenericVisitor(context.getWorkbench(), - Elements.buildElement(type)); - } else if (context.getFieldNode() != null) { - return new FieldGenericVisitor(context.getWorkbench(), - Elements.buildElement(type), - context.getFieldNode()); - - } else if ((context.getMethodNode() != null) && - (context.getParameterIndex() == BindingContext.NO_INDEX)) { - return new MethodGenericVisitor(context.getWorkbench(), - Elements.buildElement(type), - context.getMethodNode()); - } else { - // last case: method parameter annotation - return new ParameterGenericVisitor(context.getWorkbench(), - Elements.buildElement(type), - context.getMethodNode(), - context.getParameterIndex()); - } - } - - @Override - public String toString() { - return "LegacyGenericVisitorFactory"; - } - }); - - // Return the produced generic binding - return singletonList(binding); - } - - return emptyList(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java deleted file mode 100644 index 43e1c522f7..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistry.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static java.util.Collections.emptyList; -import static java.util.Collections.unmodifiableList; -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.alwaysTrue; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.annotations.HandlerBinding; -import org.apache.felix.ipojo.annotations.Ignore; -import org.apache.felix.ipojo.annotations.Stereotype; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery.ChainedAnnotationDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery.HandlerBindingDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery.IgnoredDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.discovery.StereotypeDiscovery; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.parser.AnnotationParser; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.stereotype.StereotypeVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; - -/** - * The {@link MetaAnnotationBindingRegistry} is a registry that tries to complete its list - * of bindings when an unknown one is detected. - * It uses the given {@link ResourceStore} to parse the annotation's type and find if - * it's annotated with @{@link org.apache.felix.ipojo.annotations.Stereotype}, - * @{@link org.apache.felix.ipojo.annotations.HandlerBinding} or @{@link org.apache.felix.ipojo.annotations.Ignore} - */ -public class MetaAnnotationBindingRegistry extends CompletableBindingRegistry { - - private ResourceStore m_store; - private Reporter m_reporter; - - public MetaAnnotationBindingRegistry(final BindingRegistry delegate, final Reporter reporter, final ResourceStore store) { - super(delegate, reporter); - this.m_reporter = reporter; - this.m_store = store; - addBindings(nullBindingsForMetaAnnotations()); - } - - protected Iterable nullBindingsForMetaAnnotations() { - // Do not re-apply meta-annotations - ArrayList bindings = new ArrayList(); - bindings.add(new NullBinding(Type.getType(Stereotype.class))); - bindings.add(new NullBinding(Type.getType(HandlerBinding.class))); - bindings.add(new NullBinding(Type.getType(Ignore.class))); - return bindings; - } - - @Override - protected List createBindings(final Type type) { - - // Parse the annotation - byte[] bytes; - try { - bytes = m_store.read(type.getInternalName().concat(".class")); - } catch (IOException e) { - // Annotation type cannot be read - m_reporter.trace("Could not read bytecode for @%s.", type.getClassName()); - return emptyList(); - } catch (IllegalStateException e) { - m_reporter.trace("Could not read bytecode for @%s because the bundle is not in a state allowing read " + - "operations.", - type.getClassName()); - return emptyList(); - } - AnnotationParser parser = new AnnotationParser(); - AnnotationType annotationType = parser.read(bytes); - - // Search meta-annotations - ChainedAnnotationDiscovery chain = new ChainedAnnotationDiscovery(); - StereotypeDiscovery stereotypeDiscovery = new StereotypeDiscovery(); - HandlerBindingDiscovery handlerBindingDiscovery = new HandlerBindingDiscovery(); - IgnoredDiscovery ignoredDiscovery = new IgnoredDiscovery(); - chain.getDiscoveries().add(stereotypeDiscovery); - chain.getDiscoveries().add(handlerBindingDiscovery); - chain.getDiscoveries().add(ignoredDiscovery); - - annotationType.traverse(chain); - - // Produced Bindings - List bindings = new ArrayList(); - - // @Stereotype support - if (stereotypeDiscovery.isStereotype()) { - m_reporter.trace("@Stereotype detected: @%s", type.getClassName()); - Binding binding = new Binding(); - binding.setAnnotationType(type); - binding.setPredicate(alwaysTrue()); - binding.setFactory(new StereotypeVisitorFactory(annotationType)); - - bindings.add(binding); - } - - // @HandlerBinding support - if (handlerBindingDiscovery.isHandlerBinding()) { - - m_reporter.trace("@HandlerBinding detected: @%s", type.getClassName()); - Binding binding = new Binding(); - binding.setAnnotationType(type); - binding.setPredicate(alwaysTrue()); - final Element element = buildElement(handlerBindingDiscovery, type); - binding.setFactory(new GenericVisitorFactory(element.getName(), element.getNameSpace())); - - bindings.add(binding); - } - - // Its IMPORTANT that the @Ignore is processed last since it removes existing bindings - if (ignoredDiscovery.isIgnore()) { - m_reporter.trace("@Ignore detected: @%s", type.getClassName()); - Binding binding = new NullBinding(type); - - bindings.clear(); - bindings.add(binding); - bindings = unmodifiableList(bindings); // just in case of ... - } - - return bindings; - - } - - private Element buildElement(final HandlerBindingDiscovery handler, final Type type) { - Element element; - if ((handler.getNamespace() == null) && - (handler.getValue() == null)) { - // No attributes specified, use annotation type as element's source - element = Elements.buildElement(type); - } else if ((handler.getNamespace() == null)) { - // Namespace attribute is omitted - element = Elements.buildElement(handler.getValue()); - } else { - element = Elements.buildElement(handler.getNamespace(), - handler.getValue()); - } - return element; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java deleted file mode 100644 index 721e1e992e..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/Selection.java +++ /dev/null @@ -1,150 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.apache.felix.ipojo.manipulator.util.ChainedAnnotationVisitor; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import java.lang.annotation.ElementType; -import java.util.ArrayList; -import java.util.List; - -/** - * A {@link Selection} is used to select a subset of all supported {@link AnnotationVisitor}. - * It's a query DSL. - * @author Felix Project Team - */ -public class Selection { - - private BindingRegistry registry; - private ComponentWorkbench workbench; - private Reporter reporter; - private FieldNode field; - private MethodNode method; - private ClassNode clazz; - private int index = BindingContext.NO_INDEX; - private String annotation; - private ElementType elementType = null; - private Object visitor; - - public Selection(BindingRegistry registry, ComponentWorkbench workbench, Reporter reporter) { - this.registry = registry; - this.workbench = workbench; - this.reporter = reporter; - } - - public Selection field(FieldVisitor visitor, FieldNode node) { - this.visitor = visitor; - this.field = node; - this.elementType = ElementType.FIELD; - return this; - } - - public Selection method(MethodVisitor visitor, MethodNode node) { - this.visitor = visitor; - this.method = node; - this.elementType = ElementType.METHOD; - return this; - } - - public Selection type(ClassVisitor visitor, ClassNode node) { - this.visitor = visitor; - this.clazz = node; - this.elementType = ElementType.TYPE; - return this; - } - - public Selection parameter(MethodVisitor visitor, MethodNode node, int index) { - this.visitor = visitor; - this.index = index; - this.method = node; - this.elementType = ElementType.PARAMETER; - return this; - } - - public Selection annotatedWith(String desc) { - this.annotation = desc; - return this; - } - - public AnnotationVisitor get() { - List visitors = list(); - - if (visitors.isEmpty()) { - return null; - } - - if (visitors.size() == 1) { - return visitors.get(0); - } - - ChainedAnnotationVisitor chained = new ChainedAnnotationVisitor(); - chained.getVisitors().addAll(visitors); - return chained; - } - - private List list() { - BindingContext context; - - if (elementType == ElementType.FIELD) { - context = new BindingContext(workbench, reporter, Type.getType(annotation), field, - elementType, index, visitor); - } else if (elementType == ElementType.TYPE) { - context = new BindingContext(workbench, reporter, Type.getType(annotation), clazz, - elementType, index, visitor); - } else { - // Parameter of method. - context = new BindingContext(workbench, reporter, Type.getType(annotation), method, - elementType, index, visitor); - } - - - List predicates = registry.getBindings(annotation); - - List visitors = new ArrayList(); - if (predicates != null && !predicates.isEmpty()) { - collectMatchingVisitors(predicates, context, visitors); - } - return visitors; - } - - - private void collectMatchingVisitors(List bindings, BindingContext context, List visitors) { - for (Binding binding : bindings) { - if (binding.getPredicate().matches(context)) { - AnnotationVisitor visitor = binding.getFactory().newAnnotationVisitor(context); - if (visitor != null) { - visitors.add(visitor); - } - } - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java deleted file mode 100644 index 2cc8c358cf..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitor.java +++ /dev/null @@ -1,139 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parse the @Component annotation. - * @see org.apache.felix.ipojo.annotations.Component - * @author Felix Project Team - */ -public class ComponentVisitor extends AnnotationVisitor { - - private Reporter reporter; - - /** - * Element 'properties'. - */ - private Element m_props = new Element("properties", ""); - - private Element component = new Element("component", ""); - - private ComponentWorkbench workbench; - - public ComponentVisitor(ComponentWorkbench workbench, Reporter reporter) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.reporter = reporter; - } - - /** - * Visit @Component annotation attribute. - * @param name attribute name - * @param value attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("public_factory") || name.equals("publicFactory")) { - // public_factory is deprecated, but must sill be supported - String factory = value.toString(); - if (factory.equalsIgnoreCase("false")) { - component.addAttribute(new Attribute("public", "false")); - } else { - component.addAttribute(new Attribute("public", "true")); - } - return; - } - - if (name.equals("name")) { - component.addAttribute(new Attribute("name", value.toString())); - return; - } - if (name.equals("immediate")) { - component.addAttribute(new Attribute("immediate", value.toString())); - return; - } - if (name.equals("architecture")) { - component.addAttribute(new Attribute("architecture", value.toString())); - return; - } - if (name.equals("propagation") && (value != null)) { - if (arePropertiesEmpty()) { - initComponentProperties(); - } - m_props.addAttribute(new Attribute("propagation", value.toString())); - return; - } - if (name.equals("managedservice") && (value != null)) { - if (arePropertiesEmpty()) { - initComponentProperties(); - } - m_props.addAttribute(new Attribute("pid", value.toString())); - return; - } - if ((name.equals("factory_method") || name.equals("factoryMethod")) && (value != null)) { - // factory_method is deprecated, but must still be supported. - component.addAttribute(new Attribute("factory-method", value.toString())); - return; - } - if (name.equals("version") && (value != null)) { - component.addAttribute(new Attribute("version", value.toString())); - } - } - - private boolean arePropertiesEmpty() { - return m_props.getElements().length == 0; - } - - private void initComponentProperties() { - workbench.getElements().put(m_props, null); - workbench.getIds().put("properties", m_props); - } - - /** - * End of the visit. - * Append to the "component" element computed attribute. - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - - String classname = workbench.getType().getClassName(); - - if (component.getAttribute("name") == null) { - component.addAttribute(new Attribute("name", classname)); - } - - component.addAttribute(new Attribute("classname", classname)); - - if (workbench.getRoot() == null) { - workbench.setRoot(component); - } else { - // Error case: 2 component type's annotations (@Component and @Handler for example) on the same class - reporter.error("Multiple 'component type' annotations on the class '{%s}'.", classname); - reporter.warn("@Component will be ignored."); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java deleted file mode 100644 index 5f2cd814aa..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ControllerVisitor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parses the @Controller annotation. - * @see org.apache.felix.ipojo.annotations.Controller - * @author Felix Project Team - */ -public class ControllerVisitor extends AnnotationVisitor { - - private ComponentWorkbench workbench; - - private String field; - - public ControllerVisitor(ComponentWorkbench workbench, String field) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.field = field; - } - - /** - * Visit @Handler annotation attributes. - * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object) - */ - public void visitEnd() { - Element controller = new Element("controller", ""); - controller.addAttribute(new Attribute("field", field)); - workbench.getElements().put(controller, null); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java deleted file mode 100644 index 6a8035e707..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/FieldPropertyVisitor.java +++ /dev/null @@ -1,164 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parses a Property or ServiceProperty annotation. - * @see org.apache.felix.ipojo.annotations.ServiceProperty - * @see org.apache.felix.ipojo.annotations.Property - * @author Felix Project Team - */ -public class FieldPropertyVisitor extends AnnotationVisitor { - - /** - * Parent element element. - */ - private Element m_parent; - - /** - * Field name. - */ - private String m_field; - - /** - * Property name. - */ - private String m_name; - - /** - * Property value. - */ - private String m_value; - - /** - * Property mandatory aspect. - */ - private String m_mandatory; - - /** - * Property type. - */ - private String m_type; - - /** - * Property immutable aspect. - */ - private String m_immutable; - - - /** - * Constructor without field - * @param parent : element element.. - */ - public FieldPropertyVisitor(Element parent) { - this(null, parent); - } - - /** - * Constructor. - * @param parent : element element. - * @param field : field name. - */ - public FieldPropertyVisitor(String field, Element parent) { - super(Opcodes.ASM9); - m_parent = parent; - m_field = field; - } - - /** - * Visit one "simple" annotation. - * @param name : annotation name - * @param value : annotation value - * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object) - */ - public void visit(String name, Object value) { - if (name.equals("name")) { - m_name = value.toString(); - return; - } - if (name.equals("value")) { - m_value = value.toString(); - return; - } - if (name.equals("mandatory")) { - m_mandatory = value.toString(); - return; - } - if (name.equals("immutable")) { - m_immutable = value.toString(); - return; - } - if (name.equals("type")) { - m_type = value.toString(); - } - } - - /** - * End of the annotation. - * Create a "property" element - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - if (m_field != null && m_name == null) { - m_name = m_field; - } - - - Element[] props = m_parent.getElements("property"); - Element prop = null; - for (int i = 0; prop == null && props != null && i < props.length; i++) { - String name = props[i].getAttribute("name"); - if (name != null && name.equals(m_name)) { - prop = props[i]; - } - } - - if (prop == null) { - prop = new Element("property", ""); - m_parent.addElement(prop); - if (m_name != null) { - prop.addAttribute(new Attribute("name", m_name)); - } - } - - if (m_field != null) { - prop.addAttribute(new Attribute("field", m_field)); - } - if (m_type != null) { - prop.addAttribute(new Attribute("type", m_type)); - } - - if (m_value != null) { - prop.addAttribute(new Attribute("value", m_value)); - } - if (m_mandatory != null) { - prop.addAttribute(new Attribute("mandatory", m_mandatory)); - } - if (m_immutable != null) { - prop.addAttribute(new Attribute("immutable", m_immutable)); - } - - } -} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java deleted file mode 100644 index 2b864943f3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitor.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.w3c.dom.Attr; -import org.w3c.dom.Document; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.NodeList; - -import javax.xml.parsers.DocumentBuilder; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; - -/** - * Parse the @HandlerDeclaration annotation. - * @see org.apache.felix.ipojo.annotations.HandlerDeclaration - * @author Felix Project Team - */ -public class HandlerDeclarationVisitor extends AnnotationVisitor { - - /** - * XML accepted by the handler. - */ - private String m_value; - - private DocumentBuilder builder; - - private ComponentWorkbench workbench; - private Reporter reporter; - - public HandlerDeclarationVisitor(ComponentWorkbench workbench, DocumentBuilder builder, Reporter reporter) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.builder = builder; - this.reporter = reporter; - } - - /** - * Parses the value attribute. - * @param name 'value' - * @param value the value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - // there is only a 'value' attribute - this.m_value = (String) value; - } - - /** - * End of the visit. - * Builds the XML document. - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - // The value is an XML document - InputStream is = new ByteArrayInputStream(m_value.getBytes()); - Document document = null; - try { - document = builder.parse(is); - Element e = convertDOMElements(document.getDocumentElement()); - workbench.getElements().put(e, null); - } catch (Exception e) { - reporter.warn("Cannot convert {} to iPOJO Elements.", m_value, e); - } finally { - try { - is.close(); - } catch (IOException e) { - reporter.trace("Cannot close correctly the value input stream ({}).", m_value, e); - } - } - } - - /** - * Converts recursively the given XML Element into an iPOJO Element. - * @param xmlElement DOM Element to be converted - */ - private static Element convertDOMElements(final org.w3c.dom.Element xmlElement) { - - // Create an equivalent iPOJO element - Element converted = transformElement(xmlElement); - - convertDOMElements(converted, xmlElement); - - return converted; - } - - /** - * Converts recursively the given XML Element into an iPOJO Element. - * @param root iPOJO root Element - * @param xmlElement DOM Element to be converted - */ - private static void convertDOMElements(final Element root, - final org.w3c.dom.Element xmlElement) { - - // Convert attributes if any - if (xmlElement.hasAttributes()) { - NamedNodeMap attributes = xmlElement.getAttributes(); - for (int i = 0; i < attributes.getLength(); i++) { - Attr attr = (Attr) attributes.item(i); - if (!"xmlns".equals(attr.getPrefix())) { - root.addAttribute(transformAttribute(attr)); - } - } - } - - // Convert child elements if any - if (xmlElement.hasChildNodes()) { - NodeList children = xmlElement.getChildNodes(); - for (int i = 0; i < children.getLength(); i++) { - - // Create an equivalent iPOJO element - org.w3c.dom.Element child = (org.w3c.dom.Element) children.item(i); - Element converted = transformElement(child); - - // Add converted element as a root's child - root.addElement(converted); - - // Recursive call - convertDOMElements(converted, child); - } - } - - } - - private static Attribute transformAttribute(Attr attr) { - return new Attribute(attr.getLocalName(), - attr.getNamespaceURI(), - attr.getValue()); - } - - private static Element transformElement(org.w3c.dom.Element xmlElement) { - return new Element(xmlElement.getLocalName(), xmlElement.getNamespaceURI()); - } - -} - diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java deleted file mode 100644 index a41d6e93d9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerVisitor.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parses the @Handler annotation. - * - * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Handler - */ -public class HandlerVisitor extends AnnotationVisitor { - - private Element handler = new Element("handler", ""); - - private ComponentWorkbench workbench; - - private Reporter reporter; - - public HandlerVisitor(ComponentWorkbench workbench, Reporter reporter) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.reporter = reporter; - } - - /** - * Visit @Handler annotation attributes. - * - * @param name : annotation attribute name - * @param value : annotation attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("name")) { - handler.addAttribute(new Attribute("name", value.toString())); - return; - } - if (name.equals("namespace")) { - handler.addAttribute(new Attribute("namespace", value.toString())); - return; - } - if (name.equals("level")) { - handler.addAttribute(new Attribute("level", value.toString())); - return; - } - if (name.equals("architecture")) { - handler.addAttribute(new Attribute("architecture", value.toString())); - } - } - - - /** - * End of the visit. - * Append to the "component" element computed attribute. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - - String classname = workbench.getType().getClassName(); - handler.addAttribute(new Attribute("classname", classname)); - - if (workbench.getRoot() == null) { - workbench.setRoot(handler); - } else { - // Error case: 2 component type's annotations (@Component and @Handler for example) on the same class - reporter.error("Multiple 'component type' annotations on the class '{%s}'.", classname); - reporter.warn("@Handler will be ignored."); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java deleted file mode 100644 index d0445858cc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/InstantiateVisitor.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parse the @Instantitate annotation. - * - * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Instantiate - */ -public class InstantiateVisitor extends AnnotationVisitor { - - private Element instance = new Element("instance", ""); - - private ComponentWorkbench workbench; - - public InstantiateVisitor(ComponentWorkbench workbench) { - super(Opcodes.ASM9); - this.workbench = workbench; - } - - /** - * Visit an annotation attribute. - * - * @param name the attribute name - * @param value the attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("name")) { - instance.addAttribute(new Attribute("name", (String) value)); - } - } - - /** - * End of the visit. Creates the instance element. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - // We set the instance's component attribute to the class name, if the component type has a custom name, - // we will update it. - instance.addAttribute(new Attribute("component", workbench.getType().getClassName())); - - workbench.setInstance(instance); - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java deleted file mode 100644 index 3dfc5feddd..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/LifecycleVisitor.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parse @Validate and @Invalidate annotations. - * @see org.apache.felix.ipojo.annotations.Validate - * @see org.apache.felix.ipojo.annotations.Invalidate - * @author Felix Project Team - */ -public class LifecycleVisitor extends AnnotationVisitor { - - public static enum Transition { - VALIDATE, INVALIDATE - } - - private ComponentWorkbench workbench; - private String name; - private Transition transition; - - public LifecycleVisitor(ComponentWorkbench workbench, String name, Transition transition) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.name = name; - this.transition = transition; - } - - @Override - public void visitEnd() { - Element cb = new Element("callback", ""); - cb.addAttribute(new Attribute("transition", transition.name().toLowerCase())); - cb.addAttribute(new Attribute("method", name)); - workbench.getElements().put(cb, null); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java deleted file mode 100644 index c263bbf29d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/MethodPropertyVisitor.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.computeEffectiveMethodName; - -/** - * @author Felix Project Team - */ -public class MethodPropertyVisitor extends AnnotationVisitor { - - /** - * Parent element. - */ - private Element m_parent; - - /** - * Attached method. - */ - private String m_method; - - /** - * Property name. - */ - private String m_name; - - /** - * Property id. - */ - private String m_id; - - /** - * Property value. - */ - private String m_value; - - /** - * Property mandatory aspect. - */ - private String m_mandatory; - - /** - * Property immutable aspect. - */ - private String m_immutable; - - /** - * Constructor. - * - * @param parent : element element. - * @param method : attached method. - */ - public MethodPropertyVisitor(Element parent, String method) { - super(Opcodes.ASM9); - m_parent = parent; - m_method = method; - } - - /** - * Visit annotation attributes. - * - * @param name : annotation name - * @param value : annotation value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("name")) { - m_name = value.toString(); - return; - } - if (name.equals("value")) { - m_value = value.toString(); - return; - } - if (name.equals("mandatory")) { - m_mandatory = value.toString(); - return; - } - if (name.equals("immutable")) { - m_immutable = value.toString(); - return; - } - if (name.equals("id")) { - m_id = value.toString(); - } - } - - /** - * End of the visit. - * Append the computed element to the element element. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - Element prop = visitEndCommon(); - - prop.addAttribute(new Attribute("method", m_method)); - - } - - protected Element visitEndCommon() { - m_method = computeEffectiveMethodName(m_method); - - // If neither name nor id is provided, try to extract the name - if (m_name == null && m_id == null && m_method.startsWith("set")) { - m_name = m_method.substring("set".length()); - m_id = m_name; - // Else align the two values - } else if (m_name != null && m_id == null) { - m_id = m_name; - } else if (m_id != null && m_name == null) { - m_name = m_id; - } - - Element prop = getPropertyElement(); - - if (m_value != null) { - prop.addAttribute(new Attribute("value", m_value)); - } - if (m_mandatory != null) { - prop.addAttribute(new Attribute("mandatory", m_mandatory)); - } - if (m_immutable != null) { - prop.addAttribute(new Attribute("immutable", m_immutable)); - } - - return prop; - } - - private Element getPropertyElement() { - - // Gather all the Elements - Element[] props = m_parent.getElements("property"); - Element prop = null; - for (int i = 0; props != null && prop == null && i < props.length; i++) { - - // Get the first one with the good name - String name = props[i].getAttribute("name"); - if (name != null && name.equals(m_name)) { - prop = props[i]; - } - } - - // Create the Element if not present - if (prop == null) { - prop = new Element("property", ""); - m_parent.addElement(prop); - if (m_name != null) { - prop.addAttribute(new Attribute("name", m_name)); - } - } - - return prop; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java deleted file mode 100644 index 208728df20..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ParameterPropertyVisitor.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.MethodNode; - -/** - * @author Felix Project Team - */ -public class ParameterPropertyVisitor extends MethodPropertyVisitor { - - /** - * If this is a parameter annotation, the index of the parameter. - */ - private int m_index = -1; - - private MethodNode node; - - /** - * Constructor. - * - * @param parent : element element. - * @param method : attached method. - * @param index : the parameter index - */ - public ParameterPropertyVisitor(Element parent, MethodNode method, int index) { - super(parent, method.name); - this.node = method; - m_index = index; - } - - /** - * End of the visit. - * Append the computed element to the element element. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - Element prop = visitEndCommon(); - String type = Type.getArgumentTypes(node.desc)[m_index].getClassName(); - prop.addAttribute(new Attribute("type", type)); - prop.addAttribute(new Attribute("constructor-parameter", Integer.toString(m_index))); - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java deleted file mode 100644 index 1eebaecfcc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostRegistrationVisitor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.PostRegistration - */ -public class PostRegistrationVisitor extends AnnotationVisitor { - - private ComponentWorkbench workbench; - private String name; - - public PostRegistrationVisitor(ComponentWorkbench workbench, String name) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.name = name; - } - - @Override - public void visitEnd() { - Element provides; - if (workbench.getIds().containsKey("provides")) { - provides = workbench.getIds().get("provides"); - provides.addAttribute(new Attribute("post-registration", name)); - } - // Else ignore annotation ... - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java deleted file mode 100644 index 1022754b6d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/PostUnregistrationVisitor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * @see org.apache.felix.ipojo.annotations.PostUnregistration - * @author Felix Project Team - */ -public class PostUnregistrationVisitor extends AnnotationVisitor { - - private ComponentWorkbench workbench; - private String name; - - public PostUnregistrationVisitor(ComponentWorkbench workbench, String name) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.name = name; - } - - @Override - public void visitEnd() { - Element provides; - if (workbench.getIds().containsKey("provides")) { - provides = workbench.getIds().get("provides"); - provides.addAttribute(new Attribute("post-unregistration", name)); - } - // Else ignore annotation ... - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ProvidesVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ProvidesVisitor.java deleted file mode 100644 index 2e318c8ef6..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ProvidesVisitor.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * Parse the @Provides annotation. - * - * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Provides - */ -public class ProvidesVisitor extends AnnotationVisitor { - - private ComponentWorkbench workbench; - - /** - * Provides element. - */ - private Element m_prov = new Element("provides", ""); - - public ProvidesVisitor(ComponentWorkbench workbench) { - super(Opcodes.ASM9); - this.workbench = workbench; - } - - /** - * Visit @provides annotation attributes. - * - * @param name : annotation attribute name - * @param value : annotation attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("factory")) { // Should be deprecated - m_prov.addAttribute(new Attribute("factory", value.toString())); - } - if (name.equals("strategy")) { - m_prov.addAttribute(new Attribute("strategy", value.toString())); - } - } - - /** - * Visit specifications array. - * - * @param name : attribute name - * @return a visitor visiting each element of the array. - * @see org.objectweb.asm.AnnotationVisitor#visitArray(java.lang.String) - */ - public AnnotationVisitor visitArray(String name) { - if (name.equals("specifications")) { - return new InterfaceArrayVisitor(); - } else if (name.equals("properties")) { - // Create a new simple visitor to visit the nested ServiceProperty annotations - // Collected properties are collected in m_prov - return new AnnotationVisitor(Opcodes.ASM9) { - public AnnotationVisitor visitAnnotation(String ignored, String desc) { - return new FieldPropertyVisitor(m_prov); - } - }; - } else { - return null; - } - } - - /** - * End of the visit. - * Append to the element element the computed "provides" element. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - workbench.getIds().put("provides", m_prov); - workbench.getElements().put(m_prov, null); - } - - private class InterfaceArrayVisitor extends AnnotationVisitor { - /** - * List of parsed interface. - */ - private String m_itfs; - - - public InterfaceArrayVisitor() { - super(Opcodes.ASM9); - } - - /** - * Visit one element of the array. - * - * @param arg0 : null - * @param arg1 : element value. - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String arg0, Object arg1) { - if (m_itfs == null) { - m_itfs = "{" + ((Type) arg1).getClassName(); - } else { - m_itfs += "," + ((Type) arg1).getClassName(); - } - } - - /** - * End of the array visit. - * Add the attribute to 'provides' element. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - m_prov.addAttribute(new Attribute("specifications", m_itfs + "}")); - } - - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/RequiresVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/RequiresVisitor.java deleted file mode 100644 index e23f5bb6dc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/RequiresVisitor.java +++ /dev/null @@ -1,268 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * AnnotationVisitor parsing the @Requires annotation. - * @see org.apache.felix.ipojo.annotations.Requires - * @author Felix Project Team - */ -public class RequiresVisitor extends AnnotationVisitor { - - - private ComponentWorkbench workbench; - - /** - * Dependency field. - */ - private String m_field; - - /** - * Dependency filter. - */ - private String m_filter; - - /** - * Is the dependency optional ? - */ - private String m_optional; - - /** - * Dependency specification. - */ - private String m_specification; - - /** - * Dependency id. - */ - private String m_id; - - /** - * Binding policy. - */ - private String m_policy; - - /** - * Default-Implementation attribute. - */ - private String m_defaultImplementation; - - /** - * Exception attribute. - */ - private String m_exception; - - /** - * Enable or Disable Nullable pattern. - */ - private String m_nullable; - - /** - * Comparator. - */ - private String m_comparator; - - /** - * From attribute. - */ - private String m_from; - - /** - * Proxy attribute. - */ - private String m_proxy; - - /** - * Timeout attribute. - */ - private String m_timeout; - - /** - * Constructor. - * @param name : field name. - */ - public RequiresVisitor(ComponentWorkbench workbench, String name) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.m_field = name; - } - - /** - * Visit one "simple" annotation. - * @param name : annotation name - * @param value : annotation value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("filter")) { - m_filter = value.toString(); - return; - } - if (name.equals("optional")) { - m_optional = value.toString(); - return; - } - if (name.equals("nullable")) { - m_nullable = value.toString(); - return; - } - // Used by component using the pre 1.11 version of annotations. - if (name.equals("policy")) { - m_policy = getPolicy(value.toString()); - return; - } - if (name.equals("defaultimplementation")) { - Type type = Type.getType(value.toString()); - m_defaultImplementation = type.getClassName(); - return; - } - if (name.equals("exception")) { - Type type = Type.getType(value.toString()); - m_exception = type.getClassName(); - return; - } - if (name.equals("specification")) { - // Detect whether it's an internal class name. - if (value.toString().startsWith("L") && value.toString().endsWith(";")) { - Type type = Type.getType(value.toString()); - m_specification = type.getClassName(); - } else { - m_specification = value.toString(); - } - return; - } - if (name.equals("id")) { - m_id = value.toString(); - return; - } - if (name.equals("comparator")) { - Type type = Type.getType(value.toString()); - m_comparator = type.getClassName(); - return; - } - if (name.equals("from")) { - m_from = value.toString(); - return; - } - if (name.equals("proxy")) { - m_proxy = value.toString(); - } - if (name.equals("timeout")) { - m_timeout = value.toString(); - } - } - - @Override - public void visitEnum(String name, String desc, String value) { - if (name.equals("policy")) { - m_policy = getPolicy(value); - } - } - - /** - * End of the annotation. - * Create a "requires" element - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - Element requires; - if (m_id == null) { - requires = workbench.getIds().get(m_field); - } else { - requires = workbench.getIds().get(m_id); - } - - if (requires == null) { - requires = new Element("requires", ""); - } - - requires.addAttribute(new Attribute("field", m_field)); - if (m_specification != null) { - requires.addAttribute(new Attribute("specification", m_specification)); - } - if (m_filter != null) { - requires.addAttribute(new Attribute("filter", m_filter)); - } - if (m_optional != null) { - requires.addAttribute(new Attribute("optional", m_optional)); - } - if (m_nullable != null) { - requires.addAttribute(new Attribute("nullable", m_nullable)); - } - if (m_defaultImplementation != null) { - requires.addAttribute(new Attribute("default-implementation", m_defaultImplementation)); - } - if (m_exception != null) { - requires.addAttribute(new Attribute("exception", m_exception)); - } - if (m_policy != null) { - requires.addAttribute(new Attribute("policy", m_policy)); - } - if (m_id != null) { - requires.addAttribute(new Attribute("id", m_id)); - } - if (m_comparator != null) { - requires.addAttribute(new Attribute("comparator", m_comparator)); - } - if (m_from != null) { - requires.addAttribute(new Attribute("from", m_from)); - } - if (m_proxy != null) { - requires.addAttribute(new Attribute("proxy", m_proxy)); - } - if (m_timeout != null) { - requires.addAttribute(new Attribute("timeout", m_timeout)); - } - - if (m_id != null) { - workbench.getIds().put(m_id, requires); - } else { - workbench.getIds().put(m_field, requires); - } - - workbench.getElements().put(requires, null); - } - - /** - * Gets the iPOJO binding policy name from the given value. - * @param policy the read policy - * @return the policy name - */ - public static String getPolicy(String policy) { - if (policy.equalsIgnoreCase("static")) { - return "static"; - } - if (policy.equalsIgnoreCase("dynamic")) { - return "dynamic"; - } - // The _ is used in the annotation. - if (policy.equalsIgnoreCase("dynamic_priority")) { - return "dynamic-priority"; - } - return policy; - } -} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ServiceControllerVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ServiceControllerVisitor.java deleted file mode 100644 index eceb7e53a3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ServiceControllerVisitor.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * Parses a @ServiceController annotation. - * @see org.apache.felix.ipojo.annotations.ServiceController - * @author Felix Project Team - */ -public class ServiceControllerVisitor extends AnnotationVisitor { - - /** - * Parent element. - */ - private Element provides; - - /** - * Provides element. - */ - private Element controller = new Element("controller", ""); - - /** - * Constructor. - * @param provides : element element. - * @param field : field name. - */ - public ServiceControllerVisitor(String field, Element provides) { - super(Opcodes.ASM9); - this.provides = provides; - controller.addAttribute(new Attribute("field", field)); - } - - /** - * Visit one "simple" annotation. - * @param name : annotation name - * @param value : annotation value - * @see org.objectweb.asm.AnnotationVisitor#visit(java.lang.String, java.lang.Object) - */ - public void visit(String name, Object value) { - if (name.equals("value")) { - controller.addAttribute(new Attribute("value", value.toString())); - return; - } - if (name.equals("specification")) { - String spec = ((Type) value).getClassName(); - controller.addAttribute(new Attribute("specification", spec)); - } - } - - /** - * End of the annotation. - * Create a "controller" element - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - provides.addElement(controller); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/UpdatedVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/UpdatedVisitor.java deleted file mode 100644 index dd1cf17330..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/UpdatedVisitor.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -/** - * @author Felix Project Team - * @see org.apache.felix.ipojo.annotations.Updated - */ -public class UpdatedVisitor extends AnnotationVisitor { - - private ComponentWorkbench workbench; - private String name; - - public UpdatedVisitor(ComponentWorkbench workbench, String name) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.name = name; - } - - @Override - public void visitEnd() { - Element properties = Elements.getPropertiesElement(workbench); - properties.addAttribute(new Attribute("updated", name)); - - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/AbstractBindVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/AbstractBindVisitor.java deleted file mode 100644 index 2d4fbe3296..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/AbstractBindVisitor.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.bind; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.RequiresVisitor; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * @author Felix Project Team - */ -public abstract class AbstractBindVisitor extends AnnotationVisitor { - - protected ComponentWorkbench workbench; - protected Action action; - - public AbstractBindVisitor(ComponentWorkbench workbench, Action action) { - super(Opcodes.ASM9); - this.workbench = workbench; - this.action = action; - } - - /** - * Requirement filter. - */ - protected String m_filter; - /** - * Is the requirement optional? - */ - protected String m_optional; - /** - * Is the requirement aggregate? - */ - protected String m_aggregate; - /** - * Required specification. - */ - protected String m_specification; - /** - * Requirement id. - */ - protected String m_id; - /** - * Binding policy. - */ - protected String m_policy; - /** - * Comparator. - */ - protected String m_comparator; - /** - * From attribute. - */ - protected String m_from; - - /** - * proxy attribute. - */ - protected String m_proxy; - - /** - * Visit annotation's attributes. - * - * @param name : annotation name - * @param value : annotation value - * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object) - */ - public void visit(String name, Object value) { - if (name.equals("filter")) { - m_filter = value.toString(); - return; - } - if (name.equals("optional")) { - m_optional = value.toString(); - return; - } - if (name.equals("aggregate")) { - m_aggregate = value.toString(); - return; - } - if (name.equals("specification")) { - // Detect whether it's an internal class name. - if (value.toString().startsWith("L") && value.toString().endsWith(";")) { - Type type = Type.getType(value.toString()); - m_specification = type.getClassName(); - } else { - m_specification = value.toString(); - } - return; - } - // Still used by component using the old version of the annotations. - if (name.equals("policy")) { - m_policy = RequiresVisitor.getPolicy(value.toString()); - return; - } - if (name.equals("id")) { - m_id = value.toString(); - return; - } - if (name.equals("comparator")) { - Type type = Type.getType(value.toString()); - m_comparator = type.getClassName(); - return; - } - if (name.equals("from")) { - m_from = value.toString(); - } - if (name.equals("proxy")) { - m_proxy = value.toString(); - } - - } - - @Override - public void visitEnum(String name, String desc, String value) { - if (name.equals("policy")) { - m_policy = RequiresVisitor.getPolicy(value); - } - } - - public void visitEnd() { - } - - protected Element getRequiresElement() { - - // Check if it is a full-determined requirement - Element requires = workbench.getIds().get(m_id); - if (requires == null) { - // Add the complete requires - requires = createRequiresElement(); - } else { - if (!completeExistingRequires(requires)) - return null; - } - - return requires; - } - - protected boolean completeExistingRequires(Element requires) { - return - completeAttribute(requires, "specification", m_specification) - && completeAttribute(requires, "optional", m_optional) - && completeAttribute(requires, "aggregate", m_aggregate) - && completeAttribute(requires, "filter", m_filter) - && completeAttribute(requires, "policy", m_policy) - && completeAttribute(requires, "comparator", m_comparator) - && completeAttribute(requires, "from", m_from) - && completeAttribute(requires, "proxy", m_proxy); - } - - private boolean completeAttribute(Element requires, String name, String value) { - // If we have a value - if (value != null) { - - String old = requires.getAttribute(name); - if (old == null) { - // If the old value was not set, just set the new value - requires.addAttribute(new Attribute(name, value)); - } else if (!value.equals(old)) { - // - System.err.println("The '" + name + "' attribute has changed: " + old + " -> " + value); - return false; - } // Otherwise, the old and new value are equals - } - return true; - } - - protected Element createRequiresElement() { - Element requires; - requires = new Element("requires", ""); - if (m_specification != null) { - requires.addAttribute(new Attribute("specification", m_specification)); - } - if (m_aggregate != null) { - requires.addAttribute(new Attribute("aggregate", m_aggregate)); - } - if (m_filter != null) { - requires.addAttribute(new Attribute("filter", m_filter)); - } - if (m_optional != null) { - requires.addAttribute(new Attribute("optional", m_optional)); - } - if (m_policy != null) { - requires.addAttribute(new Attribute("policy", m_policy)); - } - if (m_id != null) { - requires.addAttribute(new Attribute("id", m_id)); - } - if (m_comparator != null) { - requires.addAttribute(new Attribute("comparator", m_comparator)); - } - if (m_from != null) { - requires.addAttribute(new Attribute("from", m_from)); - } - if (m_proxy != null) { - requires.addAttribute(new Attribute("proxy", m_proxy)); - } - return requires; - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/Action.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/Action.java deleted file mode 100644 index 5ed64a11f7..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/Action.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.bind; - -/** - * @author Felix Project Team - */ -public enum Action { - BIND, MODIFIED, UNBIND -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitor.java deleted file mode 100644 index a09a5d26dc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitor.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.bind; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.tree.MethodNode; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.computeEffectiveMethodName; - -/** - * Parse @Bind & @Unbind annotations on methods. - * @author Felix Project Team - */ -public class MethodBindVisitor extends AbstractBindVisitor { - - /** - * Method name. - */ - private MethodNode m_node; - - /** - * Error reporter. - */ - private Reporter m_reporter; - - public MethodBindVisitor(ComponentWorkbench workbench, Action action, MethodNode method, Reporter reporter) { - super(workbench, action); - this.m_node = method; - this.m_reporter = reporter; - } - - /** - * End of the visit. - * Create or append the requirement info to a created or already existing "requires" element. - * - * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd() - */ - public void visitEnd() { - if (m_id == null) { - String identifier = Names.getMethodIdentifier(m_node); - if (identifier != null) { - m_id = identifier; - } else { - if (m_specification != null) { - m_id = m_specification; - } else { - m_reporter.error("Cannot determine the requires identifier for the (%s) %s method: %s", - computeEffectiveMethodName(m_node.name), - action.name(), - "Either 'id' attribute is missing or method name do not follow the bind/set/add/modified " + - "naming pattern, or no specification (service interface) can be found in method signature " + - "or specified in annotation. Dependency will be ignored (would cause an Exception at runtime)"); - return; - } - } - } - - Element requires = getRequiresElement(); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("method", computeEffectiveMethodName(m_node.name))); - callback.addAttribute(new Attribute("type", action.name().toLowerCase())); - requires.addElement(callback); - - workbench.getIds().put(m_id, requires); - workbench.getElements().put(requires, null); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/ParameterBindVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/ParameterBindVisitor.java deleted file mode 100644 index b3063ee05d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/ParameterBindVisitor.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.bind; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Parse @Bind & @Unbind annotations on method's parameters. - * @author Felix Project Team - */ -public class ParameterBindVisitor extends AbstractBindVisitor { - - /** - * For annotation parameter, - * the parameter index. - */ - private int m_index; - - public ParameterBindVisitor(ComponentWorkbench workbench, Action action, int index) { - super(workbench, action); - m_index = index; - } - - /** - * End of the visit. - * Create or append the requirement info to a created or already existing "requires" element. - * - * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd() - */ - public void visitEnd() { - if (m_id == null) { - m_id = Integer.toString(m_index); - } - - Element requires = getRequiresElement(); - - // Specific for parameters - requires.addAttribute(new Attribute("constructor-parameter", Integer.toString(m_index))); - - workbench.getIds().put(m_id, requires); - workbench.getElements().put(requires, null); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/FieldGenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/FieldGenericVisitor.java deleted file mode 100644 index b2edce048c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/FieldGenericVisitor.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.tree.FieldNode; - -import java.lang.annotation.ElementType; - -/** - * @author Felix Project Team - */ -public class FieldGenericVisitor extends RootGenericVisitor { - public FieldGenericVisitor(ComponentWorkbench workbench, Element element, FieldNode node) { - super(workbench, element, ElementType.FIELD); - element.addAttribute(new Attribute("field", node.name)); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitor.java deleted file mode 100644 index d452b06542..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitor.java +++ /dev/null @@ -1,114 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -import java.lang.reflect.Array; - -/** - * @author Felix Project Team - */ -public class GenericVisitor extends AnnotationVisitor { - protected Element element; - - public GenericVisitor(Element element) { - super(Opcodes.ASM9); - this.element = element; - } - - /** - * Visit a 'simple' annotation attribute. - * This method is used for primitive arrays too. - * - * @param name : attribute name - * @param value : attribute value - * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object) - */ - public void visit(String name, Object value) { - if (value.getClass().isArray()) { - // Primitive arrays case - String v = null; - int index = Array.getLength(value); - for (int i = 0; i < index; i++) { - if (v == null) { - v = "{" + Array.get(value, i); - } else { - v += "," + Array.get(value, i); - } - } - v += "}"; - element.addAttribute(new Attribute(name, v)); - return; - } - - // Attributes are added as normal attributes - if (!(value instanceof Type)) { - element.addAttribute(new Attribute(name, value.toString())); - } else { - // Attributes of type class need a special handling - element.addAttribute(new Attribute(name, ((Type) value).getClassName())); - } - - } - - /** - * Visit a sub-annotation. - * - * @param name : attribute name. - * @param descriptor : annotation description - * @return an annotation visitor which will visit the given annotation - * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(String, String) - */ - public AnnotationVisitor visitAnnotation(String name, String descriptor) { - // Sub annotations are mapped to sub-elements - Element sub = Elements.buildElement(Type.getType(descriptor)); - element.addElement(sub); - return new GenericVisitor(sub); - } - - /** - * Visit an array attribute. - * - * @param name : attribute name - * @return a visitor which will visit each element of the array - * @see org.objectweb.asm.AnnotationVisitor#visitArray(String) - */ - public AnnotationVisitor visitArray(String name) { - return new SubArrayVisitor(element, name); - } - - /** - * Visits an enumeration attribute. - * - * @param name the attribute name - * @param desc the enumeration descriptor - * @param value the attribute value - * @see org.objectweb.asm.AnnotationVisitor#visitEnum(String, String, String) - */ - public void visitEnum(String name, String desc, String value) { - element.addAttribute(new Attribute(name, value)); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitorFactory.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitorFactory.java deleted file mode 100644 index eefa6bc3b6..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/GenericVisitorFactory.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 14:41 - */ -public class GenericVisitorFactory implements AnnotationVisitorFactory { - private final String m_name; - private final String m_namespace; - - public GenericVisitorFactory(final String name, final String namespace) { - m_name = name; - m_namespace = namespace; - } - - // Need to build a new Element instance for each created visitor - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - if (context.getClassNode() != null) { - return new TypeGenericVisitor(context.getWorkbench(), - new Element(m_name, m_namespace)); - } else if (context.getFieldNode() != null) { - return new FieldGenericVisitor(context.getWorkbench(), - new Element(m_name, m_namespace), - context.getFieldNode()); - - } else if ((context.getMethodNode() != null) && - (context.getParameterIndex() == BindingContext.NO_INDEX)) { - return new MethodGenericVisitor(context.getWorkbench(), - new Element(m_name, m_namespace), - context.getMethodNode()); - } else { - // last case: method parameter annotation - return new ParameterGenericVisitor(context.getWorkbench(), - new Element(m_name, m_namespace), - context.getMethodNode(), - context.getParameterIndex()); - } - } - - @Override - public String toString() { - return "GenericVisitorFactory"; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/MethodGenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/MethodGenericVisitor.java deleted file mode 100644 index 29c558a50c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/MethodGenericVisitor.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.tree.MethodNode; - -import java.lang.annotation.ElementType; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.computeEffectiveMethodName; - -/** - * @author Felix Project Team - */ -public class MethodGenericVisitor extends RootGenericVisitor { - public MethodGenericVisitor(ComponentWorkbench workbench, Element element, MethodNode node) { - super(workbench, element, ElementType.METHOD); - element.addAttribute(new Attribute("method", computeEffectiveMethodName(node.name))); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/ParameterGenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/ParameterGenericVisitor.java deleted file mode 100644 index c3e59e7898..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/ParameterGenericVisitor.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.MethodNode; - -import java.lang.annotation.ElementType; - -/** - * @author Felix Project Team - */ -public class ParameterGenericVisitor extends RootGenericVisitor { - private int index; - private MethodNode node; - - public ParameterGenericVisitor(ComponentWorkbench workbench, Element element, MethodNode node, int index) { - super(workbench, element, ElementType.PARAMETER); - this.node = node; - this.index = index; - } - - @Override - public void visitEnd() { - super.visitEnd(); - - String type = Type.getArgumentTypes(node.desc)[index].getClassName(); - // TODO Is the 'index' attribute required ? - element.addAttribute(new Attribute("index", Integer.toString(index))); - element.addAttribute(new Attribute("type", type)); - element.addAttribute(new Attribute("constructor-parameter", Integer.toString(index))); - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/RootGenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/RootGenericVisitor.java deleted file mode 100644 index 9a96b410a1..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/RootGenericVisitor.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Element; - -import java.lang.annotation.ElementType; - -/** - * @author Felix Project Team - */ -public class RootGenericVisitor extends GenericVisitor { - private ComponentWorkbench workbench; - - /** - * Id attribute (if found) - * else use the annotation package name. - */ - private String m_id; - - /** - * Parent attribute (if found) - * else use the annotation package name. - */ - private String m_parent; - - /** - * Describes the structure that supports the traversed annotation. - */ - private ElementType type; - - public RootGenericVisitor(ComponentWorkbench workbench, Element element, ElementType type) { - super(element); - this.workbench = workbench; - this.type = type; - } - - /** - * Visit a 'simple' annotation attribute. - * This method is used for primitive arrays too. - * @param name : attribute name - * @param value : attribute value - * @see org.objectweb.asm.commons.EmptyVisitor#visit(String, Object) - */ - public void visit(String name, Object value) { - super.visit(name, value); - - if (name.equals("id")) { - m_id = value.toString(); - } else if (name.equals("parent")) { - m_parent = value.toString(); - } - } - - - - /** - * End of the visit. - * All attribute were visited, we can update collectors data. - * @see org.objectweb.asm.commons.EmptyVisitor#visitEnd() - */ - public void visitEnd() { - - if (m_id != null) { - // An ID has been provided as annotation attribute - // Register our element under that ID - workbench.getIds().put(m_id, element); - } else { - // No ID provided, generate a new one from the element's namespace (aka handler's namespace) - m_id = element.getNameSpace(); - if (m_id != null && !workbench.getIds().containsKey(m_id) && isClassType()) { - // No Elements were already registered under that namespace - workbench.getIds().put(m_id, element); - } else { - // ID already registered by another annotation - if (m_parent == null) { - // If no parent specified, place this element under the 'class level' Element (default) - m_parent = element.getNameSpace(); - } // Otherwise, place this element under the specified Element (contribution) - } - } - - workbench.getElements().put(element, m_parent); - - } - - private boolean isClassType() { - return ElementType.TYPE.equals(type); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/SubArrayVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/SubArrayVisitor.java deleted file mode 100644 index 1d3da18fba..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/SubArrayVisitor.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * @author Felix Project Team - */ -public class SubArrayVisitor extends AnnotationVisitor { - - /** - * Parent element. - */ - private Element m_elem; - - /** - * Attribute name. - */ - private String m_name; - - /** - * Attribute value. - * (accumulator) - */ - private String m_acc; - - /** - * Constructor. - * - * @param elem : element element. - * @param name : attribute name. - */ - public SubArrayVisitor(Element elem, String name) { - super(Opcodes.ASM9); - m_elem = elem; - m_name = name; - } - - /** - * Visit a 'simple' element of the visited array. - * - * @param name : null - * @param value : element value. - * @see org.objectweb.asm.AnnotationVisitor#visit(String, Object) - */ - public void visit(String name, Object value) { - if (m_acc == null) { - if (!(value instanceof Type)) { - m_acc = "{" + value.toString(); - } else { - // Attributes of type class need a special handling - m_acc = "{" + ((Type) value).getClassName(); - } - } else { - if (!(value instanceof Type)) { - m_acc = m_acc + "," + value.toString(); - } else { - // Attributes of type class need a special handling - m_acc = m_acc + "," + ((Type) value).getClassName(); - } - } - } - - /** - * Visits an enumeration attribute. - * - * @param name the attribute name - * @param desc the enumeration descriptor - * @param value the attribute value - */ - public void visitEnum(String name, String desc, String value) { - if (m_acc == null) { - m_acc = "{" + value; - } else { - m_acc = m_acc + "," + value; - } - } - - - /** - * Visit an annotation element of the visited array. - * - * @param name : null - * @param desc : annotation to visit - * @return the visitor which will visit the annotation - * @see org.objectweb.asm.AnnotationVisitor#visitAnnotation(String, String) - */ - public AnnotationVisitor visitAnnotation(String name, String desc) { - // Sub annotations are map to sub-elements - Element elem = Elements.buildElement(Type.getType(desc)); - m_elem.addElement(elem); - return new GenericVisitor(elem); - } - - /** - * End of the visit. - * - * @see org.objectweb.asm.AnnotationVisitor#visitEnd() - */ - public void visitEnd() { - if (m_acc != null) { - // We have analyzed an attribute - m_elem.addAttribute(new Attribute(m_name, m_acc + "}")); - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/TypeGenericVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/TypeGenericVisitor.java deleted file mode 100644 index 9da0437b1c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/generic/TypeGenericVisitor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.generic; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Element; - -import java.lang.annotation.ElementType; - -/** - * @author Felix Project Team - */ -public class TypeGenericVisitor extends RootGenericVisitor { - public TypeGenericVisitor(ComponentWorkbench workbench, Element element) { - super(workbench, element, ElementType.TYPE); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullBinding.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullBinding.java deleted file mode 100644 index b736d8bc4d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullBinding.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.ignore; - -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.alwaysTrue; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding; -import org.objectweb.asm.Type; - -/** - * User: guillaume - * Date: 10/07/13 - * Time: 15:04 - */ -public class NullBinding extends Binding { - public NullBinding(final Type type) { - super(); - setAnnotationType(type); - setPredicate(alwaysTrue()); - setFactory(NullVisitorFactory.INSTANCE); - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullVisitorFactory.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullVisitorFactory.java deleted file mode 100644 index c056e9e180..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ignore/NullVisitorFactory.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.ignore; - -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.objectweb.asm.AnnotationVisitor; - -/** -* User: guillaume -* Date: 10/07/13 -* Time: 15:05 -*/ -public class NullVisitorFactory implements AnnotationVisitorFactory { - public static final AnnotationVisitorFactory INSTANCE = new NullVisitorFactory(); - - public AnnotationVisitor newAnnotationVisitor(final BindingContext context) { - return null; - } - - @Override - public String toString() { - return getClass().getSimpleName(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/FieldStereotypeVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/FieldStereotypeVisitor.java deleted file mode 100644 index 0ad132624f..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/FieldStereotypeVisitor.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.stereotype; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parses stereotypes for field. - */ -public class FieldStereotypeVisitor extends AnnotationVisitor { - - private final FieldVisitor m_delegate; - private final AnnotationType m_annotationType; - - public FieldStereotypeVisitor(final FieldVisitor delegate, AnnotationType annotationType) { - super(Opcodes.ASM9); - this.m_delegate = delegate; - m_annotationType = annotationType; - } - - @Override - public void visitEnd() { - // Replay stereotype annotations - for (Playback playback : m_annotationType.getPlaybacks()) { - playback.accept(m_delegate); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/MethodStereotypeVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/MethodStereotypeVisitor.java deleted file mode 100644 index 54ec56906b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/MethodStereotypeVisitor.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.stereotype; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -/** - * Parse stereotypes for methods. - */ -public class MethodStereotypeVisitor extends AnnotationVisitor { - - private final MethodVisitor m_delegate; - private final AnnotationType m_annotationType; - - public MethodStereotypeVisitor(final MethodVisitor delegate, AnnotationType annotationType) { - super(Opcodes.ASM9); - this.m_delegate = delegate; - m_annotationType = annotationType; - } - - @Override - public void visitEnd() { - // Replay stereotype annotations - for (Playback playback : m_annotationType.getPlaybacks()) { - playback.accept(m_delegate); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/ParameterStereotypeVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/ParameterStereotypeVisitor.java deleted file mode 100644 index afc7df4060..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/ParameterStereotypeVisitor.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.stereotype; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; - -/** - * User: guillaume - * Date: 30/05/13 - * Time: 18:55 - */ -public class ParameterStereotypeVisitor extends AnnotationVisitor { - - private final MethodVisitor m_delegate; - private final int index; - private final AnnotationType m_annotationType; - - public ParameterStereotypeVisitor(final MethodVisitor delegate, final int index, AnnotationType annotationType) { - super(Opcodes.ASM9); - this.m_delegate = delegate; - this.index = index; - m_annotationType = annotationType; - } - - @Override - public void visitEnd() { - // Replay stereotype annotations - for (Playback playback : m_annotationType.getPlaybacks()) { - playback.accept(m_delegate, index); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/StereotypeVisitorFactory.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/StereotypeVisitorFactory.java deleted file mode 100644 index b156f4d85a..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/StereotypeVisitorFactory.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.stereotype; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.FieldVisitor; -import org.objectweb.asm.MethodVisitor; - -/** -* User: guillaume -* Date: 11/07/13 -* Time: 14:26 -*/ -public class StereotypeVisitorFactory implements AnnotationVisitorFactory { - private final AnnotationType m_annotationType; - - public StereotypeVisitorFactory(final AnnotationType annotationType) { - m_annotationType = annotationType; - } - - public AnnotationVisitor newAnnotationVisitor(BindingContext context) { - if (context.getClassNode() != null) { - return new TypeStereotypeVisitor((ClassVisitor) context.getVisitor(), - m_annotationType); - } else if (context.getFieldNode() != null) { - return new FieldStereotypeVisitor((FieldVisitor) context.getVisitor(), - m_annotationType); - - } else if ((context.getMethodNode() != null) && - (context.getParameterIndex() == BindingContext.NO_INDEX)) { - return new MethodStereotypeVisitor((MethodVisitor) context.getVisitor(), - m_annotationType); - - } else { - // last case: method parameter annotation - return new ParameterStereotypeVisitor((MethodVisitor) context.getVisitor(), - context.getParameterIndex(), - m_annotationType); - } - - } - - @Override - public String toString() { - return "StereotypeVisitorFactory"; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/TypeStereotypeVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/TypeStereotypeVisitor.java deleted file mode 100644 index 2f94c3626b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/stereotype/TypeStereotypeVisitor.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.stereotype; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.Playback; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.Opcodes; - -/** - * User: guillaume - * Date: 30/05/13 - * Time: 18:55 - */ -public class TypeStereotypeVisitor extends AnnotationVisitor { - - private final ClassVisitor m_delegate; - private final AnnotationType m_annotationType; - - public TypeStereotypeVisitor(final ClassVisitor delegate, AnnotationType annotationType) { - super(Opcodes.ASM9); - this.m_delegate = delegate; - m_annotationType = annotationType; - } - - @Override - public void visitEnd() { - // Replay stereotype annotations - for (Playback playback : m_annotationType.getPlaybacks()) { - playback.accept(m_delegate); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Bindings.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Bindings.java deleted file mode 100644 index 5da9928485..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Bindings.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.util; - -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.DefaultBindingRegistry; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.IgnoreAllBindingRegistry; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.LegacyGenericBindingRegistry; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.MetaAnnotationBindingRegistry; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.BindingRegistry; -import org.apache.felix.ipojo.manipulator.spi.Module; - -/** - * @author Felix Project Team - */ -public class Bindings { - - public static BindingRegistry newBindingRegistry(final Reporter reporter, - final ResourceStore store, - final ModuleProvider provider) { - - // Build the registry by aggregation of the features we want - // TODO We can enable/disable the legacy support easily here - BindingRegistry registry = new DefaultBindingRegistry(reporter); - registry = new MetaAnnotationBindingRegistry(registry, reporter, store); - registry = new LegacyGenericBindingRegistry(registry, reporter); - registry = new IgnoreAllBindingRegistry(registry, reporter); - - // Build each Module and add its contributed Bindings in the registry - for (Module module : provider.findModules()) { - module.load(); - registry.addBindings(module); - } - - return registry; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Elements.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Elements.java deleted file mode 100644 index f9c2cc1bc3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Elements.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.util; - -import static java.lang.String.format; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; - -/** - * @author Felix Project Team - */ -public class Elements { - - /** - * Build the {@link Element} object from the given descriptor. - * It splits the annotation's classname in 2 parts (up to the last '.') - * first part (package's name) becomes the Element's namespace, and second - * part (class simple name) becomes the Element's name. - * @param type annotation descriptor - * @return the new element - */ - public static Element buildElement(Type type) { - String name = type.getClassName(); - int index = name.lastIndexOf('.'); - String local = name.substring(index + 1); - String namespace = name.substring(0, index); - return buildElement(namespace, local); - } - - /** - * Build an {@link Element} using the provided namespace and local name. - */ - public static Element buildElement(final String namespace, final String name) { - return new Element(name, namespace); - } - - /** - * Build an {@link Element} using the provided binding information. - * Expected format is {@literal [namespace:]name} (eg: {@literal com.acme:foo} or {@literal foo} if namespace - * by default -org.apache.felix.ipojo- has to be used). - * Notice that the ':' character usage in namespace or name part may lead to unexpected results. - * In that case, the @HandlerBinding(namespace = "urn:my:namespace", value = "foo:handler") usage is preferred. - * @param binding the condensed element name - * @return the new element - */ - public static Element buildElement(String binding) { - String[] split = binding.split(":"); - if (split.length == 1) { - return buildElement("", binding); - } - if (split.length > 2) { - throw new IllegalArgumentException( - format("@HandlerBinding(\"%s\") is invalid: only 1 ':' char is authorized, please" + - " use the @HandlerBinding(namespace=\"...\", value=\"...\") form instead.", - binding) - ); - } - return buildElement(split[0], split[1]); - } - - /** - * Return the Element named {@literal properties}, creates one if missing. - * @param workbench source for search - * @return the {@literal properties} Element (never null). - */ - public static Element getPropertiesElement(ComponentWorkbench workbench) { - Element properties = workbench.getIds().get("properties"); - if (properties == null) { - properties = buildElement("", "properties"); - workbench.getIds().put("properties", properties); - workbench.getElements().put(properties, null); - } - return properties; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java deleted file mode 100644 index e8da6ff4bd..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/Names.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.util; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Dictionary; -import java.util.List; -import java.util.Map; - -import org.apache.felix.ipojo.manipulation.ClassManipulator; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.MethodNode; - -/** - * @author Felix Project Team - */ -public class Names { - - /** - * Excluded types when searching for a specification interface in method's arguments. - */ - private static List EXCLUSIONS = new ArrayList(); - - static { - EXCLUSIONS.add(Type.getType(Map.class)); - EXCLUSIONS.add(Type.getType(Dictionary.class)); - EXCLUSIONS.add(Type.getType("Lorg/osgi/framework/ServiceReference;")); - } - - /** - * Computes the real method name. This method is useful when the annotation is collected on an manipulated method - * (prefixed by __M_). This method just removes the prefix if found. - * @param name the collected method name - * @return the effective method name, can be the collected method name if the method name does not start with - * the prefix. - */ - public static String computeEffectiveMethodName(String name) { - if (name != null && name.startsWith(ClassManipulator.PREFIX)) { - return name.substring(ClassManipulator.PREFIX.length()); - } else { - return name; - } - } - - /** - * Extract an identifier from the given method name. - * It removes some pre-defined prefixes ({@literal bind}, {@literal unbind}, - * {@literal set}, {@literal unset}, {@literal modified}). - * - * @param method method's name - * @return the method's identifier - */ - public static String getMethodIdentifier(final MethodNode method) { - - String effectiveName = computeEffectiveMethodName(method.name); - - if (effectiveName.startsWith("bind")) { - return effectiveName.substring("bind".length()); - } - - if (effectiveName.startsWith("set")) { - return effectiveName.substring("set".length()); - } - - if (effectiveName.startsWith("unbind")) { - return effectiveName.substring("unbind".length()); - } - - if (effectiveName.startsWith("unset")) { - return effectiveName.substring("unset".length()); - } - - if (effectiveName.startsWith("modified")) { - return effectiveName.substring("modified".length()); - } - - if (effectiveName.startsWith("add")) { - return effectiveName.substring("add".length()); - } - - if (effectiveName.startsWith("remove")) { - return effectiveName.substring("remove".length()); - } - - // Try to discover the specification's type from method's parameters' type - Type[] arguments = Type.getArgumentTypes(method.desc); - return findSpecification(Arrays.asList(arguments)); - - } - - /** - * Find the first type that was not excluded and consider it as the specification - * @param types method parameter's type - * @return the first non-excluded type or {@literal null} if no specification can be found - */ - private static String findSpecification(final List types) { - - // Find first non-excluded specification - // May return null if no specification is provided (likely a user error) - for (Type type : types) { - if (!EXCLUSIONS.contains(type)) { - return type.getClassName(); - } - } - return null; - } - - /** - * Check if the given annotation descriptor is an iPOJO custom annotation. - * A valid iPOJO custom annotation must contains 'ipojo' or 'handler' in its qualified name. - * @param desc annotation descriptor - * @return {@literal true} if the given descriptor is an iPOJO custom annotation - */ - public static boolean isCustomAnnotation(final String desc) { - String lowerCase = desc.toLowerCase(); - return lowerCase.contains("ipojo") || lowerCase.contains("handler"); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java deleted file mode 100644 index 4b8fc3ec96..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilter.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ipojo.manipulator.render; - -import org.apache.felix.ipojo.manipulation.ClassManipulator; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code ManipulatedMetadataFilter} - * - * @author Felix Project Team - */ -public class ManipulatedMetadataFilter implements MetadataFilter { - - public boolean accept(Element element) { - - // TODO I'm sure we can do better then testing blindly all attributes - // iPOJO manipulated elements filter - for (Attribute attribute : element.getAttributes()) { - String value = attribute.getValue(); - - // Filters: - // * manipulated methods - // * fields for the InstanceManager - // * InstanceManager setter - if (value.startsWith(ClassManipulator.PREFIX) - || value.contains("org.apache.felix.ipojo.InstanceManager") - || value.contains("_setInstanceManager")) { - return true; - } - } - - return false; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataFilter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataFilter.java deleted file mode 100644 index 1fe4fa591d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataFilter.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.manipulator.render; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Defines a filter to be tested against Element before rendering them into the Manifest. - * If one filter accept the element, the given Element will be filtered, other filters will be ignored. - * - * @author Felix Project Team - */ -public interface MetadataFilter { - - /** - * Tests if the given {@link Element} is accepted by the filter. - * @param element the tested element. - * @return {@literal true} if the filter accept the value (element will - * be omitted from the rendered metadata), {@literal false} otherwise. - */ - public boolean accept(final Element element); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataRenderer.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataRenderer.java deleted file mode 100644 index 418ef2173c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/render/MetadataRenderer.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.ipojo.manipulator.render; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code MetadataRenderer} renders a given {@link Element} into a String. - * - * @author Felix Project Team - */ -public class MetadataRenderer { - - private List m_filters = new ArrayList(); - - public MetadataRenderer() { - // By default, filter metadata coming from prior manipulation. - this.addMetadataFilter(new ManipulatedMetadataFilter()); - } - - /** - * Add a metadata filter - * @param filter added filter - */ - public void addMetadataFilter(MetadataFilter filter) { - m_filters.add(filter); - } - - /** - * Generate manipulation metadata. - * @param element rendered element. - * @return given manipulation metadata + manipulation metadata of the given element. - */ - public String render(Element element) { - StringBuilder builder = new StringBuilder(); - renderElement(element, builder); - return builder.toString(); - } - - private void renderElement(Element element, StringBuilder builder) { - - // If the element is already here, do not re-add the element. - if(!isFiltered(element)) { - - // Print the beginning of the element - startElement(element, builder); - - // Render all attributes - for (Attribute attribute : element.getAttributes()) { - renderAttribute(attribute, builder); - } - - // Render child elements - for (Element child : element.getElements()) { - renderElement(child, builder); - } - - // Print the end of the element - endElement(builder); - } - - - } - - private void startElement(Element element, StringBuilder builder) { - // Default namespace is empty - String namespace = ""; - if (element.getNameSpace() != null) { - namespace = element.getNameSpace() + ":"; - } - - builder.append(namespace) - .append(element.getName()) - .append(" { "); - } - - private void endElement(StringBuilder builder) { - builder.append("}"); - } - - private void renderAttribute(Attribute current, StringBuilder builder) { - - // Default namespace is empty - String namespace = ""; - if (current.getNameSpace() != null) { - namespace = current.getNameSpace() + ":"; - } - - // Render the attribute - builder.append("$") - .append(namespace) - .append(current.getName()) - .append("=") - .append(quoted(current.getValue())) - .append(" "); - } - - private String quoted(String value) { - return "\"" + value + "\""; - } - - /** - * Checks if the given element is an iPOJO generated element from a prior treatment - * @param element Element to be tested - * @return true if the given element was already injected by iPOJO - */ - private boolean isFiltered(final Element element) { - - // Iterates over all the filters and return the first positive answer (if any) - for (MetadataFilter filter : m_filters) { - if (filter.accept(element)) { - return true; - } - } - - return false; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/EmptyReporter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/EmptyReporter.java deleted file mode 100644 index 28c4e031c9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/EmptyReporter.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.manipulator.reporter; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.util.Collections5; - -/** - * An {@code EmptyReporter} is the basis implementation for Reporters. - * It is basically a no-op implementation. - * - * @author Felix Project Team - */ -public class EmptyReporter implements Reporter { - - /** - * List of warnings - */ - private List m_warnings = new ArrayList(); - - /** - * List of errors - */ - private List m_errors = new ArrayList(); - - public void trace(String message, Object... args) {} - - public void info(String message, Object... args) {} - - public void warn(String message, Object... args) {} - - public void error(String message, Object... args) {} - - public List getErrors() { - return m_errors; - } - - public List getWarnings() { - return m_warnings; - } - - protected Object[] getMessageArguments(Object... args) { - Object[] params = args; - if (args != null && args.length > 1) { - if (args[args.length - 1] instanceof Throwable) { - // last argument is an Exception, remove it - params = Collections5.copyOf(args, args.length - 1); - } - } - - return params; - } - - protected Throwable getThrowable(Object... args) { - Throwable throwable = null; - if (args != null && args.length > 1) { - if (args[args.length - 1] instanceof Throwable) { - // last argument is an Exception - throwable = (Throwable) args[args.length - 1]; - } - } - return throwable; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/SystemReporter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/SystemReporter.java deleted file mode 100644 index 0b1173eedc..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/reporter/SystemReporter.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.manipulator.reporter; - -import java.io.PrintStream; - -/** - * A {@code SystemReporter} reports feedback from within the manipulation process. - * - * @author Felix Project Team - */ -public class SystemReporter extends EmptyReporter { - - /** - * Micro enum used to prefix messages. - */ - private enum Level { - TRACE("#"), - INFO("I"), - WARN("W"), - ERROR("E"); - - private String value; - - Level(String value) { - this.value = value; - } - - public String append(String message) { - return value + " " + message; - } - } - - /** - * Enable/disable trace logging. - */ - private boolean enableTrace = false; - - public void setEnableTrace(boolean enableTrace) { - this.enableTrace = enableTrace; - } - - private void log(PrintStream stream, Level level, String formatted, Throwable throwable) { - // Print the message - stream.println(level.append(formatted)); - - // And the exception if any - if (throwable != null) { - throwable.printStackTrace(stream); - } - } - - @Override - public void trace(String message, Object... args) { - if (enableTrace) { - String formatted = String.format(message, getMessageArguments(args)); - log(System.out, Level.TRACE, formatted, getThrowable()); - } - } - - @Override - public void info(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - log(System.out, Level.INFO, formatted, getThrowable()); - } - - @Override - public void warn(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable throwable = getThrowable(); - log(System.out, Level.WARN, formatted, throwable); - - // Append Exception message if any - if (throwable != null) { - formatted += " "; - formatted += throwable.getMessage(); - } - getWarnings().add(formatted); - } - - @Override - public void error(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable throwable = getThrowable(); - log(System.out, Level.ERROR, formatted, throwable); - - // Append Exception message if any - if (throwable != null) { - formatted += " "; - formatted += throwable.getMessage(); - } - getErrors().add(formatted); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModule.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModule.java deleted file mode 100644 index 6f4667297b..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModule.java +++ /dev/null @@ -1,212 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.onlySupportedElements; - -import java.lang.annotation.Annotation; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.AnnotationType; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.AnnotationPlayback; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.stereotype.StereotypeVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Elements; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.Type; - -/** - * All provided {@link Module}s have to inherit from this class. - * It provides a simple to use DSL to express annotation bindings. - * @author Felix Project Team - */ -public abstract class AbsBindingModule implements Module { - - /** - * Build bindings. - */ - private final List bindings = new ArrayList(); - - private boolean loaded = false; - - public synchronized void load() { - if (!loaded) { - configure(); - loaded = true; - } - } - - /** - * Configure the bindings provided by this module. - */ - protected abstract void configure(); - - - public Iterator iterator() { - return bindings.iterator(); - } - - /** - * Initiate an annotation binding. - * Examples: - *

-     *     AnnotationVisitorFactory factory = new CompositeVisitorFactory();
-     *     bind(Composite.class).to(factory);
-     *     bind(Composite.class).when(.. some condition ..)
-     *                          .to(factory);
-     * 
- * @param annotationType the annotation that will be bound to the {@link AnnotationVisitorFactory} - */ - protected AnnotationBindingBuilder bind(Class annotationType) { - return new AnnotationBindingBuilder(bindings, annotationType); - } - - protected StereotypeBindingBuilder bindStereotype(Class annotationType) { - return new StereotypeBindingBuilder(bindings, annotationType); - } - - protected HandlerBindingBuilder bindHandlerBinding(Class annotationType) { - return new HandlerBindingBuilder(bindings, annotationType); - } - - protected void bindIgnore(Class annotationType) { - bindings.add(new NullBinding(Type.getType(annotationType))); - } - - /** - * DSL helper class. - */ - public class AnnotationBindingBuilder { - private Class annotationType; - private AnnotationVisitorFactory factory; - private List registry; - - public AnnotationBindingBuilder(List registry, - Class annotationType) { - this.registry = registry; - this.annotationType = annotationType; - } - - /** - * Declares a {@link Predicate} that will add a condition to the annotation binding. - * @see org.apache.felix.ipojo.manipulator.spi.helper.Predicates - * @param predicate the predicate to use - */ - public ConditionalBindingBuilder when(Predicate predicate) { - return new ConditionalBindingBuilder(this, predicate); - } - - /** - * Complete the annotation binding with the {@link AnnotationVisitorFactory} to be executed - * when the annotation is found. - * @param factory to be executed when the annotation is found. - */ - public void to(AnnotationVisitorFactory factory) { - this.factory = factory; - registry.add(build()); - } - - /** - * Creates the Binding. - */ - private Binding build() { - Binding binding = new Binding(); - binding.setAnnotationType(Type.getType(annotationType)); - binding.setPredicate(onlySupportedElements(annotationType)); - binding.setFactory(factory); - return binding; - } - - } - - public class ConditionalBindingBuilder { - private AnnotationBindingBuilder parent; - private Predicate predicate; - private AnnotationVisitorFactory factory; - - public ConditionalBindingBuilder(AnnotationBindingBuilder parent, Predicate predicate) { - this.parent = parent; - this.predicate = predicate; - } - - /** - * Complete the annotation binding with the {@link AnnotationVisitorFactory} to be executed - * when the annotation is found. - * @param factory to be executed when the annotation is found. - */ - public AnnotationBindingBuilder to(AnnotationVisitorFactory factory) { - this.factory = factory; - bindings.add(build()); - - return parent; - } - - /** - * Creates the Binding. - */ - private Binding build() { - Binding binding = parent.build(); - binding.setPredicate(predicate); - binding.setFactory(factory); - return binding; - } - } - - public class StereotypeBindingBuilder { - private final AnnotationType m_annotationType; - - public StereotypeBindingBuilder(final List bindings, final Class type) { - m_annotationType = new AnnotationType(Type.getType(type)); - Binding binding = new Binding(); - binding.setAnnotationType(m_annotationType.getType()); - binding.setPredicate(onlySupportedElements(type)); - binding.setFactory(new StereotypeVisitorFactory(m_annotationType)); - bindings.add(binding); - } - - public StereotypeBindingBuilder with(AnnotationLiteral literal) { - m_annotationType.getPlaybacks().add(new AnnotationPlayback(literal)); - return this; - } - } - - public class HandlerBindingBuilder { - - private final Binding m_binding; - - public HandlerBindingBuilder(final List bindings, final Class annotationType) { - m_binding = new Binding(); - Type type = Type.getType(annotationType); - m_binding.setAnnotationType(type); - m_binding.setPredicate(onlySupportedElements(annotationType)); - Element e = Elements.buildElement(type); - m_binding.setFactory(new GenericVisitorFactory(e.getName(), e.getNameSpace())); - bindings.add(m_binding); - } - - public void to(String namespace, String name) { - m_binding.setFactory(new GenericVisitorFactory(name, namespace)); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteral.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteral.java deleted file mode 100644 index 52ab4e48c6..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteral.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import static java.lang.String.format; - -import java.lang.annotation.Annotation; -import java.lang.reflect.ParameterizedType; -import java.lang.reflect.Type; - -/** - * Base annotation literal class to be extended when declaring stereotype bindings in a programmatic way. - * Usage example: - *
- *     public class InstantiateLiteral extends AnnotationLiteral implements Instantiate {
- *         public String name() {
- *             return "";
- *         }
- *     }
- * 
- * @author Felix Project Team - */ -public abstract class AnnotationLiteral implements Annotation { - - private Class annotationType; - - public Class annotationType() { - if (annotationType == null) { - annotationType = findAnnotationType(getClass()); - if (annotationType == null) { - throw new IllegalStateException( - format("Annotation %s does not specify its annotation type (T) in AnnotationLiteral", - getClass().getName()) - ); - } - } - return annotationType; - } - - public org.objectweb.asm.Type getType() { - return org.objectweb.asm.Type.getType(annotationType()); - } - - private static Class findAnnotationType(final Class type) { - Class implementer = findImplementer(type); - return findTypeParameter(implementer); - } - - private static Class findTypeParameter(final Class clazz) { - // Get the T of AnnotationLiteral - Type type = clazz.getGenericSuperclass(); - if (type instanceof ParameterizedType) { - ParameterizedType pType = (ParameterizedType) type; - return (Class) pType.getActualTypeArguments()[0]; - } - return null; - } - - private static Class findImplementer(final Class type) { - Class superClass = type.getSuperclass().asSubclass(AnnotationLiteral.class); - if (AnnotationLiteral.class.equals(superClass)) { - return type; - } else { - return findImplementer(superClass); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationVisitorFactory.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationVisitorFactory.java deleted file mode 100644 index b29d3cc7db..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/AnnotationVisitorFactory.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import org.objectweb.asm.AnnotationVisitor; - -/** - * Produces a new {@link AnnotationVisitor} instance for the given {@link BindingContext}. - * @author Felix Project Team - */ -public interface AnnotationVisitorFactory { - - /** - * May return {@literal null} if no visitor can be created. - */ - AnnotationVisitor newAnnotationVisitor(BindingContext context); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/BindingContext.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/BindingContext.java deleted file mode 100644 index 4f57f173c0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/BindingContext.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import java.lang.annotation.ElementType; - -/** - * @author Felix Project Team - */ -public class BindingContext { - - public static final int NO_INDEX = -1; - - /** - * - */ - private ComponentWorkbench workbench; - private FieldNode field; - private MethodNode method; - private ClassNode clazz; - private ElementType elementType; - private int parameterIndex; - private Reporter reporter; - private Type annotationType; - private Object visitor; - - - public BindingContext(final ComponentWorkbench workbench, - final Reporter reporter, - final Type annotationType, - final FieldNode node, - final ElementType elementType, - final int parameterIndex, - final Object visitor) { - this(workbench, reporter, annotationType, elementType, parameterIndex, visitor); - this.field = node; - } - - public BindingContext(final ComponentWorkbench workbench, - final Reporter reporter, - final Type annotationType, - final MethodNode node, - final ElementType elementType, - final int parameterIndex, - final Object visitor) { - this(workbench, reporter, annotationType, elementType, parameterIndex, visitor); - this.method = node; - } - - public BindingContext(final ComponentWorkbench workbench, - final Reporter reporter, - final Type annotationType, - final ClassNode node, - final ElementType elementType, - final int parameterIndex, - final Object visitor) { - this(workbench, reporter, annotationType, elementType, parameterIndex, visitor); - this.clazz = node; - } - - private BindingContext(final ComponentWorkbench workbench, - final Reporter reporter, - final Type annotationType, - final ElementType elementType, - final int parameterIndex, - final Object visitor) { - this.workbench = workbench; - this.reporter = reporter; - this.annotationType = annotationType; - this.elementType = elementType; - this.parameterIndex = parameterIndex; - this.visitor = visitor; - } - - public ComponentWorkbench getWorkbench() { - return workbench; - } - - public FieldNode getFieldNode() { - return field; - } - - public MethodNode getMethodNode() { - return method; - } - - public ClassNode getClassNode() { - return clazz; - } - - public ElementType getElementType() { - return elementType; - } - - public int getParameterIndex() { - return parameterIndex; - } - - public Reporter getReporter() { - return reporter; - } - - public Type getAnnotationType() { - return annotationType; - } - - public Object getVisitor() { - return visitor; - } - - /** - * This method is just to support the compatibility with the previous version. It returns an ASM node of the - * member on which the annotation is 'attached'. The type of the node depends on this element. It can be a {@link - * org.objectweb.asm.tree.FieldNode}, a {@link org.objectweb.asm.tree.MethodNode} or a - * {@link org.objectweb.asm.tree.ClassNode}. It actually checks the current node and returns the first set ones - * in this order: field, method, class. - *

- * The type of the returned object can be determined using the {@link #getElementType} method. However it is - * recommended to use one of the following method: {@link #getFieldNode()}, {@link #getMethodNode()} or - * {@link #getClassNode()}. - * - * @return the node. - * @deprecated - */ - public Object getNode() { - if (field != null) { - return field; - } - if (method != null) { - return method; - } - if (clazz != null) { - return clazz; - } - // No node ? - return null; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Module.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Module.java deleted file mode 100644 index 3a2d00b158..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Module.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding; - -/** - * A Module is the contributions from third party to the iPOJO manipulation process. - * It is dedicated to Annotation binding support (executing a given ASM AnnotationVisitor - * when a particular annotation is found). - * @author Felix Project Team - */ -public interface Module extends Iterable { - - /** - * Load the bindings provided by this module (only once). - * @since 1.11.2 - */ - void load(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/ModuleProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/ModuleProvider.java deleted file mode 100644 index 2eae682fe9..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/ModuleProvider.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import org.apache.felix.ipojo.manipulator.spi.Module; - -/** - * Discover {@link org.apache.felix.ipojo.manipulator.spi.Module}s available in the "environment". - * Environment is dependent of the implementation. - * @since 1.11.2 - * @author Felix Project Team - */ -public interface ModuleProvider { - - /** - * Discover a set of modules at a given time. - * Returned modules could disappear in the future. - * @return discovered modules (should NEVER returns {@literal null}) - */ - Iterable findModules(); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Predicate.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Predicate.java deleted file mode 100644 index cee734bdb0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/Predicate.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -/** - * A Predicate is executed with a given {@link BindingContext} and returns {@literal true} if the - * {@link #matches(BindingContext)} operation is a success. It returns {@literal false} otherwise. - * Predicates can be used to determine if the traversed element (can be found on {@link BindingContext}) - * matches some properties. - * - * @see org.apache.felix.ipojo.manipulator.spi.helper.Predicates - * @author Felix Project Team - */ -public interface Predicate { - - /** - * Returns {@literal true} if the context is matching the predicate. - * @param context Binding information source - * @return {@literal true} if the context is matching the predicate, {@literal false} otherwise. - */ - boolean matches(BindingContext context); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/helper/Predicates.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/helper/Predicates.java deleted file mode 100644 index 1c9c462843..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/helper/Predicates.java +++ /dev/null @@ -1,224 +0,0 @@ -/* - * 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.ipojo.manipulator.spi.helper; - -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.apache.felix.ipojo.manipulator.spi.Predicate; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; -import java.util.Arrays; -import java.util.Collection; -import java.util.HashSet; -import java.util.regex.Pattern; - -/** - * Ready-to-use {@link Predicate} implementations. - * @author Felix Project Team - */ -public class Predicates { - public static Node node() { - return new Node(); - } - - public static Reference reference(String refId) { - return new Reference(refId); - } - - public static Matcher pattern(String regex) { - return new Matcher(regex); - } - - /** - * Restrict to the given {@link ElementType}. - * @param type expected {@link ElementType} - */ - public static Predicate on(final ElementType type) { - return new Predicate() { - public boolean matches(BindingContext context) { - return context.getElementType().equals(type); - } - }; - } - - /** - * Always return {@literal true}. - */ - public static Predicate alwaysTrue() { - return new Predicate() { - public boolean matches(BindingContext context) { - return true; - } - }; - } - - /** - * Successful if all given predicates are satisfied. - * @param predicates predicates to be satisfied - */ - public static Predicate and(final Predicate... predicates) { - - // Optimization - if (predicates.length == 1) { - return predicates[0]; - } - - return new Predicate() { - public boolean matches(BindingContext context) { - - for (Predicate predicate : predicates) { - // Quit with first failure - if (!predicate.matches(context)) { - return false; - } - } - return true; - } - }; - } - - /** - * Successful if at least one of the given predicates is satisfied. - * @param predicates predicates to be satisfied (at least one) - */ - public static Predicate or(final Collection predicates) { - - // Optimization - if (predicates.size() == 1) { - return predicates.iterator().next(); - } - - return new Predicate() { - public boolean matches(BindingContext context) { - - for (Predicate predicate : predicates) { - // Quit with first success - if (predicate.matches(context)) { - return true; - } - } - // No predicate were matching - return false; - } - }; - } - - /** - * Successful if at least one of the given predicates is satisfied. - * @param predicates predicates to be satisfied (at least one) - */ - public static Predicate or(final Predicate... predicates) { - return or(Arrays.asList(predicates)); - } - - /** - * Restrict to the supported {@link ElementType}(s) of the annotation (use the @Target, if provided). - * @param annotationType annotation to explore - */ - public static Predicate onlySupportedElements(final Class annotationType) { - Target target = annotationType.getAnnotation(Target.class); - if (target == null) { - return alwaysTrue(); - } - - Collection supportedTypes = new HashSet(); - for (ElementType type : target.value()) { - supportedTypes.add(on(type)); - } - - return or(supportedTypes); - } - - public static class Reference { - - private String refId; - - public Reference(String refId) { - this.refId = refId; - } - - /** - * Restrict execution if the {@link org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench} - * contains the given reference's name. - */ - public Predicate exists() { - return new Predicate() { - public boolean matches(BindingContext context) { - return context.getWorkbench().getIds().containsKey(refId); - } - }; - } - } - - public static class Matcher { - - private Pattern pattern; - - public Matcher(String regex) { - pattern = Pattern.compile(regex); - } - - /** - * Restrict execution if the annotation's classname matches the given pattern. - */ - public Predicate matches() { - return new Predicate() { - public boolean matches(BindingContext context) { - return pattern.matcher(context.getAnnotationType().getClassName()).matches(); - } - }; - } - } - - public static class Node { - /** - * Restrict execution if the supported {@literal Node} has the given name. - */ - public Predicate named(final String expected) { - return new Predicate() { - public boolean matches(BindingContext context) { - if (context.getFieldNode() != null) { - FieldNode field = context.getFieldNode(); - return field.name.equals(expected); - } - - if (context.getMethodNode() != null) { - MethodNode method = context.getMethodNode(); - return method.name.equals(expected); - } - - if (context.getClassNode() != null) { - ClassNode clazz = context.getClassNode(); - return clazz.name.equals(expected); - } - - // Parameters have no name in bytecode - - return false; - } - }; - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CompositeModuleProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CompositeModuleProvider.java deleted file mode 100644 index 2e62514473..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CompositeModuleProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.manipulator.spi.provider; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.Module; - -/** - * Encapsulate other ModuleProviders in a single instance. - * @since 1.11.2 - * @author Felix Project Team - */ -public class CompositeModuleProvider implements ModuleProvider { - - private final Iterable providers; - - public CompositeModuleProvider(ModuleProvider... providers) { - this(Arrays.asList(providers)); - } - - public CompositeModuleProvider(final Iterable providers) { - this.providers = providers; - } - - public Iterable findModules() { - List modules = new ArrayList(); - for (ModuleProvider provider : providers) { - for (Module module : provider.findModules()) { - modules.add(module); - } - } - return modules; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CoreModuleProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CoreModuleProvider.java deleted file mode 100644 index 0bfca28b73..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/CoreModuleProvider.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.manipulator.spi.provider; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.module.DefaultBindingModule; - -/** - * Hardcoded provider for default core manipulation module. - * @since 1.11.2 - * @author Felix Project Team - */ -public class CoreModuleProvider extends DefaultModuleProvider { - public CoreModuleProvider() { - super(new DefaultBindingModule()); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/DefaultModuleProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/DefaultModuleProvider.java deleted file mode 100644 index 863d97dc49..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/DefaultModuleProvider.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ipojo.manipulator.spi.provider; - -import java.util.Arrays; -import java.util.Collections; - -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.Module; - -/** - * Return the given collection of {@link org.apache.felix.ipojo.manipulator.spi.Module}s. - * @since 1.11.2 - * @author Felix Project Team - */ -public class DefaultModuleProvider implements ModuleProvider { - - private final Iterable modules; - - public DefaultModuleProvider() { - this(Collections.emptyList()); - } - - public DefaultModuleProvider(Module... modules) { - this(Arrays.asList(modules)); - } - - public DefaultModuleProvider(final Iterable modules) { - this.modules = modules; - } - - public Iterable findModules() { - return modules; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/ServiceLoaderModuleProvider.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/ServiceLoaderModuleProvider.java deleted file mode 100644 index 50b24563b3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/spi/provider/ServiceLoaderModuleProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.manipulator.spi.provider; - -import java.util.ServiceLoader; - -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.Module; - -/** - * Find {@link org.apache.felix.ipojo.manipulator.spi.Module}s using the {@link java.util.ServiceLoader} mechanisms. - * @since 1.11.2 - * @author Felix Project Team - */ -public class ServiceLoaderModuleProvider implements ModuleProvider { - - private final ClassLoader loader; - - public ServiceLoaderModuleProvider() { - this(ServiceLoaderModuleProvider.class); - } - - public ServiceLoaderModuleProvider(final Class type) { - this(type.getClassLoader()); - } - - public ServiceLoaderModuleProvider(ClassLoader loader) { - this.loader = loader; - } - - public Iterable findModules() { - return ServiceLoader.load(Module.class, loader); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java deleted file mode 100644 index b0f3ce1f23..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStore.java +++ /dev/null @@ -1,170 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.OutputStream; -import java.util.Collections; -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.store.mapper.FileSystemResourceMapper; -import org.apache.felix.ipojo.manipulator.store.mapper.IdentityResourceMapper; -import org.apache.felix.ipojo.manipulator.util.Metadatas; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@link DirectoryResourceStore} knows how to read and write - * resources from (to respectively) a File directory. - * - * @author Felix Project Team - */ -public class DirectoryResourceStore implements ResourceStore { - - /** - * Source directory where bytecode is read. - */ - private File m_source; - - /** - * Target directory. - */ - private File m_target; - - /** - * The builder of the updated manifest. - */ - private ManifestBuilder m_manifestBuilder; - - /** - * Original manifest to be updated. - */ - private Manifest m_manifest; - - /** - * Location of the manifest file to update. - */ - private File m_manifest_file; - - /** - * Resource Mapper. - */ - private ResourceMapper m_mapper = new FileSystemResourceMapper(new IdentityResourceMapper()); - - public DirectoryResourceStore(File source) { - this(source, source); - } - - public DirectoryResourceStore(File source, File target) { - m_source = source; - m_target = target; - } - - public void setResourceMapper(ResourceMapper mapper) { - m_mapper = new FileSystemResourceMapper(mapper); - } - - public void setManifestBuilder(ManifestBuilder manifestBuilder) { - m_manifestBuilder = manifestBuilder; - } - - public void setManifest(Manifest manifest) { - m_manifest = manifest; - } - - public void setManifestFile(File manifestFile){ - m_manifest_file = manifestFile; - } - - public byte[] read(String path) throws IOException { - File resource = new File(m_source, m_mapper.internalize(path)); - if (!resource.isFile()) { - throw new IOException("File '" + resource + "' is not found (for class " + path + ")."); - } - return Streams.readBytes(new FileInputStream(resource)); - } - - public void accept(ResourceVisitor visitor) { - traverseDirectory(m_source, visitor); - } - - private void traverseDirectory(File directory, ResourceVisitor visitor) { - for (File child : directory.listFiles()) { - if (child.isDirectory()) { - traverseDirectory(child, visitor); - } else { - visitor.visit(getRelativeName(child)); - } - } - } - - private String getRelativeName(File file) { - String relative = file.getPath().substring(m_source.getPath().length()); - return m_mapper.externalize(relative); - } - - public void open() throws IOException { - - // Update the manifest - Manifest updated = m_manifestBuilder.build(m_manifest); - - // Write it to disk - OutputStream os = new FileOutputStream(m_manifest_file); - try { - updated.write(os); - } finally { - Streams.close(os); - } - - } - - public void writeMetadata(Element metadata) { - m_manifestBuilder.addMetada(Collections.singletonList(metadata)); - m_manifestBuilder.addReferredPackage(Metadatas.findReferredPackages(metadata)); - } - - public void write(String resourcePath, byte[] bytecode) throws IOException { - - // Internalize the name - File resource = new File(m_target, m_mapper.internalize(resourcePath)); - - // Create intermediate directories if needed - if (!resource.getParentFile().exists()) { - resource.getParentFile().mkdirs(); - } - - FileOutputStream fos = new FileOutputStream(resource); - try { - fos.write(bytecode); - fos.flush(); - } finally { - Streams.close(fos); - } - } - - public void close() throws IOException { - // Nothing to do - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStore.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStore.java deleted file mode 100644 index 44d185a0a0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStore.java +++ /dev/null @@ -1,250 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.store.mapper.IdentityResourceMapper; -import org.apache.felix.ipojo.manipulator.util.Metadatas; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.*; -import java.net.URL; -import java.util.Collections; -import java.util.List; -import java.util.Map; -import java.util.TreeMap; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; -import java.util.jar.JarOutputStream; -import java.util.jar.Manifest; -import java.util.zip.ZipEntry; - -/** - * A {@link JarFileResourceStore} knows how to read and write - * resources from (to respectively) a Jar File. - * - * @author Felix Project Team - */ -public class JarFileResourceStore implements ResourceStore { - - /** - * Source Jar. - */ - private JarFile m_source; - - /** - * Target File. - */ - private File m_target; - - /** - * Modified resources. - */ - private Map m_content; - - /** - * Resource Mapper. - */ - private ResourceMapper m_mapper = new IdentityResourceMapper(); - - /** - * The builder of the updated manifest. - */ - private ManifestBuilder m_manifestBuilder; - - /** - * Original manifest to be updated. - */ - private Manifest m_manifest; - - private ClassLoader classLoader; - - /** - * Construct a {@link JarFileResourceStore} wrapping the given original bundle, - * and configured to output in the given target file. - * - * @param source original Bundle - * @param target File where the updated Bundle will be outputted - * @throws IOException if there is an error retrieving the Manifest from the original JarFile - */ - public JarFileResourceStore(JarFile source, File target) throws IOException { - m_source = source; - m_target = target; - - // TODO ensure File is not null and not an existing file/directory - this.m_target = target; - if (source != null) { - m_manifest = source.getManifest(); - } else { - m_manifest = new Manifest(); - } - m_content = new TreeMap(); - } - - public void setResourceMapper(ResourceMapper mapper) { - this.m_mapper = mapper; - } - - public void setManifestBuilder(ManifestBuilder manifestBuilder) { - this.m_manifestBuilder = manifestBuilder; - } - - public void setManifest(Manifest manifest) { - this.m_manifest = manifest; - } - - public void setClassLoader(ClassLoader classLoader) { - this.classLoader = classLoader; - } - - public byte[] read(String path) throws IOException { - ZipEntry entry = m_source.getEntry(getInternalPath(path)); - if (entry == null) { - // Not in the Jar file, trying from classpath - return tryToLoadFromClassloader(path); - } - return Streams.readBytes(m_source.getInputStream(entry)); - } - - private byte[] tryToLoadFromClassloader(String path) throws IOException { - if (classLoader != null) { - byte[] bytes = toByteArray(classLoader.getResource(path)); - if (bytes != null) { - return bytes; - } - } - throw new IOException("Class not found " + path + "."); - } - - public static byte[] toByteArray(URL url) throws IOException { - if (url == null) { - return null; - } - InputStream input = url.openStream(); - try { - return Streams.readBytes(input); - } finally { - Streams.close(input); - } - - } - - private String getInternalPath(String path) { - return m_mapper.internalize(path); - } - - public void accept(ResourceVisitor visitor) { - List entries = Collections.list(m_source.entries()); - for (JarEntry entry : entries) { - String name = entry.getName(); - if (!name.endsWith("/")) { - // Do not visit directories - visitor.visit(getExternalName(entry.getName())); - } - } - } - - private String getExternalName(String path) { - return m_mapper.externalize(path); - } - - public void open() throws IOException { - // Nothing to do - } - - public void writeMetadata(Element metadata) { - m_manifestBuilder.addMetada(Collections.singletonList(metadata)); - m_manifestBuilder.addReferredPackage(Metadatas.findReferredPackages(metadata)); - } - - public void write(String resourcePath, byte[] resource) throws IOException { - this.m_content.put(getInternalPath(resourcePath), resource); - } - - public void close() throws IOException { - - // Update the manifest - Manifest updated = m_manifestBuilder.build(m_manifest); - - // Create a new Jar file - FileOutputStream fos = new FileOutputStream(m_target); - JarOutputStream jos = new JarOutputStream(fos, updated); - - try { - // Copy classes and resources - List entries = Collections.list(m_source.entries()); - for (JarEntry entry : entries) { - - // Ignore some entries (MANIFEST, ...) - if (isIgnored(entry)) { - continue; - } - - if (isUpdated(entry)) { - // Write newer/updated resource (manipulated classes, ...) - - JarEntry je = new JarEntry(entry.getName()); - byte[] data = m_content.get(getInternalPath(entry.getName())); - jos.putNextEntry(je); - jos.write(data); - jos.closeEntry(); - } else { - // Copy the resource as-is - - jos.putNextEntry(entry); - InputStream is = m_source.getInputStream(entry); - try { - Streams.transfer(is, jos); - } finally { - Streams.close(is); - } - - jos.closeEntry(); - - } - } - } finally { - try { - m_source.close(); - } catch (IOException e) { - // Ignored - } - Streams.close(jos, fos); - - } - } - - private boolean isUpdated(JarEntry entry) { - // Check if that class was manipulated - if (entry.getName().endsWith(".class")) { - // Need to map this into an external+normalized path - String cleaned = getExternalName(entry.getName()); - return m_content.containsKey(cleaned); - } else { - return false; - } - } - - private boolean isIgnored(JarEntry entry) { - return "META-INF/MANIFEST.MF".equals(entry.getName()); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ManifestBuilder.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ManifestBuilder.java deleted file mode 100644 index a3b102668a..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ManifestBuilder.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -import java.util.Collection; -import java.util.Set; -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code ManifestBuilder} is ... - * - * @author Felix Project Team - */ -public interface ManifestBuilder { - /** - * Add all given package names in the referred packages list - * @param packageNames additional packages - */ - void addReferredPackage(Set packageNames); - - /** - * Add all given metadata - * @param metadatas additional metadata - */ - void addMetada(Collection metadatas); - - /** - * Update the given manifest. - * @param original original manifest to be modified - * @return modified manifest - */ - Manifest build(Manifest original); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ResourceMapper.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ResourceMapper.java deleted file mode 100644 index e5fe0fc898..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/ResourceMapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -/** - * A {@code ResourceMapper} maps resource name from a reference to another one. - * Example: In a WAB, class names are to be mapped into {@literal WEB-INF/classes/}. - * - * @author Felix Project Team - */ -public interface ResourceMapper { - - /** - * Adapts the normalized resource name into internal format. - * @param name original class names (as a resource) - * @return the transformed resource's name - */ - String internalize(String name); - - /** - * Provides a normalized resource name from the store's internal format. - * @param name resource name in internal format - * @return normalized resource name - */ - String externalize(String name); -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilder.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilder.java deleted file mode 100644 index 69be33aa33..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilder.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * 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.ipojo.manipulator.store.builder; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.TreeMap; -import java.util.jar.Attributes; -import java.util.jar.Manifest; - -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.QuotedTokenizer; -import org.apache.felix.ipojo.manipulator.render.MetadataRenderer; -import org.apache.felix.ipojo.manipulator.store.ManifestBuilder; -import org.apache.felix.ipojo.manipulator.util.Constants; -import org.apache.felix.ipojo.metadata.Element; - -/** - * A {@code DefaultManifestBuilder} handles the knowledge of iPOJO Manifest building. - * It is responsible to update a given Manifest with all gathered (additional) - * referenced packages (from the metadata.xml) + other iPOJO specific additions. - * - * @author Felix Project Team - */ -public class DefaultManifestBuilder implements ManifestBuilder { - - /** - * Referenced packages (by the composites). - */ - private List m_referredPackages = new ArrayList(); - - /** - * Computed metadatas from the bundle (XML files + annotations). - */ - private List m_metadata = new ArrayList(); - - /** - * The metadata renderer used to print Elements. - */ - private MetadataRenderer m_renderer; - - /** - * Add all given package names in the referred packages list - * @param packageNames additional packages - */ - public void addReferredPackage(Set packageNames) { - m_referredPackages.addAll(packageNames); - } - - /** - * Add all given metadata - * @param metadatas additional metadata - */ - public void addMetada(Collection metadatas) { - m_metadata.addAll(metadatas); - } - - public void setMetadataRenderer(MetadataRenderer renderer) { - m_renderer = renderer; - } - - /** - * Update the given manifest. - * @param original original manifest to be modified - * @return modified manifest - */ - public Manifest build(final Manifest original) { - Attributes att = original.getMainAttributes(); - - // Set the imports (add ipojo and handler namespaces - setImports(att); - // Add iPOJO-Component - setPOJOMetadata(att); - // Add iPOJO to the creators - setCreatedBy(att); - - return original; - } - - /** - * Add imports to the given manifest attribute list. This method add ipojo imports and handler imports (if needed). - * @param att : the manifest attribute list to modify. - */ - private void setImports(Attributes att) { - Map> imports = parseHeader(att.getValue("Import-Package")); - Map ver = new TreeMap(); - ver.put("version", Constants.getPackageImportClause()); - if (!imports.containsKey("org.apache.felix.ipojo")) { - imports.put("org.apache.felix.ipojo", ver); - } - if (!imports.containsKey("org.apache.felix.ipojo.architecture")) { - imports.put("org.apache.felix.ipojo.architecture", ver); - } - if (!imports.containsKey("org.osgi.service.cm")) { - Map verCM = new TreeMap(); - verCM.put("version", "1.2"); - imports.put("org.osgi.service.cm", verCM); - } - if (!imports.containsKey("org.osgi.service.log")) { - Map verCM = new TreeMap(); - verCM.put("version", "1.3"); - imports.put("org.osgi.service.log", verCM); - } - - // Add referred imports from the metadata - for (int i = 0; i < m_referredPackages.size(); i++) { - String pack = m_referredPackages.get(i); - imports.put(pack, new TreeMap()); - } - - // Write imports - att.putValue("Import-Package", printClauses(imports, "resolution:")); - } - - /** - * Add iPOJO-Components to the given manifest attribute list. This method add the - * {@literal iPOJO-Components} header and its value (according to the metadata) - * to the manifest. - * @param att the manifest attribute list to modify. - */ - private void setPOJOMetadata(Attributes att) { - StringBuilder meta = new StringBuilder(); - for (Element metadata : m_metadata) { - meta.append(m_renderer.render(metadata)); - } - if (meta.length() != 0) { - att.putValue("iPOJO-Components", meta.toString()); - } - } - - /** - * Set the create-by in the manifest. - * @param att : manifest attribute. - */ - private void setCreatedBy(Attributes att) { - String prev = att.getValue("Created-By"); - if (prev == null) { - att.putValue("Created-By", "iPOJO " + Constants.getVersion()); - } else { - if (prev.indexOf("iPOJO") == -1) { - // Avoid appending iPOJO several times - att.putValue("Created-By", prev + " & iPOJO " + Constants.getVersion()); - } - } - } - - /** - * Standard OSGi header parser. This parser can handle the format - *

-     * clauses ::= clause ( ',' clause ) +
-     * clause ::= name ( ';' name ) (';' key '=' value )
-     * 
- * This is mapped to a Map { name => Map { attr|directive => value } } - * - * @param value String to parse. - * @return parsed map. - */ - protected Map> parseHeader(String value) { - if (value == null || value.trim().length() == 0) { - return new HashMap>(); - } - - Map> result = new HashMap>(); - QuotedTokenizer qt = new QuotedTokenizer(value, ";=,"); - char del; - do { - boolean hadAttribute = false; - Map clause = new HashMap(); - List aliases = new ArrayList(); - aliases.add(qt.nextToken()); - del = qt.getSeparator(); - while (del == ';') { - String adname = qt.nextToken(); - if ((del = qt.getSeparator()) != '=') { - if (hadAttribute) { - throw new IllegalArgumentException("Header contains name field after attribute or directive: " + adname + " from " + value); - } - aliases.add(adname); - } else { - String advalue = qt.nextToken(); - clause.put(adname, advalue); - del = qt.getSeparator(); - hadAttribute = true; - } - } - for (Iterator i = aliases.iterator(); i.hasNext();) { - result.put(i.next(), clause); - } - } while (del == ','); - return result; - } - - /** - * Print a standard Map based OSGi header. - * - * @param exports : map { name => Map { attribute|directive => value } } - * @param allowedDirectives list of allowed directives. - * @return the clauses - */ - private String printClauses(Map> exports, String allowedDirectives) { - StringBuffer sb = new StringBuffer(); - String del = ""; - - for (Iterator i = exports.entrySet().iterator(); i.hasNext();) { - Map.Entry entry = (Map.Entry) i.next(); - String name = (String) entry.getKey(); - Map map = (Map) entry.getValue(); - sb.append(del); - sb.append(name); - - for (Iterator j = map.entrySet().iterator(); j.hasNext();) { - Map.Entry entry2 = (Map.Entry) j.next(); - String key = (String) entry2.getKey(); - - // Skip directives we do not recognize - if (key.endsWith(":") && allowedDirectives.indexOf(key) < 0) { - continue; - } - - String value = (String) entry2.getValue(); - sb.append(";"); - sb.append(key); - sb.append("="); - boolean dirty = value.indexOf(',') >= 0 || value.indexOf(';') >= 0; - if (dirty) { - sb.append("\""); - } - sb.append(value); - if (dirty) { - sb.append("\""); - } - } - del = ", "; - } - return sb.toString(); - } - - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapper.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapper.java deleted file mode 100644 index 9f7f3dc414..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapper.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import java.io.File; - -import org.apache.felix.ipojo.manipulator.store.ResourceMapper; - -/** - * ResourceMapper mapping from and to system specific path.. - * - * @author Felix Project Team - */ -public class FileSystemResourceMapper implements ResourceMapper { - - private ResourceMapper m_delegate; - private char m_separator; - - public FileSystemResourceMapper(ResourceMapper delegate) { - this(delegate, File.separatorChar); - } - - public FileSystemResourceMapper(ResourceMapper delegate, char separator) { - m_delegate = delegate; - m_separator = separator; - } - - public String internalize(String name) { - // transform as system path the result of the internalization operation - return systemPath(m_delegate.internalize(name)); - } - - public String externalize(String name) { - // normalize he path before giving it to the delegate mapper - return m_delegate.externalize(normalizePath(name)); - } - - /** - * Normalize the given path. Normalization simply replace any - * File separator (system dependant) with {@literal '/'}. - * @param path system path - * @return normalized path - */ - private String normalizePath(String path) { - return path.replace(m_separator, '/'); - } - - /** - * Return a system path from the given normalized path. - * @param path normalized path - * @return system path - */ - private String systemPath(String path) { - return path.replace('/', m_separator); - } - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapper.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapper.java deleted file mode 100644 index ab454fd09f..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapper.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import org.apache.felix.ipojo.manipulator.store.ResourceMapper; - -/** - * Identity mapper. - * - * @author Felix Project Team - */ -public class IdentityResourceMapper implements ResourceMapper { - public String internalize(String name) { - return name; - } - - public String externalize(String name) { - return name; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapper.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapper.java deleted file mode 100644 index c73b2353a1..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapper.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.store.ResourceMapper; - -/** - * A {@code WABResourceMapper} knows how to map resource names for a Web Application Bundle (WAB). - * - * @author Felix Project Team - */ -public class WABResourceMapper implements ResourceMapper { - - public static final String WEB_INF_CLASSES = "WEB-INF/classes/"; - - /** - * Store externalized names so that internalize can rebuild the good resource name. - */ - private List mappedNames = new ArrayList(); - - public String internalize(String name) { - if (mappedNames.contains(name)) { - return WEB_INF_CLASSES + name; - } - return name; - } - - public String externalize(String name) { - if (name.startsWith(WEB_INF_CLASSES)) { - String externalized = name.substring(WEB_INF_CLASSES.length()); - mappedNames.add(externalized); - return externalized; - } - // Leave the name unchanged - // (it's probably META-INF/** or WEB-INF/lib/**) - return name; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/ChainedAnnotationVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/ChainedAnnotationVisitor.java deleted file mode 100644 index 5fa4a81b10..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/ChainedAnnotationVisitor.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Opcodes; - -import java.util.ArrayList; -import java.util.List; - -/** -* User: guillaume -* Date: 10/07/13 -* Time: 16:43 -*/ -public class ChainedAnnotationVisitor extends AnnotationVisitor { - - private List m_visitors = new ArrayList(); - - public ChainedAnnotationVisitor() { - super(Opcodes.ASM9); - } - - public List getVisitors() { - return m_visitors; - } - - public void visit(final String name, final Object value) { - for (AnnotationVisitor visitor : m_visitors) { - visitor.visit(name, value); - } - } - - public void visitEnum(final String name, final String desc, final String value) { - for (AnnotationVisitor visitor : m_visitors) { - visitor.visitEnum(name, desc, value); - } - } - - public AnnotationVisitor visitAnnotation(final String name, final String desc) { - ChainedAnnotationVisitor chain = null; - for (AnnotationVisitor visitor : m_visitors) { - AnnotationVisitor child = visitor.visitAnnotation(name, desc); - if (child != null) { - if (chain == null) { - chain = new ChainedAnnotationVisitor(); - } - chain.getVisitors().add(child); - } - - } - return chain; - } - - public AnnotationVisitor visitArray(final String name) { - ChainedAnnotationVisitor chain = null; - for (AnnotationVisitor visitor : m_visitors) { - AnnotationVisitor child = visitor.visitArray(name); - if (child != null) { - if (chain == null) { - chain = new ChainedAnnotationVisitor(); - } - chain.getVisitors().add(child); - } - - } - return chain; - } - - public void visitEnd() { - for (AnnotationVisitor visitor : m_visitors) { - visitor.visitEnd(); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Classpath.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Classpath.java deleted file mode 100644 index ac5c3f122c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Classpath.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.*; - -/** - * An ordered list of classpath elements with set behaviour. A Classpath is immutable and thread safe. - * This class let retrieve an isolated classloader to load classes from a set of jars. - */ -public class Classpath implements Iterable { - - private final List unmodifiableElements; - - public static Classpath join(Classpath firstClasspath, Classpath secondClasspath) { - LinkedHashSet accumulated = new LinkedHashSet(); - if (firstClasspath != null) firstClasspath.addTo(accumulated); - if (secondClasspath != null) secondClasspath.addTo(accumulated); - return new Classpath(accumulated); - } - - - private void addTo(Collection c) { - c.addAll(unmodifiableElements); - } - - private Classpath() { - this.unmodifiableElements = Collections.emptyList(); - } - - - public Classpath(Classpath other, String additionalElement) { - ArrayList elems = new ArrayList(other.unmodifiableElements); - elems.add(additionalElement); - this.unmodifiableElements = Collections.unmodifiableList(elems); - } - - public Classpath(Iterable paths) { - List newCp = new ArrayList(); - for (String element : paths) { - newCp.add(element); - } - this.unmodifiableElements = Collections.unmodifiableList(newCp); - } - - public static Classpath emptyClasspath() { - return new Classpath(); - } - - public Classpath addClassPathElementUrl(String path) { - if (path == null) { - throw new IllegalArgumentException("Null is not a valid class path element url."); - } - return !unmodifiableElements.contains(path) ? new Classpath(this, path) : this; - } - - public List getClassPath() { - return unmodifiableElements; - } - - public List getAsUrlList() - throws MalformedURLException { - List urls = new ArrayList(); - for (String path : unmodifiableElements) { - File f = new File(path); - urls.add(f.toURI().toURL()); - } - return urls; - } - - public void writeToSystemProperty(String propertyName) { - StringBuilder sb = new StringBuilder(); - for (String element : unmodifiableElements) { - sb.append(element).append(File.pathSeparatorChar); - } - System.setProperty(propertyName, sb.toString()); - } - - public boolean equals(Object o) { - if (this == o) { - return true; - } - if (o == null || getClass() != o.getClass()) { - return false; - } - - Classpath classpath = (Classpath) o; - - return !(unmodifiableElements - != null ? !unmodifiableElements.equals(classpath.unmodifiableElements) : classpath.unmodifiableElements != null); - - } - - public ClassLoader createClassLoader(ClassLoader parent, boolean childDelegation) - throws RuntimeException { - try { - List urls = getAsUrlList(); - IsolatedClassLoader classLoader = new IsolatedClassLoader(parent, childDelegation); - for (Object url1 : urls) { - URL url = (URL) url1; - classLoader.addURL(url); - } - return classLoader; - } catch (MalformedURLException e) { - throw new RuntimeException("When creating classloader", e); - } - } - - public ClassLoader createClassLoader() - throws RuntimeException { - try { - List urls = getAsUrlList(); - IsolatedClassLoader classLoader = new IsolatedClassLoader(); - for (Object url1 : urls) { - URL url = (URL) url1; - classLoader.addURL(url); - } - return classLoader; - } catch (MalformedURLException e) { - throw new RuntimeException("When creating classloader", e); - } - } - - - public int hashCode() { - return unmodifiableElements != null ? unmodifiableElements.hashCode() : 0; - } - - public String getLogMessage(String descriptor) { - StringBuilder result = new StringBuilder(); - result.append(descriptor).append(" classpath:"); - for (String element : unmodifiableElements) { - result.append(" ").append(element); - } - return result.toString(); - } - - public String getCompactLogMessage(String descriptor) { - StringBuilder result = new StringBuilder(); - result.append(descriptor).append(" classpath:"); - for (String element : unmodifiableElements) { - result.append(" "); - if (element != null) { - int pos = element.lastIndexOf(File.separatorChar); - if (pos >= 0) { - result.append(element.substring(pos + 1)); - } else { - result.append(element); - } - - } else { - result.append(element); - } - } - return result.toString(); - } - - public Iterator iterator() { - return unmodifiableElements.iterator(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Collections5.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Collections5.java deleted file mode 100644 index 84f5084d49..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Collections5.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.lang.reflect.Array; - -/** - * {@code Collections5} is a static collection of methods being part of the Java6 Collections class. - * - * @author Felix Project Team - */ -public class Collections5 { - - /** - * Copies the specified array, truncating or padding with nulls (if necessary) - * so the copy has the specified length. For all indices that are - * valid in both the original array and the copy, the two arrays will - * contain identical values. For any indices that are valid in the - * copy but not the original, the copy will contain null. - * Such indices will exist if and only if the specified length - * is greater than that of the original array. - * The resulting array is of exactly the same class as the original array. - * - * @param original the array to be copied - * @param newLength the length of the copy to be returned - * @return a copy of the original array, truncated or padded with nulls - * to obtain the specified length - * @throws NegativeArraySizeException if newLength is negative - * @throws NullPointerException if original is null - * @since 1.6 - */ - @SuppressWarnings("unchecked") - public static T[] copyOf(T[] original, int newLength) { - return (T[]) copyOf(original, newLength, original.getClass()); - } - - /** - * Copies the specified array, truncating or padding with nulls (if necessary) - * so the copy has the specified length. For all indices that are - * valid in both the original array and the copy, the two arrays will - * contain identical values. For any indices that are valid in the - * copy but not the original, the copy will contain null. - * Such indices will exist if and only if the specified length - * is greater than that of the original array. - * The resulting array is of the class newType. - * - * @param original the array to be copied - * @param newLength the length of the copy to be returned - * @param newType the class of the copy to be returned - * @return a copy of the original array, truncated or padded with nulls - * to obtain the specified length - * @throws NegativeArraySizeException if newLength is negative - * @throws NullPointerException if original is null - * @throws ArrayStoreException if an element copied from - * original is not of a runtime type that can be stored in - * an array of class newType - * @since 1.6 - */ - public static T[] copyOf(U[] original, int newLength, Class newType) { - @SuppressWarnings("unchecked") - T[] copy = ((Object) newType == (Object) Object[].class) - ? (T[]) new Object[newLength] - : (T[]) Array.newInstance(newType.getComponentType(), newLength); - System.arraycopy(original, 0, copy, 0, - Math.min(original.length, newLength)); - return copy; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Constants.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Constants.java deleted file mode 100644 index 5f897b35df..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Constants.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.io.IOException; -import java.io.InputStream; -import java.util.Properties; - -/** - * A static class to access the constant written during packaging. - */ -public class Constants { - - public static String CONSTANTS_PATH = "META-INF/constants.properties"; - public static String MANIPULATOR_VERSION = "manipulator.version"; - public static String IPOJO_IMPORT_PACKAGES = "ipojo.import.packages"; - - private static Properties m_properties; - - static { - load(); - } - - private static void load() { - m_properties = new Properties(); - InputStream is = Constants.class.getClassLoader().getResourceAsStream(CONSTANTS_PATH); - try { - m_properties.load(is); - is.close(); - } catch (IOException e) { - throw new IllegalStateException("Cannot load the 'constants' file"); - } - } - - - public static String getVersion() { - return m_properties.getProperty(MANIPULATOR_VERSION); - } - - public static String getPackageImportClause() { - return m_properties.getProperty(IPOJO_IMPORT_PACKAGES); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/IsolatedClassLoader.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/IsolatedClassLoader.java deleted file mode 100644 index f5a35f1c17..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/IsolatedClassLoader.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.net.URL; -import java.net.URLClassLoader; -import java.util.HashSet; -import java.util.Set; - -/** - * A classloader used by the {@link org.apache.felix.ipojo.manipulator.util.Classpath}. - */ -public class IsolatedClassLoader - extends URLClassLoader { - private final ClassLoader parent = ClassLoader.getSystemClassLoader(); - - private final Set urls = new HashSet(); - - private boolean childDelegation = true; - - private static final URL[] EMPTY_URL_ARRAY = new URL[0]; - - public IsolatedClassLoader(ClassLoader parent, boolean childDelegation) { - super(EMPTY_URL_ARRAY, parent); - this.childDelegation = childDelegation; - } - - public IsolatedClassLoader() { - super(EMPTY_URL_ARRAY, ClassLoader.getSystemClassLoader()); - this.childDelegation = true; - } - - public void addURL(URL url) { - // avoid duplicates - if (!urls.contains(url)) { - super.addURL(url); - urls.add(url); - } - } - - public synchronized Class loadClass(String name) - throws ClassNotFoundException { - Class c; - if (childDelegation) { - c = findLoadedClass(name); - - ClassNotFoundException ex = null; - - if (c == null) { - try { - c = findClass(name); - } catch (ClassNotFoundException e) { - ex = e; - if (parent != null) { - c = parent.loadClass(name); - } - } - } - - if (c == null) { - throw ex; - } - } else { - c = super.loadClass(name); - } - - return c; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Metadatas.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Metadatas.java deleted file mode 100644 index 5adfb729d0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Metadatas.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.util.HashSet; -import java.util.List; -import java.util.Set; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * {@code Streams} is a utility class that helps to manipulate streams. - * - * @author Felix Project Team - */ -public class Metadatas { - - /** - * Utility class: no public constructor - */ - private Metadatas() {} - - /** - * Return the {@literal classname} attribute value. - * @param meta metadata to be explored - * @return the {@literal classname} attribute value or {@literal null} if - * the attribute does not exists. - */ - public static String getComponentType(Element meta) { - return meta.getAttribute("classname"); - } - - /** - * Looks for 'field' attribute in the given metadata. - * @param fields discovered fields (accumulator) - * @param metadata metadata to inspect - */ - public static void findFields(List fields, Element metadata) { - String field = metadata.getAttribute("field"); - if (field != null && !fields.contains(field)) { - fields.add(field); - } - for (Element element : metadata.getElements()) { - findFields(fields, element); - } - } - - /** - * Get packages referenced by component. - * @param metadata Element base for the search - * @return the Set of referenced packages. - */ - public static Set findReferredPackages(Element metadata) { - - Set packages = new HashSet(); - Set specifications = findAttributes(metadata, "specification"); - - // Extract the package name from each specification (aka interface) - for (String specification : specifications) { - String name = getPackageName(specification); - if (name != null) { - packages.add(name); - } - } - - return packages; - } - - private static String getPackageName(String specification) { - int last = specification.lastIndexOf('.'); - if (last != -1) { - return specification.substring(0, last); - } - return null; - } - - /** - * Find all the values of the specified attribute in the given element. - * @param metadata Element to be traversed - * @param attributeName Search attribute name - * @return Set of attribute values (no duplicate). - */ - public static Set findAttributes(Element metadata, String attributeName) { - Set referred = new HashSet(); - - // Search in the given element - if (metadata.containsAttribute(attributeName)) { - referred.add(metadata.getAttribute(attributeName)); - } - - // Search in children - for (Element elem : metadata.getElements()) { - Set found = findAttributes(elem, attributeName); - referred.addAll(found); - } - - // Return all found values - return referred; - } - - - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Streams.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Streams.java deleted file mode 100644 index 6c5ea4fe7d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Streams.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import java.io.ByteArrayOutputStream; -import java.io.Closeable; -import java.io.IOException; -import java.io.InputStream; -import java.io.OutputStream; - -/** - * {@code Streams} is a utility class that helps to manipulate streams. - * - * @author Felix Project Team - */ -public class Streams { - - private static final int ONE_HUNDRED_KB = 102400; - - private static final int FOUR_KB = 4096; - - /** - * Utility class: no public constructor - */ - private Streams() {} - - /** - * Close all the streams - * @param streams Streams to be closed - */ - public static void close(Closeable... streams) { - for (Closeable stream : streams) { - if (stream != null) { - try { - stream.close(); - } catch (IOException e) { - // Ignored - } - } - } - } - - /** - * Transfer the given {@link InputStream} content in the given {@link OutputStream}. - * @param is input - * @param os output - * @throws IOException if there is a transfer error. - */ - public static void transfer(InputStream is, OutputStream os) throws IOException { - int read; - byte[] buffer = new byte[FOUR_KB]; - while ((read = is.read(buffer)) != -1) { - os.write(buffer, 0, read); - } - } - - /** - * Read the content of the given InputStream as a byte array. - * Notice that this method automatically closes the InputStream - * @param is source - * @return the content of the InputStream - * @throws IOException if stream's content cannot be read/written - */ - public static byte[] readBytes(final InputStream is) throws IOException { - try { - ByteArrayOutputStream buffer = new ByteArrayOutputStream(); - - int read; - byte[] data = new byte[ONE_HUNDRED_KB]; - - while ((read = is.read(data, 0, data.length)) != -1) { - buffer.write(data, 0, read); - } - - buffer.flush(); - - return buffer.toByteArray(); - } finally { - close(is); - } - - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Strings.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Strings.java deleted file mode 100644 index 5ae8515f3a..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/util/Strings.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - - -/** - * {@code Strings} is a utility class that helps to manipulate String. - * - * @author Felix Project Team - */ -public class Strings { - - /** - * Utility class: no public constructor - */ - private Strings() {} - - /** - * Transform a FQN of a class (format {@literal org.objectweb.asm.Visitor}) into - * a normalized resource name ({@literal org/objectweb/asm/Visitor.class}). - * @param classname FQN of a class to be transformed - * @return resource name - */ - public static String asResourcePath(String classname) { - return classname.replace('.', '/').concat(".class"); - } - - /** - * Transform a normalized resource path ({@literal org/objectweb/asm/Visitor.class}) into - * a fully qualified class name (format {@literal org.objectweb.asm.Visitor}). - * @param path normalized resource path to be transformed - * @return class name - */ - public static String asClassName(String path) { - String transformed = path.replace('/', '.'); - return transformed.substring(0, transformed.length() - ".class".length()); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationAdapter.java deleted file mode 100644 index 24700e9820..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.manipulator.ManipulationVisitor; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Empty ManipulationVisitor visitor. - * It is useful to extends this class to keep a working visitor chain. - * - * @author Felix Project Team - */ -public class ManipulationAdapter implements ManipulationVisitor { - - private ManipulationVisitor m_delegate; - - public ManipulationAdapter(ManipulationVisitor delegate) { - m_delegate = delegate; - } - - public ManipulationResultVisitor visitManipulationResult(Element metadata) { - return new ManipulationResultAdapter(m_delegate.visitManipulationResult(metadata)); - } - - public void visitMetadata(Element metadata) { - m_delegate.visitMetadata(metadata); - } - - public void visitEnd() { - m_delegate.visitEnd(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationResultAdapter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationResultAdapter.java deleted file mode 100644 index d1d120e7b6..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/ManipulationResultAdapter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Empty ManipulationResultVisitor visitor. - * It is useful to extends this class to keep a working visitor chain. - * - * @author Felix Project Team - */ -public class ManipulationResultAdapter implements ManipulationResultVisitor { - - private ManipulationResultVisitor m_delegate; - - public ManipulationResultAdapter(ManipulationResultVisitor delegate) { - m_delegate = delegate; - } - - public void visitClassStructure(Element structure) { - m_delegate.visitClassStructure(structure); - } - - public void visitManipulatedResource(String type, byte[] resource) { - m_delegate.visitManipulatedResource(type, resource); - } - - public void visitEnd() { - m_delegate.visitEnd(); - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitor.java deleted file mode 100644 index 44002f8998..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitor.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.check; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.util.Metadatas; -import org.apache.felix.ipojo.manipulator.visitor.ManipulationResultAdapter; -import org.apache.felix.ipojo.metadata.Element; - -import java.util.ArrayList; -import java.util.List; - -/** - * This visitor checks that field referenced in the metadata are present in the bytecode. - * - * @author Felix Project Team - */ -public class CheckFieldConsistencyResultVisitor extends ManipulationResultAdapter { - - /** - * Component's metadata. - */ - private Element m_metadata; - - /** - * Reporter for errors. - */ - private Reporter m_reporter; - - public CheckFieldConsistencyResultVisitor(ManipulationResultVisitor visitor) { - super(visitor); - } - - public void setMetadata(Element metadata) { - this.m_metadata = metadata; - } - - public void setReporter(Reporter reporter) { - this.m_reporter = reporter; - } - - public void visitClassStructure(Element structure) { - - List fieldsInStructure = new ArrayList(); - collectStructuralFields(fieldsInStructure, structure); - - List fieldsInMetadata = new ArrayList(); - Metadatas.findFields(fieldsInMetadata, m_metadata); - - checkReferredFieldsAreInStructure(fieldsInMetadata, fieldsInStructure); - - // Do this at the end because the writer insert the manipulation - // metadata inside the component Element - // So to avoid duplicate find, we need to execute this code at the end - super.visitClassStructure(structure); - - } - - private void collectStructuralFields(List fieldsInStructure, Element structure) { - Element[] fields = structure.getElements("field"); - if (fields != null) { - for (Element field : fields) { - fieldsInStructure.add(field.getAttribute("name")); - } - } - } - - /** - * Detects missing fields. - * If a referenced field does not exist in the class - * the method throws an error breaking the build process. - * @param fieldsInMetadata - * @param fieldsInStructure - */ - private void checkReferredFieldsAreInStructure(List fieldsInMetadata, List fieldsInStructure) { - // Then, try to find each referred field in the given field map - for (String fieldName : fieldsInMetadata) { - if (!fieldsInStructure.contains(fieldName)) { - m_reporter.error("The field " + fieldName + " is referenced in the " - + "metadata but does not exist in the " + Metadatas.getComponentType(m_metadata) - + " class"); - } - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyVisitor.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyVisitor.java deleted file mode 100644 index 22fe44895d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyVisitor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.check; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.manipulator.ManipulationVisitor; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.visitor.ManipulationAdapter; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Execute field verification. - * - * @author Felix Project Team - */ -public class CheckFieldConsistencyVisitor extends ManipulationAdapter { - - private Reporter m_reporter; - - public CheckFieldConsistencyVisitor(ManipulationVisitor visitor) { - super(visitor); - } - - public void setReporter(Reporter reporter) { - this.m_reporter = reporter; - } - - public ManipulationResultVisitor visitManipulationResult(Element metadata) { - CheckFieldConsistencyResultVisitor rv = new CheckFieldConsistencyResultVisitor(super.visitManipulationResult(metadata)); - rv.setMetadata(metadata); - rv.setReporter(m_reporter); - return rv; - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriter.java deleted file mode 100644 index d962d91e1a..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriter.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.writer; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.manipulator.ManipulationVisitor; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -/** - * Write manipulation result in the backend (store). - * - * @author Felix Project Team - */ -public class ManipulatedResourcesWriter implements ManipulationVisitor { - - private ResourceStore m_resourceStore; - private Reporter m_reporter; - private List m_writers; - - public ManipulatedResourcesWriter() { - m_writers = new ArrayList(); - } - - public void setResourceStore(ResourceStore resourceStore) { - m_resourceStore = resourceStore; - } - - public void setReporter(Reporter reporter) { - m_reporter = reporter; - } - - public ManipulationResultVisitor visitManipulationResult(Element metadata) { - m_resourceStore.writeMetadata(metadata); - ManipulatedResultWriter writer = new ManipulatedResultWriter(metadata); - m_writers.add(writer); - return writer; - } - - public void visitMetadata(Element metadata) { - m_resourceStore.writeMetadata(metadata); - } - - public void visitEnd() { - - try { - m_resourceStore.open(); - for (ManipulatedResultWriter writer : m_writers) { - for (Map.Entry entry : writer.getResources().entrySet()) { - m_resourceStore.write(entry.getKey(), entry.getValue()); - } - } - m_resourceStore.close(); - } catch (IOException e) { - m_reporter.error("Cannot store manipulation result: " + e.getMessage()); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriter.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriter.java deleted file mode 100644 index ad540834a3..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriter.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.writer; - -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.metadata.Element; - -import java.util.HashMap; -import java.util.Map; - -/** - * Gather manipulated bytecode. - * - * @author Felix Project Team - */ -public class ManipulatedResultWriter implements ManipulationResultVisitor { - - private Map m_resources; - - private Element m_component; - - public ManipulatedResultWriter(Element component) { - m_component = component; - m_resources = new HashMap(); - } - - public void visitClassStructure(Element structure) { - // Insert the manipulation structure in the component's metadata - m_component.addElement(structure); - } - - public void visitManipulatedResource(String type, byte[] resource) { - m_resources.put(type, resource); - } - - public void visitEnd() { - // nothing to do - } - - public Map getResources() { - return m_resources; - } -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java deleted file mode 100644 index b194882f76..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/ParseException.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.xml.parser; - -/** - * Exceptions thrown by parsers. - * @author Felix Project Team - */ -public class ParseException extends Exception { - - /** - * serialVersionUID. - */ - private static final long serialVersionUID = 1L; - - /** - * Parsing error. - * @param msg : the error message. - */ - public ParseException(String msg) { - super(msg); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/SchemaResolver.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/SchemaResolver.java deleted file mode 100644 index d89e8c73b0..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/SchemaResolver.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.xml.parser; - -import java.io.IOException; -import java.net.URL; - -import org.xml.sax.EntityResolver; -import org.xml.sax.InputSource; -import org.xml.sax.SAXException; - - -/** - * Entity Resolver loading embedded XML Schemas. - * This resolver avoid using a network connection to get schemas as they - * are loaded from the manipulator jar file. - * @author Felix Project Team - */ -public class SchemaResolver implements EntityResolver { - - /** - * Directory where embedded schemas are copied. - */ - public static final String XSD_PATH = "xsd"; - - /** - * Resolves systemIds to use embedded schemas. The schemas are loaded from - * the {@link SchemaResolver#XSD_PATH} directory with the current classloader. - * @param publicId the publicId - * @param systemId the systemId (Schema URL) - * @return the InputSource to load the schemas or null if the schema - * cannot be loaded (not embedded) - * @throws SAXException cannot happen - * @throws IOException when the embedded resource cannot be read correctly - * @see org.xml.sax.EntityResolver#resolveEntity(java.lang.String, java.lang.String) - */ - public InputSource resolveEntity(String publicId, String systemId) - throws SAXException, IOException { - - URL url = getURL(systemId); - if (url == null) { - // Cannot found the resource - return null; - } else { - return new InputSource(url.openStream()); - } - - } - - /** - * Computes the local URL of the given system Id. - * This URL is computed by trying to load the resource from - * the current classloader. First, the last fragment (file name) of the system id - * url is extracted and the file is loaded from the {@link SchemaResolver#XSD_PATH} - * directory ('xsd/extracted') - * @param id the systemId to load - * @return the URL to the resources or null if the resource cannot be found. - */ - private URL getURL(String id) { - int index = id.lastIndexOf('/'); - String fragment = id.substring(index); - return this.getClass().getClassLoader().getResource(XSD_PATH + fragment); - } - -} diff --git a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java b/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java deleted file mode 100644 index 597b094fae..0000000000 --- a/ipojo/manipulator/manipulator/src/main/java/org/apache/felix/ipojo/xml/parser/XMLMetadataParser.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.ipojo.xml.parser; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.xml.sax.Attributes; -import org.xml.sax.ContentHandler; -import org.xml.sax.ErrorHandler; -import org.xml.sax.Locator; -import org.xml.sax.SAXException; -import org.xml.sax.SAXParseException; - -/** - * XML Metadata parser. - * - * @author Felix Project Team - */ -public class XMLMetadataParser implements ContentHandler, ErrorHandler { - - /** - * Element of the metadata. - */ - private Element[] m_elements = new Element[0]; - - /** - * Get parsed metadata. - * The document must be parsed before calling this method. - * @return : all the metadata. - * @throws ParseException : occurs if an error occurs during the parsing. - */ - public Element[] getMetadata() throws ParseException { - return m_elements[0].getElements(); - } - - - /** - * Characters. - * @param ch : character - * @param start : start - * @param length : length - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#characters(char[], int, int) - */ - public void characters(char[] ch, int start, int length) throws SAXException { - // NOTHING TO DO - - } - - - /** - * End the document. - * @throws SAXException : can never occrus. - * @see org.xml.sax.ContentHandler#endDocument() - */ - public void endDocument() throws SAXException { - } - - - /** - * End of an element. - * @param namespaceURI : element namespace - * @param localName : local name - * @param qName : qualified name - * @throws SAXException : occurs when the element is malformed - * @see org.xml.sax.ContentHandler#endElement(java.lang.String, java.lang.String, java.lang.String) - */ - public void endElement(String namespaceURI, String localName, String qName) throws SAXException { - // Get the last element of the list - Element lastElement = removeLastElement(); - - // The name is consistent - // Add this element last element with if it is not the root - if (m_elements.length != 0) { - Element newQueue = m_elements[m_elements.length - 1]; - newQueue.addElement(lastElement); - } else { - // It is the last element - addElement(lastElement); - } - - } - - /** - * End prefix mapping. - * @param prefix : ended prefix - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#endPrefixMapping(java.lang.String) - */ - public void endPrefixMapping(String prefix) throws SAXException { - // NOTHING TO DO - } - - - /** - * Ignore whitespace. - * @param ch : character - * @param start : start - * @param length : length - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#ignorableWhitespace(char[], int, int) - */ - public void ignorableWhitespace(char[] ch, int start, int length) throws SAXException { - // NOTHING TO DO - } - - /** - * Process an instruction. - * @param target : target - * @param data : data - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#processingInstruction(java.lang.String, java.lang.String) - */ - public void processingInstruction(String target, String data) throws SAXException { - // DO NOTHING - } - - /** - * Set Document locator. - * @param locator : new locator. - * @see org.xml.sax.ContentHandler#setDocumentLocator(org.xml.sax.Locator) - */ - public void setDocumentLocator(Locator locator) { - // NOTHING TO DO - - } - - /** - * Skipped entity. - * @param name : name. - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#skippedEntity(java.lang.String) - */ - public void skippedEntity(String name) throws SAXException { - // NOTHING TO DO - - } - - /** - * Start a document. - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#startDocument() - */ - public void startDocument() throws SAXException { - } - - - /** - * Start an element. - * @param namespaceURI : element namespace. - * @param localName : local element. - * @param qName : qualified name. - * @param atts : attribute - * @throws SAXException : occurs if the element cannot be parsed correctly. - * @see org.xml.sax.ContentHandler#startElement(java.lang.String, java.lang.String, java.lang.String, org.xml.sax.Attributes) - */ - public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException { - String namespace = namespaceURI; - if (namespaceURI != null - && (namespaceURI.equalsIgnoreCase("org.apache.felix.ipojo") || namespaceURI.equalsIgnoreCase("org.apache.felix.ipojo.composite"))) { - namespace = null; // Remove the 'org.apache.felix.ipojo' namespace - } - - Element elem = new Element(localName, namespace); - for (int i = 0; i < atts.getLength(); i++) { - String name = (String) atts.getLocalName(i); - String ns = (String) atts.getURI(i); - String value = (String) atts.getValue(i); - Attribute att = new Attribute(name, ns, value); - elem.addAttribute(att); - } - - addElement(elem); - - } - - /** - * Start a prefix mapping. - * @param prefix : prefix. - * @param uri : uri. - * @throws SAXException : can never occurs. - * @see org.xml.sax.ContentHandler#startPrefixMapping(java.lang.String, java.lang.String) - */ - public void startPrefixMapping(String prefix, String uri) throws SAXException { - // NOTHING TO DO - - } - - /** - * Add an element. - * @param elem : the element to add - */ - private void addElement(Element elem) { - for (int i = 0; (m_elements != null) && (i < m_elements.length); i++) { - if (m_elements[i] == elem) { - return; - } - } - - if (m_elements != null) { - Element[] newElementsList = new Element[m_elements.length + 1]; - System.arraycopy(m_elements, 0, newElementsList, 0, m_elements.length); - newElementsList[m_elements.length] = elem; - m_elements = newElementsList; - } else { - m_elements = new Element[] { elem }; - } - } - - /** - * Remove an element. - * @return : the removed element. - */ - private Element removeLastElement() { - int idx; - idx = m_elements.length - 1; - Element last = m_elements[idx]; - if (idx >= 0) { - if ((m_elements.length - 1) == 0) { - // It is the last element of the list; - m_elements = new Element[0]; - } else { - // Remove the last element of the list : - Element[] newElementsList = new Element[m_elements.length - 1]; - System.arraycopy(m_elements, 0, newElementsList, 0, idx); - m_elements = newElementsList; - } - } - return last; - } - - - /** - * An error occurs during the XML-Schema checking. - * This method propagates the error except if the error concerns - * no XML-Schemas are used (cvc-elt.1). - * @param saxparseexception the checking error - * @throws SAXException the propagated exception - * @see org.xml.sax.ErrorHandler#error(org.xml.sax.SAXParseException) - */ - public void error(SAXParseException saxparseexception) throws SAXException { - if (saxparseexception.getMessage().contains("cvc-elt.1")) { - return; // Do not throw an exception when no schema defined. - } - throw saxparseexception; - } - - - /** - * A fatal error occurs during the XML-Schema checking. - * This method always propagates the error. - * @param saxparseexception the checking error - * @throws SAXException the propagated exception - * @see org.xml.sax.ErrorHandler#fatalError(SAXParseException) - */ - public void fatalError(SAXParseException saxparseexception) - throws SAXException { - //TODO use reporter - - System.err.println("Fatal error during XML-Schema parsing : " + saxparseexception); - throw saxparseexception; - } - - /** - * A warning was detected during the XML-Schema checking. - * This method always propagate the warning message to - * {@link System#out}. - * @param saxparseexception the checking error - * @throws SAXException nothing. - * @see org.xml.sax.ErrorHandler#warning(SAXParseException) - */ - public void warning(SAXParseException saxparseexception) - throws SAXException { - // TODO use reporter - System.err.println("Warning : an error was detected in the metadata file : " + saxparseexception); - - } -} diff --git a/ipojo/manipulator/manipulator/src/main/resources/META-INF/constants.properties b/ipojo/manipulator/manipulator/src/main/resources/META-INF/constants.properties deleted file mode 100644 index d070319aec..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/META-INF/constants.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -# This file define the different constant we use in the manipulator. This file is filtered by Maven. -manipulator.version=${project.version} -ipojo.import.packages=${ipojo.import.packages} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module b/ipojo/manipulator/manipulator/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module deleted file mode 100644 index d3b15f9e2e..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/META-INF/services/org.apache.felix.ipojo.manipulator.spi.Module +++ /dev/null @@ -1 +0,0 @@ -org.apache.felix.ipojo.manipulator.metadata.annotation.module.DefaultBindingModule \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/composite.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/composite.xsd deleted file mode 100644 index f127dddf8d..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/composite.xsd +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/core.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/core.xsd deleted file mode 100644 index 3c729c9e05..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/core.xsd +++ /dev/null @@ -1,704 +0,0 @@ - - - - iPOJO Core XML-Schema. This grammars models iPOJO descriptor using core - features. It provides several extensibility mechanism in order to compose this schema with - external handlers and other component implementation type such as - compositions. - - - - - - iPOJO top level element. - - - - - The handler declarations. - - - - - The instance declarations. - - - - - The component type declarations. - - - - - - - - - Description of the handler. - - - - - - - - - The implementation class of the handler. The specified class must - implement (direcly or not) the "org.apache.felix.ipojo.Handler" - interface. - - - - - - The name of the handler. - - - - - The XML namespace of the handler. - - - - - Enables or disables the architecture exposition. By default, the - architecture is not exposed. This allows handler introspection. - - - - - - The start level of the handler. - - - - - - - - Describes an instance of a component. - - - - - - - The instance props. - - - - - - The name of the instance component type. - - - - - The (unique) name of the instance. - - - - - The version of the factory to use. - - - - - - - - Defines a property of an instance configuration. - - - - - - - Name of the property. Can be optional if a property is inside a structure. - The 'instance.name' property has a special semantic as it will be used as the instance - name. - - - - - - Value of the property. Can be null for property containing other - props. - - - - - - Type of the property, used to create the adequate object. Supported values - are list, array, dictionary and map. - - - - - - - - Declares an atomic (i.e. primitive) component type. - - - - - Describes the method(s) to invoke when the component's state - changes. - - - - - - Indicates the component provided service(s). By default, all implemented - interfaces are published. - - - - - - Indicates the service requirements of the component. - - - - - Describes the properties of the component. - - - - - Lifecycle controller for this component. - - - - - - - Specifies the name of the component type. This name is used to identify - the factory attached to this type. If not specified, the factory name is the - implementation class name. - - - - - - Determines if the component type is public or private. A public factory - (default) can be used from any bundles. - - - - - - Specifies the implementation class of the component - type. - - - - - - Enables or disables the architecture exposition. By default, the - architecture is exposed. This allows instance introspection. - - - - - - Creates the object of the component implementation type as soon as the - component instance becomes valid. The default value is "true" if the component doesn't - provide any service, "false" otherwise. - - - - - - Factory method called to create POJO objects instead of the constructor. - The specified method must be a static method of the implementation class returning an - instance of this implementation class. The factory method can receive the bundle context - in argument. - - - - - - Set the version of this component type - - - - - - Description of component services requirements. - - - - - - - Service requirement method invocation description. Here can be - specified a bind method called when a service appears and an unbind method called - when a service disappears. - - - - - - - - The interface describing the required service type. This attribute is - needed only when using aggregate dependencies with field injection and when the type - of this field is a list, vector, collection and set. This attribute is deprecated, use - 'specification'. - - - - - - - The name of the field representing the service dependency in the - implementation class. - - - - - - - Enable or disable the Nullable pattern on optional service - dependencies. By default, Nullable pattern is enabled. If disabled, iPOJO will inject - null instead of a Nullable object. - - - - - - - Specifies the default implementation class for an optional service - dependency. If no providers are found, iPOJO creates an instance of the - default-implementation (nullary constructor) and injects it. The given class must - implement the required service interface. - - - - - - - Specifies the exception to throw for an optional service - dependency. If no providers are found, iPOJO creates an instance of the - exception (with either no parameter or a String parameter as constructor argument), and - throws it. The given class name must extends RuntimeException. - - - - - - - Specifies the timeout after which the 'no service policy' is executed - (nullable, null, empty collection, exception...). The value is the time in millisecond to - wait. -1 is used to indicate an infinite wait, 0 executes the no service policy - immediately. - - - - - - - Specific service provider. The dependency can only be fulfilled by the - component with the matching name, or by the service with a matching - PID. - - - - - - - Enables or Disable the proxy injection (on field - injection) - - - - - - - - - - - - - - - - - - - - Dependency callbacks are used to receive notification when service providers - arrive and leave. - - - - - Method to call - - - - - Type of callback (bind, unbind, or updated). Bind means that the method - will be called when a provider arrives. Unbind means that the method will be called when a - provider leaves. Updated means that a service was modified but is still valid for the - service dependency. - - - - - - - - - - - - - - Lifecycle Callback. Allows a POJO to be notified when the instance becomes - valid or invalid. - - - - - Specifies the method to call on the transition. - - - - - Specifies the transition when the callback needs to be - invoked. - - - - - Lifecycle transition state. "validate" means that the component's - instance was invalid and becomes valid, "invalidate" means that the component's intance - was valid and becomes invalid. - - - - - - - - - - - - Allows injecting the OSGi bundle context into the component. - - - - - Specifies the method receiving the bundle context. - - - - - Specifies the field receiving the bundle context. - - - - - Specifies the index of the parameter (0-based) receiving the bundle - context. - - - - - - Specifies the context source. - - - - - iPOJO supports two bundle context 'sources': component and instance. Component - is the bundle context of the bundle declaring the component, while instance is the bundle - context of the bundle declaring the instance. Obviously, they are the same when the instance - is declared in the same bundle as the component. By default, it uses 'component'. - - - - - - - - - - - - - Provided service(s) description. - - - - - - List of service specific props. - - - - - Service Controller impacting the current provided - service - - - - - - - - Deprecated attribute, use 'specifications' instead of - 'interface' - - - - - - The list of service specifications (i.e. interfaces) to expose. By - default, all interfaces implemented by the component implementation class are - published. - - - - - - Use 'strategy' instead of 'factory' - - - - - POJO creation strategy. By default, the POJO object is created once - (singleton). If the factory is set to "SERVICE", the creation policy follows the OSGi - service factory policy (one object object per asking bundle). INSTANCE allows creating one - different POJO object per asking instance. Finally, a custom strategy can be used by - specifying the qualified name of the class extending CreationPolicy - - - - - - Defines a callback called after the service registration. The callback takes a - ServiceReference - as parameter - - - - - - Defines a callback called after the service unregistration. The callback takes a - ServiceReference - as parameter - - - - - - - Defines a service controller. - - - - Field of the controller - - - - - Intiail value of the controller - - - - - - Defines a component property. - - - - Field of the property - - - - - Setter method of the property. This method is called to inject property - value. - - - - - - Name of the property. - - - - - Default value of the property. - - - - - Type of the property. - - - - - Set the property as mandatory. A mandatory property MUST receive a value - either in the component type description or in the instance configuration. Properties are - optional by default. - - - - - - Set the property as immutable. An immutable property is inherited by the component - instance but the value cannot be overridden. - - - - - - - - - - - - - - - - - - - - List of component, instance or service props. This field will receive - the property value. - - - - - - The list of props. - - - - - - Propagation of the component properties to the provided services. If this - parameter is set to "true", each time properties are reconfigured, they are propagated to - each service published by the component. - - - - - - Unique identifier used to reconfigure components properties (via Managed - Services) with the Configuration Admin. - - - - - - Method called when a reconfiguration is done - - - - - - - - The specification describing the required service type. This attribute is - needed only when using aggregate dependencies with field injection and when the type of - this field is a list, vector, collection and set. - - - - - - Sets the service dependency optionality - - - - - Sets the service dependency cardinality. - - - - - Sets the binding policy of the dependency. Three policies are supported. - The dynamic policy supports service providers dynamism. The static policy freezes the - provider set as soon as the dependency is used. The dynamic-priority policy is an - extension of the dynamic policy, but providers are ranked. - - - - - - - - - - - - - The comparator attribute allows specifying the class used to compare - providers. This class must implemented the java.util.Comparator class and must support the - comparison of service references. - - - - - - LDAP filter used to filter providers - - - - - id of the service dependency. The id allows to identify and to refer to - this dependency. - - - - - - - - Specifies the lifecycle controller of a component, which allows to validate - or invalidate component instances. - - - - - The name of the component lifecycle controller field. The type of the - specified field must be boolean. Setting the value of the specified field to "true" means - the validation of the component instance while setting it to "false" means the - invalidation of the component instance. - - - - - diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/event-admin.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/event-admin.xsd deleted file mode 100644 index d3948e6f9c..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/event-admin.xsd +++ /dev/null @@ -1,90 +0,0 @@ - - - - - - Description of an event publisher. - - - - The name of the event publisher, acting as a unique identifier. -The name of the POJO's field that will be used to send events. The field is initialized at component instantiation time. The type of the field must be "org.apache.felix.ipojo.handlers.event.publisher.Publisher". - - - - The name of the POJO field associated to this event publisher. -Despite it creates a dependency between the component code and the handler, this system allows hiding the whole complexity of event sending. - - - - The comma-separated-list of the topics on which events will be sent. All subscribers that are listening to one of these topics will receive the events. - - - Determines if event sending is synchronous or not. By default, events are sent asynchronously, but you can specify there the desired behaviour of the Publisher. -The default value of this attribute is "false". - - - - The data key is used when you want to send data events. This attribute's value is the key, in the event's dictionary, in which sent data are stored. When you use the sendData method of the Publisher, the given object is placed in the event dictionary, associated with the specified data-key. -The default value of this attribute is user.data. - - - - - Description of an event subscriber. - - - - The name of the event subscriber, acting as a unique identifier. - - - The name of the POJO's method that will be called each time an event is received. -This method takes only one parameter, of typeorg.osgi.service.event.Eventby default, but this type can be overridden by defining the data-key and/or the data-type attributes. - - - - The comma-separated-list of the topics that the handler will listen to. Each event sent on a topic present in this list will be sent to the specified callback method. - - - The event filter is used to filter incoming events before sending them to the callback. -The syntax of this field is described in the OSGi EventAdmin Specification. If you don't specify a filter, all events sent on the listened topics will be considered. - - - - The data key is used when you want to receive data events. This attribute's value is the key corresponding to the received data in the event's dictionary. -If you use this attribute, the parameter passed to the callback method is the the value associated to this key, not the whole event. -This attribute is generally used with the data-typeattribute to specify the received object type. -If an event is received and it does not contain such a key, it is ignored (with a warning message). - - - - This attribute is associated to the data-key attribute. It specifies the type of objects (java.lang.Object by default) that the callback expects. -It is used to determine the unique callback method (in case of multiple methods with the same name) and to check type compliance at event reception. -Data events that are not corresponding to the specified type will be ignored (with a warning message). - - - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/extender-pattern.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/extender-pattern.xsd deleted file mode 100644 index dc39757e90..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/extender-pattern.xsd +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - Description of the extender pattern configuration. -The extender tracks extensions. The particularity of this architecture-style is that extensions are packaged in different bundles. An extension is detected by analyzing the bundle. The mark is currently a header in the bundle manifest. At each time a matching bundle appears or disappears, a callback is invoked. - - - - Declaring the method to invoke when a matching bundle arrives - - - - Declaring the method to invoke when a matching bundle leaves - - - - Declaring the looked manifest header. - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/jmx.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/jmx.xsd deleted file mode 100644 index 09b95090d8..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/jmx.xsd +++ /dev/null @@ -1,177 +0,0 @@ - - - - - - - - - Description of a JMX managed component. - - - - - - - The list of methods to expose. - - - - - - - The list of attributes to expose. - - - - - - - - Determines if the component must be register on the - MOSGi MBean server or not. - - - - - - - The complete object name of the managed component. - The syntax of this attribute must be compliant with - the ObjectName syntax, detailed in the JMX - specification. If neither domain nor name attributes - are specified, the default value is determined by - the package, the type and the instance name of the - component. This attribute overrides the domain and - name attributes. - - - - - - - The domain of the managed object (i.e., the left - part of the object name). This attribute must be - compliant with the domain syntax, as described in - the JMX specification. - - - - - - - The name property of the managed object. The value - of this attribute must comply with the ObjectName - value syntax, as described in the JMX specification. - - - - - - - - Specifies method to carry out operations before - beeing registered from the MBean server. The - signature of the specified method must be : - "ObjectName preRegister(MBeanServer server, - ObjectName name) throws Exception". - - - - - - - Specifies method to carry out operations after - beeing registered from the MBean server. The - signature of the specified method must be : "void - postRegister(Boolean registrationDone)". - - - - - - - Specifies method to carry out operations before - beeing unregistered from the MBean server. The - signature of the specified method must be : "void - preDeregister() throws Exception". - - - - - - - Specifies method to carry out operations after - beeing unregistered from the MBean server. The - signature of the specified method must be : - "void postDeregister()". - - - - - - Description of an attribute to expose. - - - - The name of the component's field to expose. - - - The name of the property as it will appear in JMX. If unspecified, the default value is the name of the exposed field. - - - Specify the access permission of the exposed field. - - - - Access permission of an exposed field. Accepted values are "r" (read-only access, the default value) and "w" (read and write access). - - - - - - - - - - Enable or disable attribute change notification sending for this property. If set to "true", a notification is sent each time the value of the field changes. - - - - - Description of a method to expose. - - - - The name of the method to expose. If multiple methods have the same name, all of them are exposed. - - - - The description of the exposed method, as it will appear in JMX. - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/temporal.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/temporal.xsd deleted file mode 100644 index cecc68bb99..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/temporal.xsd +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - Description of a temporal dependency. - - - - The implementation field supporting the dependency. - - - - The dependency id - - - - Filter use to discover matching filter. - - - Specifies the timeout after which the onTimeout policy is executed. The value is the time in ms to wait. -1 is used to indicate an infinite wait. - - - - Specifies the onTimeout policy. This determines the object to inject when the service stills unavailable when the timeout expires. Several values are supported: 'nullable' means that a Nullable object will be injected, 'empty-array' injects an empty array (only for aggregate dependency), 'null' injects Null, any other value are interpreted as the default implementation class to use. If the onTimetout attribute is not specified, a RuntimeException is thrown when the timeout is reached. - - - - - Enables or Disables the proxy injection - - - - - Specifies the looked service specification. This attribute is mandatory when injecting in a Collection - - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/main/resources/xsd/whiteboard-pattern.xsd b/ipojo/manipulator/manipulator/src/main/resources/xsd/whiteboard-pattern.xsd deleted file mode 100644 index 0c8ebb20c2..0000000000 --- a/ipojo/manipulator/manipulator/src/main/resources/xsd/whiteboard-pattern.xsd +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - Description of the white-board architecture. - - - - Declaring the method to invoke when a matching service arrives. - - - - Declaring the method to invoke when a matching service leaves. - - - - Method called when an injected service reference is modified but stills valid against the filter. - - - - Filter use to discover matching filter. - - - \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/ComponentInstance.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/ComponentInstance.java deleted file mode 100644 index 953ff3ad9a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/ComponentInstance.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo; - - -/** - * Component Instance Fake. - * We're using a fake to avoid the cyclic build dependency: - * manipulator -> ipojo -> maven-ipojo-plugin -> manipulator - */ -public interface ComponentInstance { - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/InstanceManager.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/InstanceManager.java deleted file mode 100644 index 440151e527..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/InstanceManager.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo; - -import java.util.Set; - -/** - * Instance Manager Fake. - * We're using a fake to avoid the cyclic build dependency: - * manipulator -> ipojo -> maven-ipojo-plugin -> manipulator - */ -public class InstanceManager { - - public Set getRegistredFields() { - return null; - } - - public Set getRegistredMethods() { - return null; - } - - public void onEntry(Object pojo, String methodId, Object[] args) { - - } - - public void onExit(Object pojo, String methodId, Object[] args) { - - } - - public void onError(Object pojo, String methodId, Throwable error) { - - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/Pojo.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/Pojo.java deleted file mode 100644 index 05885007fe..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/Pojo.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo; - -/** - * POJO Interface fake. - * We're using a fake to avoid the cyclic build dependency: - * manipulator -> ipojo -> maven-ipojo-plugin -> manipulator - */ -public interface Pojo { - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ClassCheckerTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ClassCheckerTestCase.java deleted file mode 100644 index c14627a0da..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ClassCheckerTestCase.java +++ /dev/null @@ -1,129 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.objectweb.asm.*; -import org.osgi.framework.BundleContext; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.util.Collection; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class ClassCheckerTestCase extends TestCase { - - public void testIsAlreadyManipulatedWithNotManipulatedResource() throws Exception { - ClassChecker checker = check(resource("test/SimplePojo.class")); - assertFalse(checker.isAlreadyManipulated()); - } - - public void testIsAlreadyManipulatedWithManipulatedResource() throws Exception { - ClassChecker checker = check(manipulate(resource("test/SimplePojo.class"))); - assertTrue(checker.isAlreadyManipulated()); - } - - public void testMetadataForAlreadyManipulatedClassAreCleaned() throws Exception { - ClassChecker checker = check(manipulate(resource("test/AnnotatedComponent.class"))); - - // Check implemented interfaces - List interfaces = checker.getInterfaces(); - assertTrue(interfaces.isEmpty()); - - // Check super class - assertNull(checker.getSuperClass()); - - // Check inner classes - Collection inner = checker.getInnerClasses(); - assertTrue(inner.isEmpty()); - - // Ensure fields are correctly filtered - Map fields = checker.getFields(); - assertEquals(1, fields.size()); - assertEquals("java.lang.String", fields.get("prop")); - - // Ensure methods are also correctly filtered - List descriptors = checker.getMethods(); - assertEquals(2, descriptors.size()); - - // AnnotatedComponent(BundleContext) - MethodDescriptor constructor = searchMethod("$init", descriptors); - assertNotNull(constructor); - Type[] arguments = Type.getArgumentTypes(constructor.getDescriptor()); - assertEquals(1, arguments.length); - assertEquals(Type.getType(BundleContext.class), arguments[0]); - - // @FakeAnnotation - // AnnotatedComponent.annotatedMethod():Void - MethodDescriptor method = searchMethod("annotatedMethod", descriptors); - assertNotNull(method); - assertEquals("()V", method.getDescriptor()); // return void + no params - assertAnnotationIsAlone(method, "Ltest/FakeAnnotation;"); - - - } - - private void assertAnnotationIsAlone(MethodDescriptor method, String desc) { - List annotations = method.getAnnotations(); - - assertEquals(1, annotations.size()); - ClassChecker.AnnotationDescriptor annotationDescriptor = annotations.get(0); - MethodVisitor mv = mock(MethodVisitor.class); - when(mv.visitAnnotation(desc, true)).thenReturn(new AnnotationVisitor(Opcodes.ASM9) {}); - annotationDescriptor.visitAnnotation(mv); - } - - private MethodDescriptor searchMethod(String methodName, List descriptors) { - for (MethodDescriptor descriptor : descriptors) { - if (methodName.equals(descriptor.getName())) { - return descriptor; - } - } - - return null; - } - - private byte[] manipulate(byte[] input) throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - manipulator.prepare(input); - return manipulator.manipulate(input); - } - - private byte[] resource(String name) throws Exception { - return ManipulatorTest.getBytesFromFile(new File("target/test-classes/" + name)); - } - - private ClassChecker check(byte[] resource) throws Exception { - ClassChecker checker = new ClassChecker(); - ByteArrayInputStream is = new ByteArrayInputStream(resource); - try { - ClassReader classReader = new ClassReader(is); - classReader.accept(checker, ClassReader.SKIP_FRAMES); - } finally { - Streams.close(is); - } - return checker; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java deleted file mode 100644 index 15a5285677..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/DirManipulationTest.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; - -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.junit.Test; - -import test.AnnotatedComponent; - -import junit.framework.TestCase; - -/** - * Test cases for Pojoization.directoryManipulation() - * - */ -public class DirManipulationTest extends TestCase { - - /** - * Test case for FELIX-3466. - * - * Checks if directory manipulation, uses the supplied manifest file as - * output. - * - * @throws IOException - */ - @Test - public void testManifestLocationKept() throws IOException { - Pojoization pojoizator = new Pojoization(); - File tmpDir = null, manifestFile = null, testClass = null; - - // To obtain OS's temp directory. - File tmpFile = File.createTempFile("pojodir", ".dir"); - String tmpPath = tmpFile.getAbsolutePath(); - tmpFile.delete(); - - // Creating directory on temp location - tmpDir = new File(tmpPath); - tmpDir.mkdir(); - tmpDir.deleteOnExit(); - - // Create manifest file under temp directory - manifestFile = new File(tmpDir, "MANIFEST.MF"); - new FileOutputStream(manifestFile).write("Manifest-Version: 1.0\r\n" - .getBytes()); - manifestFile.deleteOnExit(); - - // Just to ensure it is not deleted later from test classes. - AnnotatedComponent safe; - - // Annotated Class File - File annotedClassPackage = new File(tmpDir, "test"); - annotedClassPackage.deleteOnExit(); - annotedClassPackage.mkdir(); - testClass = new File(annotedClassPackage, "AnnotatedComponent.class"); - testClass.deleteOnExit(); - FileOutputStream os = new FileOutputStream(testClass); - os.write(ManipulatorTest.getBytesFromFile(new File( - "target/test-classes/test/AnnotatedComponent.class"))); - os.close(); - - // Issue directory manipulation - pojoizator.directoryPojoization(tmpDir, null, manifestFile, null); - - // Check if supplied manifest file is altered in place - BufferedReader fi = new BufferedReader(new FileReader(manifestFile)); - String manifestLine; - while ((manifestLine = fi.readLine()) != null) { - if (manifestLine.contains("iPOJO-Components")) { - assertTrue(true); - return; - } - } - - assertTrue( - "Directory Manipulation didn't use supplied manifest file as output", - false); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java deleted file mode 100644 index 4496609352..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/InnerClassAdapterTest.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import junit.framework.Assert; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.Pojo; -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Ignore; -import org.junit.Test; -import org.mockito.Mockito; - -import java.io.File; -import java.io.FilenameFilter; -import java.io.IOException; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.util.Arrays; -import java.util.concurrent.Callable; - -import static junit.framework.Assert.assertEquals; -import static org.fest.assertions.Assertions.assertThat; - -/** - * Checks the inner class manipulation - */ -public class InnerClassAdapterTest { - - public static String baseClassDirectory = "target/test-classes/"; - - public static ManipulatedClassLoader manipulate(String className, Manipulator manipulator) throws IOException { - final File mainClassFile = new File(baseClassDirectory + className.replace(".", "/") + ".class"); - byte[] bytecode = ManipulatorTest.getBytesFromFile( - mainClassFile); - - // Preparation. - try { - manipulator.prepare(bytecode); - } catch (IOException e) { - Assert.fail("Cannot read " + className); - } - - // Inner class preparation - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - byte[] innerClassBytecode; - try { - innerClassBytecode = ManipulatorTest.getBytesFromFile(new File(baseClassDirectory + resourcePath)); - manipulator.prepareInnerClass(inner, innerClassBytecode); - } catch (IOException e) { - Assert.fail("Cannot find or analyze inner class '" + resourcePath + "'"); - } - } - - // Now manipulate the classes. - byte[] out = new byte[0]; - try { - out = manipulator.manipulate(bytecode); - } catch (IOException e) { - Assert.fail("Cannot manipulate the class " + className + " : " + e.getMessage()); - } - - ManipulatedClassLoader classloader = new ManipulatedClassLoader(className, out); - - // Visit inner classes - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - byte[] innerClassBytecode; - try { - innerClassBytecode = ManipulatorTest.getBytesFromFile(new File(baseClassDirectory + resourcePath)); - byte[] manipulated = manipulator.manipulateInnerClass(inner, innerClassBytecode); - classloader.addInnerClass(inner.replace("/", "."), manipulated); - } catch (IOException e) { - Assert.fail("Cannot find inner class '" + resourcePath + "'"); - } - } - - // Lookup for all the other inner classes (not manipulated) - File[] files = mainClassFile.getParentFile().listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith(mainClassFile.getName().substring(0, mainClassFile.getName().length() - - ".class".length()) + "$"); - } - }); - - for (File f : files) { - String name = className + f.getName().substring(f.getName().indexOf("$")); - name = name.substring(0, name.length() - ".class".length()); - byte[] innerClassBytecode = ManipulatorTest.getBytesFromFile(f); - classloader.addInnerClassIfNotAlreadyDefined(name, innerClassBytecode); - } - - return classloader; - } - - public static ManipulatedClassLoader manipulate(String className, Manipulator manipulator, - ManipulatedClassLoader initial) throws IOException { - byte[] bytecode = initial.get(className); - final File mainClassFile = new File(baseClassDirectory + className.replace(".", "/") + ".class"); - String mainClass = className; - - // Preparation. - try { - manipulator.prepare(bytecode); - } catch (IOException e) { - Assert.fail("Cannot read " + className); - } - - // Inner class preparation - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - byte[] innerClassBytecode; - try { - innerClassBytecode = initial.get(inner.replace("/", ".")); - manipulator.prepareInnerClass(inner, innerClassBytecode); - } catch (IOException e) { - Assert.fail("Cannot find or analyze inner class '" + resourcePath + "'"); - } - } - - // Now manipulate the classes. - byte[] out = new byte[0]; - try { - out = manipulator.manipulate(bytecode); - } catch (IOException e) { - Assert.fail("Cannot manipulate the class " + className + " : " + e.getMessage()); - } - - ManipulatedClassLoader classloader = new ManipulatedClassLoader(className, out); - - // Visit inner classes - for (String inner : manipulator.getInnerClasses()) { - // Get the bytecode and start manipulation - String resourcePath = inner + ".class"; - byte[] innerClassBytecode; - try { - innerClassBytecode = initial.get(inner.replace("/", ".")); - byte[] manipulated = manipulator.manipulateInnerClass(inner, innerClassBytecode); - classloader.addInnerClass(inner.replace("/", "."), manipulated); - } catch (IOException e) { - Assert.fail("Cannot find inner class '" + resourcePath + "'"); - } - } - - // Lookup for all the other inner classes (not manipulated) - File[] files = mainClassFile.getParentFile().listFiles(new FilenameFilter() { - public boolean accept(File dir, String name) { - return name.startsWith(mainClassFile.getName().substring(0, mainClassFile.getName().length() - - ".class".length()) + "$"); - } - }); - - - for (File f : files) { - String name = className + f.getName().substring(f.getName().indexOf("$")); - name = name.substring(0, name.length() - ".class".length()); - byte[] innerClassBytecode = ManipulatorTest.getBytesFromFile(f); - classloader.addInnerClassIfNotAlreadyDefined(name, innerClassBytecode); - } - - return classloader; - } - - private static Element getInnerClassMetadataByName(Element[] inners, String name) { - for (Element element : inners) { - if (name.equals(element.getAttribute("name"))) { - return element; - } - } - return null; - } - - private static Element getMethodByName(Element[] methods, String name) { - for (Element element : methods) { - if (name.equals(element.getAttribute("name"))) { - return element; - } - } - return null; - } - - @Test - public void testManipulatingTheInner() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.PojoWithInner"; - byte[] origin = ManipulatorTest.getBytesFromFile(new File(baseClassDirectory + className.replace(".", - "/") + ".class")); - - ManipulatedClassLoader classloader = manipulate(className, manipulator); - - Class cl = classloader.findClass(className); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - Assert.assertFalse(manipulator.getInnerClasses().isEmpty()); - - System.out.println(manipulator.getManipulationMetadata()); - - // The manipulation add stuff to the class. - Assert.assertTrue(classloader.get(className).length > origin.length); - - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (Constructor cst2 : csts) { - System.out.println(Arrays.asList(cst2.getParameterTypes())); - if (cst2.getParameterTypes().length == 1 && - cst2.getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = cst2; - } - } - Assert.assertTrue(found); - - // We still have the empty constructor - found = false; - csts = cl.getDeclaredConstructors(); - for (Constructor cst1 : csts) { - System.out.println(Arrays.asList(cst1.getParameterTypes())); - if (cst1.getParameterTypes().length == 0) { - found = true; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - InstanceManager im = Mockito.mock(InstanceManager.class); - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{im}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue()); - - } - - @Test - public void testInnerClasses() throws IOException, ClassNotFoundException, NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - ManipulatedClassLoader classloader = manipulate(className, manipulator); - - - Class clazz = classloader.findClass(className); - Assert.assertNotNull(clazz); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - Assert.assertFalse(manipulator.getInnerClasses().isEmpty()); - // We should have found only 2 inner classes. - assertThat(manipulator.getInnerClasses().size()).isEqualTo(3); - - // Check that all inner classes are manipulated. - InstanceManager im = Mockito.mock(InstanceManager.class); - Constructor constructor = clazz.getDeclaredConstructor(InstanceManager.class); - constructor.setAccessible(true); - Object pojo = constructor.newInstance(im); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - Method method = clazz.getMethod("doSomething", new Class[0]); - String result = (String) method.invoke(pojo); - assertEquals(result, "foofoofoofoo"); - } - - @Test - public void testDoubleManipulation() throws IOException, ClassNotFoundException, NoSuchMethodException, - IllegalAccessException, InvocationTargetException, InstantiationException { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - ManipulatedClassLoader classloader = manipulate(className, manipulator); - - manipulator = new Manipulator(this.getClass().getClassLoader()); - classloader = manipulate(className, manipulator, classloader); - - Class clazz = classloader.findClass(className); - Assert.assertNotNull(clazz); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - Assert.assertFalse(manipulator.getInnerClasses().isEmpty()); - // We should have found only 2 inner classes. - assertThat(manipulator.getInnerClasses().size()).isEqualTo(3); - - // Check that all inner classes are manipulated. - InstanceManager im = Mockito.mock(InstanceManager.class); - Constructor constructor = clazz.getDeclaredConstructor(InstanceManager.class); - constructor.setAccessible(true); - Object pojo = constructor.newInstance(im); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - Method method = clazz.getMethod("doSomething", new Class[0]); - String result = (String) method.invoke(pojo); - assertEquals(result, "foofoofoofoo"); - } - - @Test - public void testThatManipulationMetadataContainsTheInnerClasses() throws IOException, ClassNotFoundException, - NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - manipulate(className, manipulator); - - assertThat(manipulator.getInnerClasses().size()).isEqualTo(3); - - Element manipulation = manipulator.getManipulationMetadata(); - System.out.println(manipulation); - Element[] inners = manipulation.getElements("inner"); - assertThat(inners.length).isEqualTo(3); - - Element inner = getInnerClassMetadataByName(inners, "MyInnerWithANativeMethod"); - assertThat(inner).isNotNull(); - assertThat(getMethodByName(inner.getElements("method"), "foo")).isNotNull(); - - inner = getInnerClassMetadataByName(inners, "MyInnerClass"); - assertThat(inner).isNotNull(); - assertThat(getMethodByName(inner.getElements("method"), "foo")).isNotNull(); - - inner = getInnerClassMetadataByName(inners, "1"); - assertThat(inner).isNotNull(); - assertThat(getMethodByName(inner.getElements("method"), "compute")).isNotNull(); - } - - @Test - public void testThatTheClassContainsTheFlagsForTheInnerMethods() throws IOException, ClassNotFoundException, - NoSuchMethodException, IllegalAccessException, InvocationTargetException, InstantiationException, NoSuchFieldException { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - ManipulatedClassLoader classLoader = manipulate(className, manipulator); - - Class clazz = classLoader.findClass(className); - - String flag = "__M" + "MyInnerWithANativeMethod" + "___" + "foo"; - assertThat(clazz.getDeclaredField(flag)).isNotNull(); - - flag = "__M" + "MyInnerClass" + "___" + "foo"; - assertThat(clazz.getDeclaredField(flag)).isNotNull(); - - flag = "__M" + "1" + "___" + "compute" + "$java_lang_String"; - assertThat(clazz.getDeclaredField(flag)).isNotNull(); - } - - @Test - public void testThatStaticInnerClassesAreNotManipulated() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - ManipulatedClassLoader classLoader = manipulate(className, manipulator); - - Class clazz = classLoader.findClass(className); - Class inner = findInnerClass(clazz.getClasses(), "MyStaticInnerClass"); - assertThat(inner).isNotNull(); - Method bar = inner.getMethod("bar"); - Object o = inner.newInstance(); - bar.setAccessible(true); - assertThat(bar).isNotNull(); - assertThat((String) bar.invoke(o)).isEqualTo("bar"); - } - - @Test - public void testThatAnonymousClassDeclaredInStaticFieldsAreNotManipulated() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - String className = "test.inner.ComponentWithInnerClasses"; - ManipulatedClassLoader classLoader = manipulate(className, manipulator); - - Class clazz = classLoader.findClass(className); - Method method = clazz.getMethod("call"); - assertThat(method).isNotNull(); - assertThat(method.invoke(null)).isEqualTo(1); - } - - private Class findInnerClass(Class[] classes, String name) { - for (Class clazz : classes) { - if (clazz.getName().contains(name)) { - return clazz; - } - } - return null; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java deleted file mode 100644 index 1aa8ce4710..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatedClassLoader.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import org.apache.commons.io.FileUtils; - -import java.io.File; -import java.io.IOException; -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * A classloader used to load manipulated classes. - */ -public class ManipulatedClassLoader extends ClassLoader { - - private String name; - private byte[] clazz; - - private Map inner = new LinkedHashMap(); - - public ManipulatedClassLoader(String name, byte[] clazz) { - this.name = name; - this.clazz = clazz; - } - - public byte[] get(String name) { - if (name.equals(this.name)) { - return clazz; - } - if (inner.containsKey(name)) { - return inner.get(name); - } - return null; - } - - public void addInnerClass(String name, byte[] clazz) { - inner.put(name, clazz); - } - - public Class findClass(String name) throws ClassNotFoundException { - if (name.equals(this.name)) { - return defineClass(name, clazz, 0, clazz.length); - } - - if (inner.containsKey(name)) { - return defineClass(name, inner.get(name), 0, inner.get(name).length); - } - - return super.findClass(name); - } - - public Class loadClass(String classname) throws ClassNotFoundException { - if (inner.containsKey(classname)) { - return findClass(classname); - } - return super.loadClass(classname); - } - - public static final File DUMP_BASEDIR = new File("target/dump"); - - public void dump() throws IOException { - File outer = new File(DUMP_BASEDIR, name.replace(".", "/") + ".class"); - FileUtils.writeByteArrayToFile(outer, clazz); - for (String name : inner.keySet()) { - File file = new File(DUMP_BASEDIR, name.replace(".", "/") + ".class"); - FileUtils.writeByteArrayToFile(file, inner.get(name)); - } - } - - public Map getAllInnerClasses() { - return inner; - } - - public void addInnerClassIfNotAlreadyDefined(String name, byte[] innerClassBytecode) { - if (! inner.containsKey(name)) { - inner.put(name, innerClassBytecode); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java deleted file mode 100644 index c12a082630..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/ManipulatorTest.java +++ /dev/null @@ -1,495 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.Pojo; -import org.mockito.Mockito; -import org.objectweb.asm.ClassReader; -import org.objectweb.asm.util.CheckClassAdapter; - -import java.io.*; -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Arrays; - -public class ManipulatorTest extends TestCase { - - public static byte[] getBytesFromFile(File file) throws IOException { - InputStream is = new FileInputStream(file); - long length = file.length(); - byte[] bytes = new byte[(int) length]; - - // Read in the bytes - int offset = 0; - int numRead = 0; - while (offset < bytes.length - && (numRead = is.read(bytes, offset, bytes.length - offset)) >= 0) { - offset += numRead; - } - - // Ensure all the bytes have been read in - if (offset < bytes.length) { - throw new IOException("Could not completely read file " + file.getName()); - } - - // Close the input stream and return bytes - is.close(); - return bytes; - } - - public void testClusterDaemon() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/ClusterDaemon.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.ClusterDaemon", clazz); - - //Assert.assertNotNull(manipulator.getManipulationMetadata()); - - //System.out.println(manipulator.getManipulationMetadata()); - - - ClassReader reader = new ClassReader(clazz); - CheckClassAdapter.verify(reader, false, new PrintWriter(new File("/tmp/class_dump"))); - - Class cl = classloader.findClass("test.ClusterDaemon"); - //Assert.assertNotNull(cl); - - // The manipulation add stuff to the class. - //Assert.assertTrue(clazz.length > getBytesFromFile(new File("target/test-classes/test/ClusterDaemon.class")).length); - - //Assert.assertNotNull(cl.newInstance()); - - } - - public void testCrypto() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/frames/CryptoServiceSingleton.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.frames.CryptoServiceSingleton", clazz); - - //Assert.assertNotNull(manipulator.getManipulationMetadata()); - - //System.out.println(manipulator.getManipulationMetadata()); - - - ClassReader reader = new ClassReader(clazz); - CheckClassAdapter.verify(reader, false, new PrintWriter(new File("/tmp/class_dump"))); - - Class cl = classloader.findClass("test.frames.CryptoServiceSingleton"); - Assert.assertNotNull(cl); - - final Constructor constructor = cl.getDeclaredConstructor(); - constructor.setAccessible(true); - Object instance = constructor.newInstance(); - - Method method = cl.getMethod("encryptAESWithCBC", String.class, String.class); - final String salt = "0000000000000000"; - String result = (String) method.invoke(instance, "hello", salt); - assertNotNull(result); - - // The manipulation add stuff to the class. - //Assert.assertTrue(clazz.length > getBytesFromFile(new File("target/test-classes/test/ClusterDaemon.class")).length); - - //Assert.assertNotNull(cl.newInstance()); - - } - - public void testManipulatingPojoWithStaticInterface() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/PojoWithStaticInterface.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.PojoWithStaticInterface", clazz); - Class cl = classloader.findClass("test.PojoWithStaticInterface"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - final Constructor constructor = cl.getDeclaredConstructor(); - Assert.assertNotNull(constructor); - final Object instance = constructor.newInstance(); - Assert.assertNotNull(instance); - - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertEquals(((String) method.invoke(instance, new Object[0])), "test"); - } - - public void testManipulatingPojoWithFinalArray() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/PojoWithFinalArray.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.PojoWithFinalArray", clazz); - Class cl = classloader.findClass("test.PojoWithFinalArray"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - final Constructor constructor = cl.getDeclaredConstructor(); - Assert.assertNotNull(constructor); - final Object instance = constructor.newInstance(); - Assert.assertNotNull(instance); - - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertEquals(((String) method.invoke(instance, new Object[0])), "test"); - } - - public void testManipulatingTheSimplePojo() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/SimplePojo.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.SimplePojo", clazz); - Class cl = classloader.findClass("test.SimplePojo"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - System.out.println(manipulator.getManipulationMetadata()); - - // The manipulation add stuff to the class. - Assert.assertTrue(clazz.length > getBytesFromFile(new File("target/test-classes/test/SimplePojo.class")).length); - - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // We still have the empty constructor - found = false; - csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 0) { - found = true; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{new InstanceManager()}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue()); - - } - - public void testManipulatingTheNonSunPOJO() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/NonSunClass.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.NonSunClass", clazz); - Class cl = classloader.findClass("test.NonSunClass"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - System.out.println(manipulator.getManipulationMetadata()); - - // The manipulation add stuff to the class. - Assert.assertTrue(clazz.length > getBytesFromFile(new File("target/test-classes/test/NonSunClass.class")).length); - - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{new InstanceManager()}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - Method method = cl.getMethod("getS1", new Class[0]); - Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue()); - - } - - public void testManipulatingChild() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/Child.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.Child", clazz); - Class cl = classloader.findClass("test.Child"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // We still have the regular constructor - found = false; - csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 2) { - found = true; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - InstanceManager im = (InstanceManager) Mockito.mock(InstanceManager.class); - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{im}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertEquals(9, ((Integer) method.invoke(pojo, new Object[0])).intValue()); - - } - - public void testManipulatingWithConstructorModification() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/Child.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.Child", clazz); - Class cl = classloader.findClass("test.Child"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // We still have the regular constructor - found = false; - csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 2) { - found = true; - } - } - Assert.assertTrue(found); - - // Check that we have the IM, Integer, String constructor too - Constructor cst2 = cl.getDeclaredConstructor(new Class[]{InstanceManager.class, Integer.TYPE, String.class}); - Assert.assertNotNull(cst2); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - - // Creation using cst - InstanceManager im = (InstanceManager) Mockito.mock(InstanceManager.class); - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{im}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - Method method = cl.getMethod("doSomething", new Class[0]); - Assert.assertEquals(9, ((Integer) method.invoke(pojo, new Object[0])).intValue()); - - // Try to create using cst2 - im = (InstanceManager) Mockito.mock(InstanceManager.class); - cst2.setAccessible(true); - pojo = cst2.newInstance(new Object[]{im, new Integer(2), "bariton"}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - method = cl.getMethod("doSomething", new Class[0]); - Assert.assertEquals(10, ((Integer) method.invoke(pojo, new Object[0])).intValue()); - - - } - - public void testManipulatingWithNoValidConstructor() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/NoValidConstructor.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.NoValidConstructor", clazz); - Class cl = classloader.findClass("test.NoValidConstructor"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - System.out.println(manipulator.getManipulationMetadata()); - - // The manipulation add stuff to the class. - Assert.assertTrue(clazz.length > origin.length); - - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{new InstanceManager()}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - } - - public void testConstructor() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/ConstructorCheck.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - -// File out = new File("target/ManipulatedConstructorCheck.class"); -// FileOutputStream fos = new FileOutputStream(out); -// fos.write(clazz); -// fos.close(); - - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.ConstructorCheck", clazz); - Class cl = classloader.findClass("test.ConstructorCheck"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - System.out.println(manipulator.getManipulationMetadata()); - - Constructor c = cl.getConstructor(new Class[]{String.class}); - Assert.assertNotNull(c); - - Object o = c.newInstance("toto"); - Field f = o.getClass().getField("m_foo"); - Assert.assertEquals("toto", f.get(o)); - } - - /** - * https://issues.apache.org/jira/browse/FELIX-3621 - */ - public void testManipulatingDoubleArray() throws Exception { - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - byte[] origin = getBytesFromFile(new File("target/test-classes/test/DoubleArray.class")); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.DoubleArray", clazz); - Class cl = classloader.findClass("test.DoubleArray"); - Assert.assertNotNull(cl); - Assert.assertNotNull(manipulator.getManipulationMetadata()); - - System.out.println(manipulator.getManipulationMetadata()); - Assert.assertTrue(manipulator.getManipulationMetadata().toString().contains("arguments=\"{int[][]}\"")); - - // The manipulation add stuff to the class. - Assert.assertTrue(clazz.length > origin.length); - - - boolean found = false; - Constructor cst = null; - Constructor[] csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 1 && - csts[i].getParameterTypes()[0].equals(InstanceManager.class)) { - found = true; - cst = csts[i]; - } - } - Assert.assertTrue(found); - - // We still have the empty constructor - found = false; - csts = cl.getDeclaredConstructors(); - for (int i = 0; i < csts.length; i++) { - System.out.println(Arrays.asList(csts[i].getParameterTypes())); - if (csts[i].getParameterTypes().length == 0) { - found = true; - } - } - Assert.assertTrue(found); - - // Check the POJO interface - Assert.assertTrue(Arrays.asList(cl.getInterfaces()).contains(Pojo.class)); - - cst.setAccessible(true); - Object pojo = cst.newInstance(new Object[]{new InstanceManager()}); - Assert.assertNotNull(pojo); - Assert.assertTrue(pojo instanceof Pojo); - - Method method = cl.getMethod("start", new Class[0]); - Assert.assertTrue(((Boolean) method.invoke(pojo, new Object[0])).booleanValue()); - - } - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/PojoizationTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/PojoizationTest.java deleted file mode 100644 index 0e50111440..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/PojoizationTest.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import java.io.File; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import org.apache.felix.ipojo.manipulator.Pojoization; - -public class PojoizationTest extends TestCase { - - public void testJarManipulation() { - Pojoization pojoization = new Pojoization(); - pojoization.setUseLocalXSD(); - File in = new File("target/test-classes/tests.manipulation-no-annotations.jar"); - File out = new File("target/test-classes/tests.manipulation-no-annotations-manipulated.jar"); - out.delete(); - File metadata = new File("target/test-classes/metadata.xml"); - pojoization.pojoization(in, out, metadata, null); - - Assert.assertTrue(out.exists()); - } - - public void testManipulationWithAnnotations() { - Pojoization pojoization = new Pojoization(); - pojoization.setUseLocalXSD(); - File in = new File("target/test-classes/tests.manipulator-annotations.jar"); - File out = new File("target/test-classes/tests.manipulation-annotations-manipulated.jar"); - out.delete(); - pojoization.pojoization(in, out, (File) null, null); - - Assert.assertTrue(out.exists()); - } - - public void testJarManipulationJava5() { - Pojoization pojoization = new Pojoization(); - pojoization.setUseLocalXSD(); - File in = new File("target/test-classes/tests.manipulation.java5.jar"); - File out = new File("target/test-classes/tests.manipulation.java5-manipulated.jar"); - out.delete(); - pojoization.pojoization(in, out, (File) null, null); - - Assert.assertTrue(out.exists()); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java deleted file mode 100644 index 0e0c5569b9..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulation/RemanipulationTest.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * 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.ipojo.manipulation; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.metadata.AnnotationMetadataProvider; -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.File; -import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; - -/** - * Test Case for FELIX-3461. - * Checks the consistency of multiple manipulation. - */ -public class RemanipulationTest extends TestCase { - - /** - * Tests checking that the consecutive manipulation does still returns valid metadata (from annotations), - * and valid manipulation metadata. - * - * @throws IOException - * @throws ClassNotFoundException - */ - public void testDoubleManipulationWithAnnotations() throws IOException, ClassNotFoundException { - Reporter reporter = mock(Reporter.class); - // Step 1 - First collection and manipulation - //1.1 Metadata collection - byte[] origin = ManipulatorTest.getBytesFromFile(new File("target/test-classes/test/PlentyOfAnnotations.class")); - MiniStore store = new MiniStore() - .addClassToStore("test.PlentyOfAnnotations", - origin); - AnnotationMetadataProvider provider = new AnnotationMetadataProvider(store, reporter); - List originalMetadata = provider.getMetadatas(); - // 1.2 Manipulation - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - manipulator.prepare(origin); - byte[] clazz = manipulator.manipulate(origin); - Element originalManipulationMetadata = manipulator.getManipulationMetadata(); - // 1.3 Check that the class is valid - ManipulatedClassLoader classloader = new ManipulatedClassLoader("test.PlentyOfAnnotations", clazz); - Class cl = classloader.findClass("test.PlentyOfAnnotations"); - Assert.assertNotNull(cl); - - // --------------- - - // Step 2 - Second collection and manipulation - // We use the output class as entry. - // 2.1 Metadata collection - store = new MiniStore().addClassToStore("test.PlentyOfAnnotations", clazz); - provider = new AnnotationMetadataProvider(store, reporter); - List metadataAfterOneManipulation = provider.getMetadatas(); - // 2.2 Manipulation - manipulator = new Manipulator(this.getClass().getClassLoader()); - manipulator.prepare(clazz); - byte[] clazz2 = manipulator.manipulate(clazz); - Element manipulationMetadataAfterSecondManipulation = manipulator.getManipulationMetadata(); - // 2.3 Check that the class is valid - classloader = new ManipulatedClassLoader("test.PlentyOfAnnotations", clazz); - cl = classloader.findClass("test.PlentyOfAnnotations"); - Assert.assertNotNull(cl); - - // --------------- - - // Step 3 - Third collection and manipulation - // We use the output class of 2 as entry. - // 3.1 Metadata collection - store = new MiniStore().addClassToStore("test.PlentyOfAnnotations", clazz2); - provider = new AnnotationMetadataProvider(store, reporter); - List metadataAfterTwoManipulation = provider.getMetadatas(); - // 3.2 Manipulation - manipulator = new Manipulator(this.getClass().getClassLoader()); - manipulator.prepare(clazz2); - byte[] clazz3 = manipulator.manipulate(clazz2); - Element manipulationMetadataAfterThirdManipulation = manipulator.getManipulationMetadata(); - // 3.3 Check that the class is valid - classloader = new ManipulatedClassLoader("test.PlentyOfAnnotations", clazz); - cl = classloader.findClass("test.PlentyOfAnnotations"); - Assert.assertNotNull(cl); - - // --------------- - // Verification - - // Unchanged metadata - Assert.assertEquals(originalMetadata.toString(), metadataAfterOneManipulation.toString()); - Assert.assertEquals(originalMetadata.toString(), metadataAfterTwoManipulation.toString()); - - // Unchanged manipulation metadata - Assert.assertEquals(originalManipulationMetadata.toString(), - manipulationMetadataAfterSecondManipulation.toString()); - Assert.assertEquals(originalManipulationMetadata.toString(), - manipulationMetadataAfterThirdManipulation.toString()); - - } - - private class MiniStore implements ResourceStore { - - private Map resources; - - public MiniStore addClassToStore(String qualifiedName, byte[] bytes) { - if (this.resources == null) { - this.resources = new HashMap(); - } - this.resources.put(Strings.asResourcePath(qualifiedName), bytes); - return this; - } - - public byte[] read(String path) throws IOException { - byte[] bytes = resources.get(path); - if (bytes == null) { - throw new IOException(); - } - return bytes; - } - - public void accept(ResourceVisitor visitor) { - for (Map.Entry entry : resources.entrySet()) { - visitor.visit(entry.getKey()); - } - } - - public void open() throws IOException { - } - - public void writeMetadata(Element metadata) { - } - - public void write(String resourcePath, byte[] resource) throws IOException { - } - - public void close() throws IOException { - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/ManipulationEngineTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/ManipulationEngineTestCase.java deleted file mode 100644 index 8166ac53de..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/ManipulationEngineTestCase.java +++ /dev/null @@ -1,113 +0,0 @@ -/* - * 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.ipojo.manipulator; - -import java.io.IOException; -import java.io.InputStream; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.apache.felix.ipojo.metadata.Element; -import org.mockito.InjectMocks; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import test.ClusterDaemon; -import test.PojoWithInner; - -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -public class ManipulationEngineTestCase extends TestCase { - - @Mock - private Reporter reporter; - - @Mock - private ResourceStore store; - - @Mock - private ManipulationVisitor visitor; - - @Mock - private ManipulationResultVisitor result; - - @InjectMocks - private ManipulationEngine engine = new ManipulationEngine(this.getClass().getClassLoader()); - - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testManipulationOfSimpleClass() throws Exception { - - when(store.read(anyString())).thenReturn(from(ClusterDaemon.class)); - when(visitor.visitManipulationResult(any(Element.class))).thenReturn(result); - - String path = Strings.asResourcePath(ClusterDaemon.class.getName()); - Element metadata = new Element("", ""); - ManipulationUnit info = new ManipulationUnit(path, metadata); - engine.addManipulationUnit(info); - - engine.generate(); - - verify(visitor).visitManipulationResult(eq(metadata)); - verify(result).visitClassStructure(any(Element.class)); - verify(result).visitManipulatedResource(eq(path), any(byte[].class)); - verify(result).visitEnd(); - - } - - public void testManipulationOfInnerClass() throws Exception { - - when(visitor.visitManipulationResult(any(Element.class))).thenReturn(result); - - String innerPath = Strings.asResourcePath(PojoWithInner.MyInner.class.getName()); - when(store.read(innerPath)).thenReturn(from(PojoWithInner.MyInner.class)); - - String path = Strings.asResourcePath(PojoWithInner.class.getName()); - when(store.read(path)).thenReturn(from(PojoWithInner.class)); - - Element metadata = new Element("", ""); - ManipulationUnit info = new ManipulationUnit(path, metadata); - engine.addManipulationUnit(info); - - engine.generate(); - - verify(visitor).visitManipulationResult(eq(metadata)); - verify(result).visitClassStructure(any(Element.class)); - verify(result).visitManipulatedResource(eq(path), any(byte[].class)); - verify(result).visitManipulatedResource(eq(innerPath), any(byte[].class)); - verify(result).visitEnd(); - - } - - private byte[] from(Class type) throws IOException { - ClassLoader loader = type.getClassLoader(); - InputStream is = loader.getResourceAsStream(Strings.asResourcePath(type.getName())); - return Streams.readBytes(is); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProviderTestCase.java deleted file mode 100644 index 6df1bb72d0..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/DirectManifestProviderTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.manipulator.manifest; - -import junit.framework.TestCase; - -import java.util.jar.Manifest; - -public class DirectManifestProviderTestCase extends TestCase { - public void testGetManifest() throws Exception { - Manifest origin = new Manifest(); - DirectManifestProvider provider = new DirectManifestProvider(origin); - - assertSame(origin, provider.getManifest()); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProviderTestCase.java deleted file mode 100644 index bb96b0ef5d..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/manifest/FileManifestProviderTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.manifest; - -import junit.framework.TestCase; - -import java.io.File; -import java.util.jar.Manifest; - -public class FileManifestProviderTestCase extends TestCase { - public void testGetManifest() throws Exception { - File manifestFile = new File(new File("target", "test-classes"), "MANIFEST.MF"); - FileManifestProvider provider = new FileManifestProvider(manifestFile); - - Manifest manifest = provider.getManifest(); - - assertNotNull(manifest); - assertEquals("tests.manipulation.java5", manifest.getMainAttributes().getValue("Bundle-SymbolicName")); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProviderTestCase.java deleted file mode 100644 index d469495f7c..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/AnnotationMetadataProviderTestCase.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.apache.felix.ipojo.metadata.Element; -import test.AnnotatedComponent; -import test.FakeAnnotation; - -import java.io.IOException; -import java.io.InputStream; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import static org.mockito.Mockito.mock; - -public class AnnotationMetadataProviderTestCase extends TestCase { - public void testGetMetadatas() throws Exception { - MiniStore store = new MiniStore(AnnotatedComponent.class, FakeAnnotation.class); - Reporter reporter = mock(Reporter.class); - AnnotationMetadataProvider provider = new AnnotationMetadataProvider(store, reporter); - - List meta = provider.getMetadatas(); - assertEquals(1, meta.size()); - - - } - - private class MiniStore implements ResourceStore { - - private Map resources; - - public MiniStore(Class... classes) throws IOException { - this.resources = new HashMap(); - for (Class type : classes) { - resources.put(Strings.asResourcePath(type.getName()), from(type)); - } - } - - public byte[] read(String path) throws IOException { - byte[] bytes = resources.get(path); - if (bytes == null) { - throw new IOException(); - } - return bytes; - } - - public void accept(ResourceVisitor visitor) { - for (Map.Entry entry : resources.entrySet()) { - visitor.visit(entry.getKey()); - } - } - - public void open() throws IOException {} - - public void writeMetadata(Element metadata) {} - - public void write(String resourcePath, byte[] resource) throws IOException {} - - public void close() throws IOException {} - } - - private byte[] from(Class type) throws IOException { - ClassLoader loader = type.getClassLoader(); - InputStream is = loader.getResourceAsStream(Strings.asResourcePath(type.getName())); - return Streams.readBytes(is); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProviderTestCase.java deleted file mode 100644 index 4f423f5101..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CacheableMetadataProviderTestCase.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.metadata.Element; - -import java.util.Collections; - -import static org.mockito.Mockito.*; - -public class CacheableMetadataProviderTestCase extends TestCase { - public void testGetMetadatas() throws Exception { - MetadataProvider delegate = mock(MetadataProvider.class); - CacheableMetadataProvider provider = new CacheableMetadataProvider(delegate); - - Element returned = new Element("test", null); - when(delegate.getMetadatas()).thenReturn(Collections.singletonList(returned)); - - provider.getMetadatas(); - provider.getMetadatas(); - provider.getMetadatas(); - provider.getMetadatas(); - - verify(delegate, atMost(1)).getMetadatas(); - - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProviderTestCase.java deleted file mode 100644 index 96367ad2b9..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/CompositeMetadataProviderTestCase.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.MetadataProvider; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import java.util.Collections; -import java.util.List; - -import static org.mockito.Mockito.*; - -public class CompositeMetadataProviderTestCase extends TestCase { - - @Mock - private MetadataProvider delegate1; - - @Mock - private MetadataProvider delegate2; - - @Mock - private Reporter reporter; - - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testGetMetadatas() throws Exception { - CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter); - provider.addMetadataProvider(delegate1); - provider.addMetadataProvider(delegate2); - - Element returned = newComponentElement("type1"); - when(delegate1.getMetadatas()).thenReturn(Collections.singletonList(returned)); - - Element returned2 = newComponentElement("type2"); - when(delegate2.getMetadatas()).thenReturn(Collections.singletonList(returned2)); - - List meta = provider.getMetadatas(); - assertEquals(2, meta.size()); - } - - public void testGetMetadatasWithDuplicate() throws Exception { - CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter); - provider.addMetadataProvider(delegate1); - provider.addMetadataProvider(delegate2); - - Element returned = newComponentElement("type1"); - when(delegate1.getMetadatas()).thenReturn(Collections.singletonList(returned)); - - Element returned2 = newComponentElement("type1"); - when(delegate2.getMetadatas()).thenReturn(Collections.singletonList(returned2)); - - List meta = provider.getMetadatas(); - assertEquals(1, meta.size()); - - verify(reporter).warn(anyString()); - } - - public void testGetMetadatasWithInstances() throws Exception { - CompositeMetadataProvider provider = new CompositeMetadataProvider(reporter); - provider.addMetadataProvider(delegate1); - provider.addMetadataProvider(delegate2); - - Element returned = newInstanceElement("type1", "name1"); - when(delegate1.getMetadatas()).thenReturn(Collections.singletonList(returned)); - - // Try with a duplicate instance name - Element returned2 = newInstanceElement("type1", "name2"); - when(delegate2.getMetadatas()).thenReturn(Collections.singletonList(returned2)); - - List meta = provider.getMetadatas(); - assertEquals(2, meta.size()); - } - - private Element newComponentElement(String type) { - Element main = new Element("component", null); - main.addAttribute(new Attribute("name", type)); - return main; - } - - private Element newInstanceElement(String type, String name) { - Element main = new Element("instance", null); - main.addAttribute(new Attribute("component", type)); - main.addAttribute(new Attribute("name", name)); - return main; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProviderTestCase.java deleted file mode 100644 index d61604b985..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/EmptyMetadataProviderTestCase.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; - -public class EmptyMetadataProviderTestCase extends TestCase { - public void testGetMetadatas() throws Exception { - EmptyMetadataProvider provider = new EmptyMetadataProvider(); - assertTrue(provider.getMetadatas().isEmpty()); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProviderTestCase.java deleted file mode 100644 index 47a16dd87c..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/FileMetadataProviderTestCase.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.File; -import java.util.List; - -import static org.mockito.Mockito.mock; - -public class FileMetadataProviderTestCase extends TestCase { - public void testGetMetadatasFromFile() throws Exception { - File metadata = new File(new File("target", "test-classes"), "metadata.xml"); - Reporter reporter = mock(Reporter.class); - FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter); - provider.setValidateUsingLocalSchemas(true); - - List meta = provider.getMetadatas(); - assertEquals(3, meta.size()); - } - - public void testGetMetadatasFromDirectory() throws Exception { - File metadata = new File("target", "test-classes"); - Reporter reporter = mock(Reporter.class); - FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter); - provider.setValidateUsingLocalSchemas(true); - - List meta = provider.getMetadatas(); - assertEquals(3, meta.size()); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProviderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProviderTestCase.java deleted file mode 100644 index c8a67da3cd..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/StreamMetadataProviderTestCase.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Element; - -import java.io.File; -import java.io.FileInputStream; -import java.util.List; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class StreamMetadataProviderTestCase extends TestCase { - - public void testGetMetadatas() throws Exception { - File metadata = new File(new File("target", "test-classes"), "metadata.xml"); - FileInputStream fis = new FileInputStream(metadata); - Reporter reporter = mock(Reporter.class); - - StreamMetadataProvider provider = new StreamMetadataProvider(fis, reporter); - provider.setValidateUsingLocalSchemas(true); - - List meta = provider.getMetadatas(); - assertEquals(3, meta.size()); - } - - public void testWithEmptyMetadataXml() throws Exception { - File metadata = new File(new File("target", "test-classes"), "empty-metadata.xml"); - FileInputStream fis = new FileInputStream(metadata); - Reporter reporter = mock(Reporter.class); - - StreamMetadataProvider provider = new StreamMetadataProvider(fis, reporter); - provider.setValidateUsingLocalSchemas(true); - - List meta = provider.getMetadatas(); - assertEquals(0, meta.size()); - verify(reporter).warn(anyString()); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbenchTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbenchTestCase.java deleted file mode 100644 index 428305557a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/ComponentWorkbenchTestCase.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.tree.ClassNode; - -/** - * Created with IntelliJ IDEA. - * User: guillaume - * Date: 10/12/12 - * Time: 11:17 AM - * To change this template use File | Settings | File Templates. - */ -public class ComponentWorkbenchTestCase extends TestCase { - public void testBuildWithNoTopLevelElements() throws Exception { - - ComponentWorkbench workbench = new ComponentWorkbench(null, node()); - Element built = workbench.build(); - assertNull(built); - - } - - public void testSimpleBuild() throws Exception { - - Element root = new Element("root", null); - - ComponentWorkbench workbench = new ComponentWorkbench(null, node()); - workbench.setRoot(root); - Element built = workbench.build(); - - assertEquals("root", built.getName()); - assertNull(built.getNameSpace()); - assertEquals(0, built.getAttributes().length); - assertEquals(0, built.getElements().length); - - } - - public void testElementsAreHierarchicallyPlaced() throws Exception { - - Element root = new Element("root", null); - Element child = new Element("child", null); - - ComponentWorkbench workbench = new ComponentWorkbench(null, node()); - workbench.setRoot(root); - workbench.getElements().put(child, null); - - Element built = workbench.build(); - - assertEquals("root", built.getName()); - assertNull(built.getNameSpace()); - assertEquals(0, built.getAttributes().length); - assertEquals(1, built.getElements().length); - - Element builtChild = built.getElements("child")[0]; - - assertEquals("child", builtChild.getName()); - assertNull(builtChild.getNameSpace()); - assertEquals(0, builtChild.getAttributes().length); - assertEquals(0, builtChild.getElements().length); - - - } - - - public static ClassNode node() { - ClassNode node = new ClassNode(); - node.name = "my/Component"; - return node; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlaybackTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlaybackTestCase.java deleted file mode 100644 index 05c1c682cf..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/AnnotationPlaybackTestCase.java +++ /dev/null @@ -1,196 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal; - -import java.lang.annotation.Annotation; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.AnnotationPlayback; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.AnnotationAnnotation; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.ArrayAnnotation; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.EnumAnnotation; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.InnerAnnotation; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.Mode; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.SimpleTypes; -import org.apache.felix.ipojo.manipulator.metadata.annotation.model.literal.types.Support; -import org.mockito.Mock; - -import static org.mockito.Matchers.anyBoolean; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.ClassVisitor; -import org.objectweb.asm.Type; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 08/07/13 - * Time: 17:25 - */ - -public class AnnotationPlaybackTestCase extends TestCase { - - @Mock - private ClassVisitor visitor; - - @Mock - private AnnotationVisitor annotationVisitor; - - @Mock - private AnnotationVisitor arrayVisitor; - - @Mock - private AnnotationVisitor innerAnnotationVisitor; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testSimpleValuesPlayback() throws Exception { - - when(visitor.visitAnnotation(anyString(), anyBoolean())).thenReturn(annotationVisitor); - - AnnotationPlayback playback = new AnnotationPlayback(find(SimpleTypes.class)); - playback.accept(visitor); - - verify(visitor).visitAnnotation(Type.getType(SimpleTypes.class).getDescriptor(), - true); - verify(annotationVisitor).visitEnd(); - - // Verify simple mono-valued attributes - verify(annotationVisitor).visit("aByte", Byte.valueOf((byte) 42)); - verify(annotationVisitor).visit("aBoolean", Boolean.TRUE); - verify(annotationVisitor).visit("anInt", Integer.valueOf(42)); - verify(annotationVisitor).visit("aLong", Long.valueOf(42)); - verify(annotationVisitor).visit("aShort", Short.valueOf((short) 42)); - verify(annotationVisitor).visit("aFloat", Float.valueOf(42)); - verify(annotationVisitor).visit("aDouble", Double.valueOf(42)); - verify(annotationVisitor).visit("aChar", Character.valueOf('a')); - - // Verify String & Class - verify(annotationVisitor).visit("aString", "42"); - verify(annotationVisitor).visit("aClass", Type.getType(String.class)); - - // Verify array os simple types - verify(annotationVisitor).visit("arrayOfByte", new byte[] {(byte) 42}); - verify(annotationVisitor).visit("arrayOfBoolean", new boolean[] {true, true}); - verify(annotationVisitor).visit("arrayOfInt", new int[] {42}); - verify(annotationVisitor).visit("arrayOfLong", new long[] {42}); - verify(annotationVisitor).visit("arrayOfShort", new short[] {42}); - verify(annotationVisitor).visit("arrayOfFloat", new float[] {42}); - verify(annotationVisitor).visit("arrayOfDouble", new double[] {}); - verify(annotationVisitor).visit("arrayOfChar", new char[] {'a', 'b', 'c'}); - - } - - public void testEnumValuesPlayback() throws Exception { - - when(visitor.visitAnnotation(anyString(), anyBoolean())).thenReturn(annotationVisitor); - - AnnotationPlayback playback = new AnnotationPlayback(find(EnumAnnotation.class)); - playback.accept(visitor); - - verify(visitor).visitAnnotation(Type.getType(EnumAnnotation.class).getDescriptor(), - true); - verify(annotationVisitor).visitEnd(); - - String desc = Type.getType(Mode.class).getDescriptor(); - verify(annotationVisitor).visitEnum("noDefault", desc, "IN"); - verify(annotationVisitor).visitEnum("withDefault", desc, "IN"); - verify(annotationVisitor).visitEnum("withDefaultOverridden", desc, "IN"); - } - - public void testArrayValuesPlayback() throws Exception { - - AnnotationVisitor arrayOfString = mock(AnnotationVisitor.class); - AnnotationVisitor arrayOfEnum = mock(AnnotationVisitor.class); - AnnotationVisitor arrayOfClass = mock(AnnotationVisitor.class); - AnnotationVisitor arrayOfAnnotation = mock(AnnotationVisitor.class); - AnnotationVisitor emptyArray = mock(AnnotationVisitor.class); - - when(visitor.visitAnnotation(anyString(), anyBoolean())).thenReturn(annotationVisitor); - when(annotationVisitor.visitArray("arrayOfString")).thenReturn(arrayOfString); - when(annotationVisitor.visitArray("arrayOfEnum")).thenReturn(arrayOfEnum); - when(annotationVisitor.visitArray("arrayOfClass")).thenReturn(arrayOfClass); - when(annotationVisitor.visitArray("arrayOfAnnotation")).thenReturn(arrayOfAnnotation); - when(annotationVisitor.visitArray("emptyArray")).thenReturn(emptyArray); - - AnnotationPlayback playback = new AnnotationPlayback(find(ArrayAnnotation.class)); - playback.accept(visitor); - - verify(visitor).visitAnnotation(Type.getType(ArrayAnnotation.class).getDescriptor(), - true); - verify(annotationVisitor).visitEnd(); - - String desc = Type.getType(Mode.class).getDescriptor(); - - verify(arrayOfString).visit(null, "42"); - verify(arrayOfString).visit(null, "43"); - verify(arrayOfString).visitEnd(); - - verify(arrayOfEnum).visitEnum(null, desc, "IN"); - verify(arrayOfEnum).visitEnd(); - - verify(arrayOfClass).visit(null, Type.getType(Object.class)); - verify(arrayOfClass).visitEnd(); - - verify(arrayOfAnnotation).visitAnnotation(null, Type.getType(InnerAnnotation.class).getDescriptor()); - verify(arrayOfAnnotation).visitEnd(); - - verify(emptyArray).visitEnd(); - - } - - - public void testAnnotationValuesPlayback() throws Exception { - - when(visitor.visitAnnotation(anyString(), anyBoolean())).thenReturn(annotationVisitor); - when(annotationVisitor.visitAnnotation("value", Type.getType(InnerAnnotation.class).getDescriptor())) - .thenReturn(innerAnnotationVisitor); - when(innerAnnotationVisitor.visitArray("arrayOfClass")) - .thenReturn(arrayVisitor); - - AnnotationPlayback playback = new AnnotationPlayback(find(AnnotationAnnotation.class)); - playback.accept(visitor); - - verify(visitor).visitAnnotation(Type.getType(AnnotationAnnotation.class).getDescriptor(), - true); - verify(annotationVisitor).visitEnd(); - - String desc = Type.getType(Mode.class).getDescriptor(); - verify(innerAnnotationVisitor).visit("aString", "42"); - verify(innerAnnotationVisitor).visitEnum("modeEnum", desc, "IN"); - verify(innerAnnotationVisitor).visitEnd(); - - verify(arrayVisitor).visit(null, Type.getType(Object.class)); - verify(arrayVisitor).visitEnd(); - - } - private Annotation find(final Class type) { - return Support.class.getAnnotation(type); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/AnnotationAnnotation.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/AnnotationAnnotation.java deleted file mode 100644 index c707d7dc2d..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/AnnotationAnnotation.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 10:15 - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface AnnotationAnnotation { - InnerAnnotation value(); -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/ArrayAnnotation.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/ArrayAnnotation.java deleted file mode 100644 index 92bee87ef9..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/ArrayAnnotation.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 10:15 - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface ArrayAnnotation { - String[] arrayOfString(); - Class[] arrayOfClass(); - Mode[] arrayOfEnum(); - InnerAnnotation[] arrayOfAnnotation(); - Mode[] emptyArray() default {}; -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/EnumAnnotation.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/EnumAnnotation.java deleted file mode 100644 index 9ec1a4a449..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/EnumAnnotation.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 10:15 - */ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface EnumAnnotation { - Mode noDefault(); - Mode withDefault() default Mode.IN; - Mode withDefaultOverridden() default Mode.OUT; -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/InnerAnnotation.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/InnerAnnotation.java deleted file mode 100644 index 4bdfbd7782..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/InnerAnnotation.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 10:15 - */ -@Retention(RetentionPolicy.RUNTIME) -public @interface InnerAnnotation { - String aString() default "42"; - Class[] arrayOfClass() default {}; - Mode modeEnum() default Mode.IN; -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Mode.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Mode.java deleted file mode 100644 index dec0af2325..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Mode.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -/** - * User: guillaume - * Date: 09/07/13 - * Time: 10:14 - */ -public enum Mode { - IN, OUT -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/SimpleTypes.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/SimpleTypes.java deleted file mode 100644 index c59296213f..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/SimpleTypes.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** -* User: guillaume -* Date: 08/07/13 -* Time: 17:37 -*/ -@Target(ElementType.TYPE) -@Retention(RetentionPolicy.RUNTIME) -public @interface SimpleTypes { - boolean aBoolean() default true; - byte aByte() default 42; - long aLong() default 42; - int anInt() default 42; - short aShort() default 42; - float aFloat() default 42; - double aDouble() default 42; - char aChar() default 'a'; - - String aString() default "42"; - Class aClass() default String.class; - - boolean[] arrayOfBoolean() default {true, true}; - byte[] arrayOfByte() default {42}; - long[] arrayOfLong() default {42}; - int[] arrayOfInt() default {42}; - short[] arrayOfShort() default {42}; - float[] arrayOfFloat() default 42; - double[] arrayOfDouble() default {}; - char[] arrayOfChar() default {'a', 'b', 'c'}; - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Support.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Support.java deleted file mode 100644 index 3c2bee6274..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/literal/types/Support.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.literal.types; - -/** - * User: guillaume - * Date: 08/07/13 - * Time: 17:36 - */ -@SimpleTypes -@EnumAnnotation( - noDefault = Mode.IN, - withDefaultOverridden = Mode.IN -) -@ArrayAnnotation( - arrayOfString = {"42", "43"}, - arrayOfEnum = Mode.IN, - arrayOfClass = Object.class, - arrayOfAnnotation = @InnerAnnotation() -) -@AnnotationAnnotation( - @InnerAnnotation( - arrayOfClass = Object.class - ) -) -public class Support { -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorderTestCase.java deleted file mode 100644 index fdd9244544..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/model/parser/replay/AnnotationRecorderTestCase.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.model.parser.replay; - -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.AnnotationVisitor; - -import junit.framework.TestCase; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -/** - * User: guillaume - * Date: 30/05/13 - * Time: 22:04 - */ -public class AnnotationRecorderTestCase extends TestCase { - - @Mock - private AnnotationVisitor visitor; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testVisitRecord() throws Exception { - AnnotationRecorder recorder = new AnnotationRecorder(); - recorder.visit("attribute", "a value"); - recorder.accept(visitor); - verify(visitor).visit("attribute", "a value"); - } - - public void testVisitEndRecord() throws Exception { - AnnotationRecorder recorder = new AnnotationRecorder(); - recorder.visitEnd(); - recorder.accept(visitor); - verify(visitor).visitEnd(); - } - - public void testVisitEnumRecord() throws Exception { - AnnotationRecorder recorder = new AnnotationRecorder(); - recorder.visitEnum("name", "type-desc", "A"); - recorder.accept(visitor); - verify(visitor).visitEnum("name", "type-desc", "A"); - } - - public void testVisitAnnotationRecord() throws Exception { - - when(visitor.visitAnnotation("name", "type-desc")).thenReturn(visitor); - - AnnotationRecorder recorder = new AnnotationRecorder(); - AnnotationVisitor sub = recorder.visitAnnotation("name", "type-desc"); - sub.visit("name2", "value2"); - recorder.accept(visitor); - - verify(visitor).visitAnnotation("name", "type-desc"); - verify(visitor).visit("name2", "value2"); - } - - public void testVisitArrayRecord() throws Exception { - - when(visitor.visitArray("name")).thenReturn(visitor); - - AnnotationRecorder recorder = new AnnotationRecorder(); - AnnotationVisitor sub = recorder.visitArray("name"); - sub.visit("name2", "value2"); - recorder.accept(visitor); - - verify(visitor).visitArray("name"); - verify(visitor).visit("name2", "value2"); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistryTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistryTestCase.java deleted file mode 100644 index 9ff6a5a1df..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/CompletableBindingRegistryTestCase.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.Type; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 12/07/13 - * Time: 10:27 - */ -public class CompletableBindingRegistryTestCase extends TestCase { - - public static final String DESCRIPTOR = "[unknown;"; - - @Mock - private BindingRegistry delegate; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testUnknownDescriptorTriggerCallback() throws Exception { - EmptyCompletableBindingRegistry registry = new EmptyCompletableBindingRegistry(delegate); - when(delegate.getBindings(DESCRIPTOR)).thenReturn(Collections.emptyList()); - - registry.getBindings(DESCRIPTOR); - - assertNotNull(registry.type); - } - - public void testKnownDescriptorDoNotTriggerCallback() throws Exception { - EmptyCompletableBindingRegistry registry = new EmptyCompletableBindingRegistry(delegate); - when(delegate.getBindings(DESCRIPTOR)).thenReturn(Collections.singletonList(new NullBinding(Type.getType(DESCRIPTOR)))); - - registry.getBindings(DESCRIPTOR); - - assertNull(registry.type); - } - - private static class EmptyCompletableBindingRegistry extends CompletableBindingRegistry { - - public Type type = null; - - public EmptyCompletableBindingRegistry(final BindingRegistry delegate) { - super(delegate, null); - } - - @Override - protected List createBindings(final Type type) { - this.type = type; - return Collections.emptyList(); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistryTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistryTestCase.java deleted file mode 100644 index 54959295ee..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/DefaultBindingRegistryTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.Predicate; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.Type; - -import java.util.Collections; -import java.util.List; - -/** - * Created with IntelliJ IDEA. - * User: guillaume - * Date: 10/11/12 - * Time: 10:31 AM - * To change this template use File | Settings | File Templates. - */ -public class DefaultBindingRegistryTestCase extends TestCase { - - public static final Type PROVIDES_TYPE = Type.getType(Provides.class); - private BindingRegistry registry; - - @Mock - private Reporter reporter; - @Mock - private AnnotationVisitorFactory factory; - @Mock - private Predicate predicate; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - registry = new DefaultBindingRegistry(reporter); - } - - public void testBindingAddition() throws Exception { - registry.addBindings(Collections.singletonList(binding())); - - List predicates = registry.getBindings(Type.getType(Provides.class).getDescriptor()); - - assertEquals(1, predicates.size()); - Binding found = predicates.get(0); - assertNotNull(found); - assertEquals(predicate, found.getPredicate()); - assertEquals(factory, found.getFactory()); - } - - public void testGetBindingsWhenEmpty() throws Exception { - assertTrue(registry.getBindings(PROVIDES_TYPE.getDescriptor()).isEmpty()); - } - - private Binding binding() { - Binding binding = new Binding(); - binding.setAnnotationType(PROVIDES_TYPE); - binding.setFactory(factory); - binding.setPredicate(predicate); - return binding; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistryTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistryTestCase.java deleted file mode 100644 index d06fda99e4..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/IgnoreAllBindingRegistryTestCase.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 17:36 - */ -public class IgnoreAllBindingRegistryTestCase extends TestCase { - public static final String UNKNOWN_DESCRIPTOR = "[unknown;"; - - @Mock - private BindingRegistry delegate; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testThatNullBindingIsGenerated() throws Exception { - when(delegate.getBindings(UNKNOWN_DESCRIPTOR)).thenReturn(Collections.emptyList()); - - IgnoreAllBindingRegistry registry = new IgnoreAllBindingRegistry(delegate, null); - - List bindings = registry.getBindings(UNKNOWN_DESCRIPTOR); - assertTrue(bindings.get(0) instanceof NullBinding); - - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistryTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistryTestCase.java deleted file mode 100644 index d87ea560de..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/LegacyGenericBindingRegistryTestCase.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static org.mockito.Mockito.verify; -import static org.mockito.Mockito.when; - -import java.util.Collections; -import java.util.List; - -import org.mockito.ArgumentCaptor; -import org.mockito.Captor; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.Type; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 11/07/13 - * Time: 17:07 - */ -public class LegacyGenericBindingRegistryTestCase extends TestCase { - - public static final String AN_IGNORED_ANNOTATION = "[Lan.ignored.Annotation;"; - public static final String RECOGNISED_IPOJO_ANNOTATION = "[La.recognised.ipojo.Annotation;"; - public static final String RECOGNISED_HANDLER_ANNOTATION = "[La.recognised.handler.Annotation;"; - - @Mock - private BindingRegistry delegate; - - @Captor - ArgumentCaptor> capture; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testNonRecognisedTypeAreIgnored() throws Exception { - when(delegate.getBindings(AN_IGNORED_ANNOTATION)).thenReturn(Collections.emptyList()); - - LegacyGenericBindingRegistry registry = new LegacyGenericBindingRegistry(delegate, null); - - List bindings = registry.getBindings(AN_IGNORED_ANNOTATION); - assertTrue(bindings.isEmpty()); - - verify(delegate).addBindings(capture.capture()); - assertTrue(capture.getValue().isEmpty()); - } - - public void testIPojoRecognisedTypeAreSupported() throws Exception { - when(delegate.getBindings(RECOGNISED_IPOJO_ANNOTATION)).thenReturn(Collections.emptyList()); - - LegacyGenericBindingRegistry registry = new LegacyGenericBindingRegistry(delegate, null); - - List bindings = registry.getBindings(RECOGNISED_IPOJO_ANNOTATION); - assertEquals(1, bindings.size()); - - verify(delegate).addBindings(capture.capture()); - Binding one = capture.getValue().get(0); - assertEquals(Type.getType(RECOGNISED_IPOJO_ANNOTATION), one.getAnnotationType()); - } - - public void testHandlerRecognisedTypeAreSupported() throws Exception { - when(delegate.getBindings(RECOGNISED_HANDLER_ANNOTATION)).thenReturn(Collections.emptyList()); - - LegacyGenericBindingRegistry registry = new LegacyGenericBindingRegistry(delegate, null); - - List bindings = registry.getBindings(RECOGNISED_HANDLER_ANNOTATION); - assertEquals(1, bindings.size()); - - verify(delegate).addBindings(capture.capture()); - Binding one = capture.getValue().get(0); - assertEquals(Type.getType(RECOGNISED_HANDLER_ANNOTATION), one.getAnnotationType()); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistryTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistryTestCase.java deleted file mode 100644 index 29d82d96df..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/MetaAnnotationBindingRegistryTestCase.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - -import java.io.IOException; -import java.io.InputStream; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.HandlerBinding; -import org.apache.felix.ipojo.annotations.Ignore; -import org.apache.felix.ipojo.annotations.Stereotype; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.stereotype.StereotypeVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.manipulator.util.Strings; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.Type; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 12/07/13 - * Time: 12:13 - */ -public class MetaAnnotationBindingRegistryTestCase extends TestCase { - - public static final String DESCRIPTOR = "[Lunknown;"; - public static final Type TYPE = Type.getType(DESCRIPTOR); - - @Mock - private BindingRegistry delegate; - - @Mock - private ResourceStore store; - - @Mock - private Reporter reporter; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - when(delegate.getBindings(DESCRIPTOR)).thenReturn(Collections.emptyList()); - } - - public void testAnnotationTypeResourceNotFound() throws Exception { - when(store.read(anyString())) - .thenThrow(IOException.class); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - assertTrue(registry.getBindings(DESCRIPTOR).isEmpty()); - } - - public void testClassicalAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(Classical.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - assertTrue(registry.getBindings(Type.getDescriptor(Classical.class)).isEmpty()); - } - - public void testStereotypeAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(Stereotyped.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - Binding binding = registry.getBindings(Type.getDescriptor(Stereotyped.class)).get(0); - assertTrue(binding.getFactory() instanceof StereotypeVisitorFactory); - } - - public void testHandlerBindingAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(Bound.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - Binding binding = registry.getBindings(Type.getDescriptor(Bound.class)).get(0); - assertTrue(binding.getFactory() instanceof GenericVisitorFactory); - } - - public void testIgnoreAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(Ignored.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - Binding binding = registry.getBindings(Type.getDescriptor(Ignored.class)).get(0); - assertTrue(binding instanceof NullBinding); - } - - public void testBothStereotypeAndBindingAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(StereotypedBinding.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - List bindings = registry.getBindings(Type.getDescriptor(StereotypedBinding.class)); - assertEquals(2, bindings.size()); - assertHasVisitorFactories(bindings, StereotypeVisitorFactory.class, GenericVisitorFactory.class); - } - - public void testIgnoredWithStereotypeAnnotation() throws Exception { - when(store.read(anyString())) - .thenReturn(from(StereotypedIgnoredBinding.class)); - MetaAnnotationBindingRegistry registry = new MetaAnnotationBindingRegistry(delegate, reporter, store); - List bindings = registry.getBindings(Type.getDescriptor(StereotypedIgnoredBinding.class)); - assertEquals(1, bindings.size()); - assertHasVisitorFactories(bindings, NullVisitorFactory.class); - } - - private void assertHasVisitorFactories(final List bindings, - final Class... factories) { - List> existing = new ArrayList>(); - for (Binding binding : bindings) { - existing.add(binding.getFactory().getClass()); - } - - for (Class factory : factories) { - if (!existing.remove(factory)) { - fail("Bindings do not contains expected AnnotationVisitorFactory type: " + factory.getName()); - } - } - } - - private byte[] from(Class type) throws IOException { - ClassLoader loader = type.getClassLoader(); - InputStream is = loader.getResourceAsStream(Strings.asResourcePath(type.getName())); - return Streams.readBytes(is); - } - - private static @interface Classical {} - - @Component - @Stereotype - private static @interface Stereotyped {} - - @HandlerBinding - private static @interface Bound {} - - @Ignore - private static @interface Ignored {} - - @Component - @Stereotype - @HandlerBinding - private static @interface StereotypedBinding {} - - @Component - @Stereotype - @HandlerBinding - @Ignore - private static @interface StereotypedIgnoredBinding {} - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/SelectionTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/SelectionTestCase.java deleted file mode 100644 index 8ae37f92fe..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/registry/SelectionTestCase.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.registry; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.spi.AbsBindingModule; -import org.apache.felix.ipojo.manipulator.spi.AnnotationVisitorFactory; -import org.apache.felix.ipojo.manipulator.spi.BindingContext; -import org.hamcrest.Matcher; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; -import org.objectweb.asm.AnnotationVisitor; -import org.objectweb.asm.Type; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.FieldNode; -import org.objectweb.asm.tree.MethodNode; - -import java.io.IOException; -import java.lang.annotation.Annotation; -import java.lang.annotation.ElementType; -import java.lang.annotation.Target; - -import static org.hamcrest.CoreMatchers.equalTo; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.mockito.Matchers.any; -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.when; - -/** - * Created with IntelliJ IDEA. - * User: guillaume - * Date: 10/11/12 - * Time: 10:49 AM - * To change this template use File | Settings | File Templates. - */ -public class SelectionTestCase extends TestCase { - private BindingRegistry registry; - - @Mock - private Reporter reporter; - @Mock - private AnnotationVisitorFactory factory; - @Mock - private AnnotationVisitor visitor; - @Mock - private ResourceStore store; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - registry = new DefaultBindingRegistry(reporter); - when(factory.newAnnotationVisitor(any(BindingContext.class))) - .thenReturn(visitor); - // Simulate a resource not found exception - when(store.read(anyString())) - .thenThrow(new IOException()); - } - - public void testSelectionOnClassNodeOnly() throws Exception { - - AbsBindingModule module = new MonoBindingModule(OnTypeOnly.class); - module.load(); - registry.addBindings(module); - - // Verifications - assertClassSelection(OnTypeOnly.class, equalTo(visitor)); - assertFieldSelection(OnTypeOnly.class, nullValue()); - assertMethodSelection(OnTypeOnly.class, nullValue()); - assertParameterSelection(OnTypeOnly.class, nullValue()); - } - - public void testSelectionOnFieldNodeOnly() throws Exception { - - AbsBindingModule module = new MonoBindingModule(OnFieldOnly.class); - module.load(); - registry.addBindings(module); - - // Verifications - assertClassSelection(OnFieldOnly.class, nullValue()); - assertFieldSelection(OnFieldOnly.class, equalTo(visitor)); - assertMethodSelection(OnFieldOnly.class, nullValue()); - assertParameterSelection(OnFieldOnly.class, nullValue()); - - } - - public void testSelectionOnMethodNodeOnly() throws Exception { - - AbsBindingModule module = new MonoBindingModule(OnMethodOnly.class); - module.load(); - registry.addBindings(module); - - // Verifications - assertClassSelection(OnMethodOnly.class, nullValue()); - assertFieldSelection(OnMethodOnly.class, nullValue()); - assertMethodSelection(OnMethodOnly.class, equalTo(visitor)); - assertParameterSelection(OnMethodOnly.class, nullValue()); - - } - - public void testSelectionOnMethodParameterOnly() throws Exception { - - AbsBindingModule module = new MonoBindingModule(OnParameterOnly.class); - module.load(); - registry.addBindings(module); - - // Verifications - assertClassSelection(OnParameterOnly.class, nullValue()); - assertFieldSelection(OnParameterOnly.class, nullValue()); - assertMethodSelection(OnParameterOnly.class, nullValue()); - assertParameterSelection(OnParameterOnly.class, equalTo(visitor)); - - } - - public void testSelectionOBothMethodAndParameter() throws Exception { - - AbsBindingModule module = new MonoBindingModule(OnBothMethodAndParameter.class); - module.load(); - registry.addBindings(module); - - // Verifications - assertClassSelection(OnBothMethodAndParameter.class, nullValue()); - assertFieldSelection(OnBothMethodAndParameter.class, nullValue()); - assertMethodSelection(OnBothMethodAndParameter.class, equalTo(visitor)); - assertParameterSelection(OnBothMethodAndParameter.class, equalTo(visitor)); - - } - - private void assertClassSelection(Class type, Matcher matcher) { - Selection selection = new Selection(registry, null, reporter); - selection.type(null, classNode()); - selection.annotatedWith(descriptor(type)); - - assertTrue(matcher.matches(selection.get())); - } - - private void assertFieldSelection(Class type, Matcher matcher) { - Selection selection = new Selection(registry, null, reporter); - selection.field(null, fieldNode()); - selection.annotatedWith(descriptor(type)); - - assertTrue(matcher.matches(selection.get())); - } - - private void assertMethodSelection(Class type, Matcher matcher) { - Selection selection = new Selection(registry, null, reporter); - selection.method(null, methodNode()); - selection.annotatedWith(descriptor(type)); - - assertTrue(matcher.matches(selection.get())); - } - - private void assertParameterSelection(Class type, Matcher matcher) { - Selection selection = new Selection(registry, null, reporter); - selection.parameter(null, methodNode(), 0); - selection.annotatedWith(descriptor(type)); - - assertTrue(matcher.matches(selection.get())); - } - - private MethodNode methodNode() { - return new MethodNode(0, "method", "(java/lang/String)V", null, null); - } - - private ClassNode classNode() { - ClassNode node = new ClassNode(); - node.visit(0, 0, "my/Component", null, "java/lang/Object", null); - return node; - } - - public void testSelectionWithEmptyRegistry() throws Exception { - Selection selection = new Selection(registry, null, reporter); - - selection.field(null, fieldNode()) - .annotatedWith(descriptor(OnTypeOnly.class)); - - assertNull(selection.get()); - } - - private String descriptor(Class type) { - return Type.getType(type).getDescriptor(); - } - - private FieldNode fieldNode() { - return new FieldNode(0, - "field", - Type.getType(Object.class).getDescriptor(), - null, - null); - } - - @Target(ElementType.TYPE) - private @interface OnTypeOnly {} - - @Target(ElementType.FIELD) - private @interface OnFieldOnly {} - - @Target(ElementType.METHOD) - private @interface OnMethodOnly {} - - @Target(ElementType.PARAMETER) - private @interface OnParameterOnly {} - - @Target({ElementType.PARAMETER, ElementType.METHOD}) - private @interface OnBothMethodAndParameter {} - - - private class MonoBindingModule extends AbsBindingModule { - private Class type; - - public MonoBindingModule(Class aClass) { - this.type = aClass; - } - - public void configure() { - bind(type).to(factory); - } - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitorTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitorTestCase.java deleted file mode 100644 index c3f5914e14..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/ComponentVisitorTestCase.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Element; -import org.objectweb.asm.tree.ClassNode; - -import static org.mockito.Mockito.mock; - -/** - * Created with IntelliJ IDEA. - * User: guillaume - * Date: 10/10/12 - * Time: 5:46 PM - * To change this template use File | Settings | File Templates. - */ -public class ComponentVisitorTestCase extends TestCase { - - public void testDefaultNameIsClassname() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, clazz()); - ComponentVisitor visitor = new ComponentVisitor(workbench, reporter); - visitor.visitEnd(); - - Element root = workbench.getRoot(); - assertNotNull(root); - assertEquals("my.Component", root.getAttribute("name")); - } - - public void testNameAttribute() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, clazz()); - ComponentVisitor visitor = new ComponentVisitor(workbench, reporter); - visitor.visit("name", "changed"); - visitor.visitEnd(); - - Element root = workbench.getRoot(); - assertNotNull(root); - assertEquals("changed", root.getAttribute("name")); - } - - public void testPublicFactoryDeprecationSupport() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, clazz()); - ComponentVisitor visitor = new ComponentVisitor(workbench, reporter); - visitor.visit("public_factory", "false"); - visitor.visitEnd(); - - Element root = workbench.getRoot(); - assertNotNull(root); - assertEquals("false", root.getAttribute("public")); - } - - public void testFactoryMethodDeprecationSupport() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, clazz()); - ComponentVisitor visitor = new ComponentVisitor(workbench, reporter); - visitor.visit("factory_method", "create"); - visitor.visitEnd(); - - Element root = workbench.getRoot(); - assertNotNull(root); - assertEquals("create", root.getAttribute("factory-method")); - } - - private ClassNode clazz() { - ClassNode node = new ClassNode(); - node.name = "my/Component"; - return node; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitorTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitorTestCase.java deleted file mode 100644 index 1d5625828b..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/HandlerDeclarationVisitorTestCase.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.apache.felix.ipojo.metadata.Element; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbenchTestCase.node; -import static org.mockito.Mockito.mock; - -/** - * User: guillaume - * Date: 14/02/13 - * Time: 10:22 - */ -public class HandlerDeclarationVisitorTestCase extends TestCase { - - private Reporter reporter; - private ComponentWorkbench workbench; - private HandlerDeclarationVisitor visitor; - - @Override - public void setUp() throws Exception { - reporter = mock(Reporter.class); - workbench = new ComponentWorkbench(null, node()); - workbench.setRoot(new Element("container", null)); - visitor = new HandlerDeclarationVisitor(workbench, builder(), reporter); - } - - public void testElementConversionWithNoNamespace() throws Exception { - visitor.visit(null, ""); - visitor.visitEnd(); - - Element produced = workbench.build(); - Element testing = produced.getElements("testing")[0]; - assertEquals(0, testing.getElements().length); - assertEquals(0, testing.getAttributes().length); - } - - public void testElementConversionWithNamespace() throws Exception { - visitor.visit(null, ""); - visitor.visitEnd(); - - Element produced = workbench.build(); - Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0]; - assertEquals(0, testing.getElements().length); - assertEquals(0, testing.getAttributes().length); - assertNotNull(produced.getElements("org.apache.felix.ipojo.testing:testing")); - assertNull(produced.getElements("testing")); - } - - public void testAttributeConversionWithNamespace() throws Exception { - visitor.visit(null, ""); - visitor.visitEnd(); - - Element produced = workbench.build(); - Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0]; - assertEquals(0, testing.getElements().length); - assertEquals(1, testing.getAttributes().length); - assertEquals("Guillaume", testing.getAttribute("name", "org.apache.felix.ipojo.testing")); - assertEquals("Guillaume", testing.getAttribute("org.apache.felix.ipojo.testing:name")); - } - - public void testAttributeConversionWithNoNamespace() throws Exception { - visitor.visit(null, ""); - visitor.visitEnd(); - - Element produced = workbench.build(); - Element testing = produced.getElements("testing", "org.apache.felix.ipojo.testing")[0]; - assertEquals(0, testing.getElements().length); - assertEquals(1, testing.getAttributes().length); - assertEquals("Guillaume", testing.getAttribute("name")); - } - - private DocumentBuilder builder() throws ParserConfigurationException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); - return factory.newDocumentBuilder(); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitorTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitorTestCase.java deleted file mode 100644 index b9361bc3c2..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/bind/MethodBindVisitorTestCase.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.bind; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.anyVararg; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.metadata.annotation.ComponentWorkbench; -import org.objectweb.asm.tree.ClassNode; -import org.objectweb.asm.tree.MethodNode; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 22/05/13 - * Time: 17:09 - */ -public class MethodBindVisitorTestCase extends TestCase { - - public void testIdentifierProvided() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, type()); - MethodNode node = new MethodNode(); - node.name = "myMethod"; - - MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter); - visitor.visit("id", "my-identifier"); - visitor.visitEnd(); - - assertNotNull(workbench.getIds().get("my-identifier")); - } - - public void testNoIdentifierButSpecificationAsAttributeProvided() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, type()); - MethodNode node = new MethodNode(); - node.name = "notify"; - node.desc = "()V"; - - MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter); - visitor.visit("specification", "my.Service"); - visitor.visitEnd(); - - assertNotNull(workbench.getIds().get("my.Service")); - } - - public void testNoIdentifierAndNoSpecificationProvided() throws Exception { - Reporter reporter = mock(Reporter.class); - ComponentWorkbench workbench = new ComponentWorkbench(null, type()); - MethodNode node = new MethodNode(); - node.name = "notify"; - node.desc = "()V"; - - MethodBindVisitor visitor = new MethodBindVisitor(workbench, Action.BIND, node, reporter); - visitor.visitEnd(); - - verify(reporter).error(anyString(), anyVararg()); - } - - private static ClassNode type() { - ClassNode node = new ClassNode(); - node.name = "my/Component"; - return node; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/NamesTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/NamesTestCase.java deleted file mode 100644 index f1d7035448..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/metadata/annotation/visitor/util/NamesTestCase.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.ipojo.manipulator.metadata.annotation.visitor.util; - -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.computeEffectiveMethodName; -import static org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.util.Names.getMethodIdentifier; - -import org.objectweb.asm.tree.MethodNode; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 24/05/13 - * Time: 09:44 - */ -public class NamesTestCase extends TestCase { - public void testComputeEffectiveMethodNameForNotManipulatedMethod() throws Exception { - assertEquals("foo", computeEffectiveMethodName("foo")); - } - - public void testComputeEffectiveMethodNameForManipulatedMethod() throws Exception { - assertEquals("foo", computeEffectiveMethodName("__M_foo")); - } - - public void testComputeEffectiveMethodNameForNullInput() throws Exception { - assertNull(computeEffectiveMethodName(null)); - } - - public void testBindPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "bindService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testUnbindPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "unbindService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testSetPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "setService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testUnsetPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "unsetService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testAddPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "addService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testRemovePatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "removeService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testModifiedPatternRecognition() throws Exception { - MethodNode node = new MethodNode(); - node.name = "modifiedService"; - assertEquals("Service", getMethodIdentifier(node)); - } - - public void testNoPatternRecognized() throws Exception { - MethodNode node = new MethodNode(); - node.name = "notify"; - node.desc = "()V"; - assertNull(getMethodIdentifier(node)); - } - - public void testSpecificationRecognized() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Lmy/Service;)V"; - assertEquals("my.Service", getMethodIdentifier(node)); - } - - public void testSpecificationRecognizedWithMap() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Lmy/Service;Ljava/util/Map;)V"; - assertEquals("my.Service", getMethodIdentifier(node)); - } - - public void testSpecificationRecognizedWithDictionary() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Lmy/Service;Ljava/util/Dictionary;)V"; - assertEquals("my.Service", getMethodIdentifier(node)); - } - - public void testSpecificationRecognizedWithServiceReference() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Lmy/Service;Lorg/osgi/framework/ServiceReference;)V"; - assertEquals("my.Service", getMethodIdentifier(node)); - } - - public void testSpecificationRecognizedOnlyMap() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Ljava/util/Map;)V"; - assertNull(getMethodIdentifier(node)); - } - - public void testSpecificationRecognizedOnlyDictionary() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Ljava/util/Dictionary;)V"; - assertNull(getMethodIdentifier(node)); - - } - - public void testSpecificationRecognizedOnlyServiceReference() throws Exception { - MethodNode node = new MethodNode(); - node.name = "handle"; - node.desc = "(Lorg/osgi/framework/ServiceReference;)V"; - assertNull(getMethodIdentifier(node)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java deleted file mode 100644 index 64b446f36e..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/ManipulatedMetadataFilterTestCase.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.manipulator.render; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.manipulation.ClassManipulator; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -public class ManipulatedMetadataFilterTestCase extends TestCase { - - private ManipulatedMetadataFilter filter; - - @Override - public void setUp() throws Exception { - filter = new ManipulatedMetadataFilter(); - } - - public void testFilterPrefixedMethod() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", ClassManipulator.PREFIX + "PropertyName")); - - Assert.assertTrue(filter.accept(main)); - } - - public void testFilterInstanceManagerValue() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", InstanceManager.class.getName())); - - Assert.assertTrue(filter.accept(main)); - } - - public void testFilterInstanceManagerSetter() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", "_setInstanceManager")); - - Assert.assertTrue(filter.accept(main)); - } - - public void testDoNotFilterOthers() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", "setPropertyName")); - - Assert.assertFalse(filter.accept(main)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/MetadataRendererTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/MetadataRendererTestCase.java deleted file mode 100644 index e07a1fc926..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/render/MetadataRendererTestCase.java +++ /dev/null @@ -1,100 +0,0 @@ -/* - * 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.ipojo.manipulator.render; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -public class MetadataRendererTestCase extends TestCase { - - private MetadataRenderer renderer; - - @Override - public void setUp() throws Exception { - renderer = new MetadataRenderer(); - } - - public void testAddMetadataFilter() throws Exception { - - // Auto remove all elements with a namespace - renderer.addMetadataFilter(new MetadataFilter() { - public boolean accept(Element element) { - return element.getNameSpace() != null; - } - }); - - Element main = new Element("test", null); - Element child = new Element("child", "uri"); - main.addElement(child); - String rendered = renderer.render(main); - Assert.assertEquals("test { }", rendered); - - } - - public void testRenderElementWithNoNamespace() throws Exception { - Element main = new Element("test", null); - String rendered = renderer.render(main); - Assert.assertEquals("test { }", rendered); - } - - public void testRenderElementWithEmptyNamespace() throws Exception { - Element main = new Element("test", ""); - String rendered = renderer.render(main); - Assert.assertEquals("test { }", rendered); - } - - public void testRenderElementWithDefaultNamespace() throws Exception { - // TODO Do we need to strip off default namespace ? - Element main = new Element("test", "org.apache.felix.ipojo"); - String rendered = renderer.render(main); - Assert.assertEquals("org.apache.felix.ipojo:test { }", rendered); - } - - public void testRenderElementWithNamespace() throws Exception { - Element main = new Element("test", "http://felix.apache.org/ipojo/testing"); - String rendered = renderer.render(main); - Assert.assertEquals("http://felix.apache.org/ipojo/testing:test { }", rendered); - } - - public void testRenderElementWithNoNamespaceAttribute() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", "attribute")); - String rendered = renderer.render(main); - Assert.assertEquals("test { $name=\"attribute\" }", rendered); - } - - public void testRenderElementWithNamespaceAttribute() throws Exception { - Element main = new Element("test", null); - main.addAttribute(new Attribute("name", "ns-uri", "attribute")); - String rendered = renderer.render(main); - Assert.assertEquals("test { $ns-uri:name=\"attribute\" }", rendered); - } - - public void testRenderElementWithChildren() throws Exception { - Element main = new Element("test", null); - Element child = new Element("child", null); - main.addElement(child); - String rendered = renderer.render(main); - Assert.assertEquals("test { child { }}", rendered); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModuleTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModuleTestCase.java deleted file mode 100644 index 3374522cf1..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AbsBindingModuleTestCase.java +++ /dev/null @@ -1,259 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.manipulator.metadata.annotation.registry.Binding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.generic.GenericVisitorFactory; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.ignore.NullBinding; -import org.apache.felix.ipojo.manipulator.metadata.annotation.visitor.stereotype.StereotypeVisitorFactory; - -import java.lang.annotation.ElementType; -import java.util.Iterator; - -import static org.apache.felix.ipojo.manipulator.spi.helper.Predicates.on; -import static org.mockito.Mockito.mock; -import static org.objectweb.asm.Type.getType; - -/** - * Created with IntelliJ IDEA. - * User: guillaume - * Date: 10/10/12 - * Time: 10:37 PM - * To change this template use File | Settings | File Templates. - */ -public class AbsBindingModuleTestCase extends TestCase { - - public void testSimpleBinding() throws Exception { - final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class); - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bind(Provides.class).to(factory); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Provides.class), one.getAnnotationType()); - assertEquals(factory, one.getFactory()); - - // Only 1 Binding - assertFalse(i.hasNext()); - } - - public void testTwoBindings() throws Exception { - final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class); - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bind(Provides.class).to(factory); - bind(Requires.class).to(factory); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Provides.class), one.getAnnotationType()); - assertEquals(factory, one.getFactory()); - - // Second Binding - Binding two = i.next(); - assertNotNull(two); - assertEquals(getType(Requires.class), two.getAnnotationType()); - assertEquals(factory, two.getFactory()); - } - - public void testTwoBindingsForSameAnnotation() throws Exception { - final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class); - final AnnotationVisitorFactory factory2 = mock(AnnotationVisitorFactory.class); - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bind(Provides.class).to(factory); - bind(Provides.class).to(factory2); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Provides.class), one.getAnnotationType()); - assertEquals(factory, one.getFactory()); - - // Second Binding - Binding two = i.next(); - assertNotNull(two); - assertEquals(getType(Provides.class), two.getAnnotationType()); - assertEquals(factory2, two.getFactory()); - } - - public void testConditionalBinding() throws Exception { - final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class); - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bind(Provides.class) - .when(on(ElementType.FIELD)) - .to(factory); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Provides.class), one.getAnnotationType()); - assertEquals(factory, one.getFactory()); - - // Only 1 Binding - assertFalse(i.hasNext()); - } - - public void testConditionalBindings() throws Exception { - final AnnotationVisitorFactory factory = mock(AnnotationVisitorFactory.class); - final AnnotationVisitorFactory factory2 = mock(AnnotationVisitorFactory.class); - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bind(Provides.class) - .when(on(ElementType.FIELD)) - .to(factory) - .when(on(ElementType.PARAMETER)) - .to(factory2); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Provides.class), one.getAnnotationType()); - assertEquals(factory, one.getFactory()); - - // Second Binding - Binding two = i.next(); - assertNotNull(two); - assertEquals(getType(Provides.class), two.getAnnotationType()); - assertEquals(factory2, two.getFactory()); - } - - public void testHandlerBindings() throws Exception { - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bindHandlerBinding(Bound.class).to("com.acme", "foo"); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Bound.class), one.getAnnotationType()); - assertTrue(one.getFactory() instanceof GenericVisitorFactory); - } - - public void testStereotypeBindings() throws Exception { - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bindStereotype(Bound.class) - .with(new ComponentLiteral() { - @Override - public boolean publicFactory() { - return false; - } - }); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertNotNull(one); - assertEquals(getType(Bound.class), one.getAnnotationType()); - assertTrue(one.getFactory() instanceof StereotypeVisitorFactory); - } - - - public void testIgnoreBindings() throws Exception { - AbsBindingModule module = new AbsBindingModule() { - public void configure() { - bindIgnore(Bound.class); - } - }; - module.configure(); - - Iterator i = module.iterator(); - Binding one = i.next(); - assertEquals(getType(Bound.class), one.getAnnotationType()); - assertTrue(one instanceof NullBinding); - } - - private static @interface Bound {} - - private static class ComponentLiteral extends AnnotationLiteral implements Component { - - public boolean public_factory() { - return true; - } - - public boolean publicFactory() { - return true; - } - - public String name() { - return ""; - } - - public boolean architecture() { - return false; - } - - public boolean immediate() { - return false; - } - - public boolean propagation() { - return false; - } - - public String managedservice() { - return ""; - } - - public String factory_method() { - return ""; - } - - public String factoryMethod() { - return ""; - } - - public String version() { - return ""; - } - } - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteralTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteralTestCase.java deleted file mode 100644 index 54f2ab810b..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/spi/AnnotationLiteralTestCase.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.manipulator.spi; - -import org.apache.felix.ipojo.manipulator.spi.AnnotationLiteral; - -import junit.framework.TestCase; - -/** - * User: guillaume - * Date: 28/06/13 - * Time: 14:40 - */ -public class AnnotationLiteralTestCase extends TestCase { - public void testAnnotationTypeDiscovery() throws Exception { - - FooLiteral fooLiteral = new FooLiteral() { - public String value() { - return "a"; - } - }; - - assertEquals(Foo.class, fooLiteral.annotationType()); - assertEquals("a", fooLiteral.value()); - - } - - private static abstract class FooLiteral extends AnnotationLiteral implements Foo { } - - private static @interface Foo { - String value(); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStoreTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStoreTestCase.java deleted file mode 100644 index 2494ba8745..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/DirectoryResourceStoreTestCase.java +++ /dev/null @@ -1,88 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -import java.io.File; -import java.io.IOException; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.apache.felix.ipojo.manipulator.util.Strings; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.atLeastOnce; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -/** - * A {@code DirectoryBytecodeStoreTestCase} is ... - * - */ -public class DirectoryResourceStoreTestCase extends TestCase { - - private DirectoryResourceStore store; - private File classes; - private File out; - - public void setUp() throws Exception { - classes = new File("target", "classes"); - out = new File(classes, "test.txt"); - store = new DirectoryResourceStore(classes); - } - - @Override - public void tearDown() throws Exception { - out.delete(); - } - - public void testAccessibleResources() throws Exception { - byte[] data = store.read(Streams.class.getName().replace('.', '/').concat(".class")); - assertNotNull("Data cannot be null", data); - } - - public void testInaccessibleResources() throws Exception { - try { - store.read("something/that/do/not/exists.txt"); - fail(); - } catch (IOException ioe) { - // Expected - } - } - - public void testResourceWriting() throws Exception { - store.write("test.txt", "Hello World".getBytes()); - Assert.assertTrue(out.isFile()); - } - - public void testResourceVisitor() throws Exception { - - // final String expectedPath = Strings.asResourcePath(Pojoization.class.getName()); - ResourceVisitor visitor = mock(ResourceVisitor.class); - store.accept(visitor); - - verify(visitor, atLeastOnce()).visit(anyString()); - - // TODO try to check that Pojoization class resource was called - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStoreTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStoreTestCase.java deleted file mode 100644 index ef07dbf15a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/JarFileResourceStoreTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.ipojo.manipulator.store; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.ResourceVisitor; -import org.apache.felix.ipojo.manipulator.util.Streams; - -import java.io.File; -import java.util.jar.JarFile; -import java.util.jar.Manifest; - -import static org.mockito.Matchers.anyString; -import static org.mockito.Mockito.*; - -public class JarFileResourceStoreTestCase extends TestCase { - public static final String RESOURCE_PATH = "org/apache/felix/ipojo/test/scenarios/component/Annotation.class"; - private JarFileResourceStore store; - private File out; - - public void setUp() throws Exception { - File classes = new File("target", "test-classes"); - out = new File(classes, "test-store.jar"); - JarFile jar = new JarFile(new File(classes, "tests.manipulation.java5.jar")); - store = new JarFileResourceStore(jar, out); - } - - @Override - public void tearDown() throws Exception { - out.delete(); - } - - public void testRead() throws Exception { - byte[] bytes = store.read(RESOURCE_PATH); - Assert.assertNotNull(bytes); - } - - public void testAccept() throws Exception { - ResourceVisitor visitor = mock(ResourceVisitor.class); - store.accept(visitor); - - verify(visitor, atLeastOnce()).visit(anyString()); - - } - - public void testWrite() throws Exception { - - ManifestBuilder builder = mock(ManifestBuilder.class); - Manifest manifest = new Manifest(); - when(builder.build(any(Manifest.class))).thenReturn(manifest); - store.setManifestBuilder(builder); - - store.write(RESOURCE_PATH, "Hello World".getBytes()); - - store.close(); - - JarFile outJar = new JarFile(out); - Assert.assertNotNull(outJar.getEntry(RESOURCE_PATH)); - byte[] bytes = Streams.readBytes(outJar.getInputStream(outJar.getEntry(RESOURCE_PATH))); - - Assert.assertEquals("Hello World", new String(bytes)); - - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilderTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilderTestCase.java deleted file mode 100644 index ce551e03fe..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/builder/DefaultManifestBuilderTestCase.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.manipulator.store.builder; - -import java.util.Arrays; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.jar.Attributes; -import java.util.jar.Manifest; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.store.ManifestBuilder; -import org.apache.felix.ipojo.manipulator.store.builder.DefaultManifestBuilder; -import org.apache.felix.ipojo.manipulator.util.Constants; - -public class DefaultManifestBuilderTestCase extends TestCase { - - private static final String ORG_OSGI_FRAMEWORK_VERSION_1_5 = "org.osgi.framework;version=1.5"; - private Manifest manifest; - private ManifestBuilder builder; - - @Override - public void setUp() throws Exception { - super.setUp(); - - manifest = new Manifest(); - Attributes attributes = manifest.getMainAttributes(); - attributes.putValue("Import-Package", ORG_OSGI_FRAMEWORK_VERSION_1_5); - attributes.putValue("Created-By", "TestCase"); - - builder = new DefaultManifestBuilder(); - builder.addReferredPackage(Collections.singleton("org.osgi.service.http")); - } - - public void testManifestIsModified() throws Exception { - Manifest modified = builder.build(manifest); - - // Created by header was properly modified - Assert.assertEquals("TestCase & iPOJO " + Constants.getVersion(), - modified.getMainAttributes().getValue("Created-By")); - - // As there was no metadata provided, no iPOJO-Components header should be present - Assert.assertNull(modified.getMainAttributes().getValue("iPOJO-Components")); - - // Check that default manipulation introduced packages are present - String imported = modified.getMainAttributes().getValue("Import-Package"); - Assert.assertTrue(imported.contains(ORG_OSGI_FRAMEWORK_VERSION_1_5)); - Assert.assertTrue(imported.contains("org.apache.felix.ipojo")); - Assert.assertTrue(imported.contains("org.apache.felix.ipojo.architecture")); - Assert.assertTrue(imported.contains("org.osgi.service.cm")); - Assert.assertTrue(imported.contains("org.osgi.service.log")); - } - - - public void testCreatedByHeaderDoesNotContainIPojoTwice() throws Exception { - - manifest.getMainAttributes().putValue("Created-By", "TestCase for iPOJO"); - - Manifest modified = builder.build(manifest); - - // Created by header was properly not changed - Assert.assertEquals("TestCase for iPOJO", - modified.getMainAttributes().getValue("Created-By")); - } - - public void testReferredPackagesAreProperlyAdded() throws Exception { - - List p = Arrays.asList("org.apache.felix.ipojo.test", "org.apache.felix.ipojo.log"); - builder.addReferredPackage(new HashSet(p)); - - Manifest modified = builder.build(manifest); - - // Check that referred packages are present - String imported = modified.getMainAttributes().getValue("Import-Package"); - Assert.assertTrue(imported.contains("org.apache.felix.ipojo.test")); - Assert.assertTrue(imported.contains("org.apache.felix.ipojo.log")); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapperTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapperTestCase.java deleted file mode 100644 index c7e61751b5..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/FileSystemResourceMapperTestCase.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.store.ResourceMapper; - -import static org.mockito.Matchers.eq; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -public class FileSystemResourceMapperTestCase extends TestCase { - - public void testUnixInternalize() throws Exception { - - ResourceMapper delegate = mock(ResourceMapper.class); - FileSystemResourceMapper mapper = new FileSystemResourceMapper(delegate); - - String path = "this/is/a/unix/like/path.extension"; - when(delegate.internalize(eq(path))).thenReturn(path); - - String result = mapper.internalize(path); - - Assert.assertEquals(path, result); - - } - - public void testUnixExternalize() throws Exception { - - ResourceMapper delegate = mock(ResourceMapper.class); - FileSystemResourceMapper mapper = new FileSystemResourceMapper(delegate); - - String path = "this/is/a/unix/like/path.extension"; - when(delegate.externalize(eq(path))).thenReturn(path); - - String result = mapper.externalize(path); - - // unix path is already normalized - Assert.assertEquals(path, result); - } - - public void ignoreWindowsExternalize() throws Exception { - // As Java doesn't like '\' alone in Strings I have to replace them on the fly :'( - // Grrr doesn't work as expected - ResourceMapper delegate = mock(ResourceMapper.class); - FileSystemResourceMapper mapper = new FileSystemResourceMapper(delegate); - - String path = "c:\\this\\is\\a\\windows\\like\\path.extension"; - when(delegate.externalize(eq(path))).thenReturn(path); - - String expected = "c:/this/is/a/windows/like/path.extension"; - String result = mapper.externalize(path); - - // unix path is already normalized - Assert.assertEquals(expected, result); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapperTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapperTestCase.java deleted file mode 100644 index cfde446cf2..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/IdentityResourceMapperTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class IdentityResourceMapperTestCase extends TestCase { - public void testInternalize() throws Exception { - IdentityResourceMapper mapper = new IdentityResourceMapper(); - String path = "must/not/change"; - Assert.assertEquals(path, mapper.internalize(path)); - } - - public void testExternalize() throws Exception { - IdentityResourceMapper mapper = new IdentityResourceMapper(); - String path = "must/not/change"; - Assert.assertEquals(path, mapper.externalize(path)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapperTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapperTestCase.java deleted file mode 100644 index bb6f75c52a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/store/mapper/WABResourceMapperTestCase.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.manipulator.store.mapper; - -import junit.framework.Assert; -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.store.ResourceMapper; - -public class WABResourceMapperTestCase extends TestCase { - - public void testWebInfClassesResourceIsMapped() throws Exception { - ResourceMapper mapper = new WABResourceMapper(); - - String normalized = "jndi.properties"; - String resource = "WEB-INF/classes/jndi.properties"; - - Assert.assertEquals(normalized, mapper.externalize(resource)); - Assert.assertEquals(resource, mapper.internalize(normalized)); - } - - public void testWebInfLibResourceIsUnchanged() throws Exception { - ResourceMapper mapper = new WABResourceMapper(); - - String normalized = "WEB-INF/lib/commons-logging.jar"; - String resource = "WEB-INF/lib/commons-logging.jar"; - - Assert.assertEquals(normalized, mapper.externalize(resource)); - Assert.assertEquals(resource, mapper.internalize(normalized)); - } - - public void testMetaInfManifestIsUnchanged() throws Exception { - ResourceMapper mapper = new WABResourceMapper(); - - String normalized = "META-INF/MANIFEST.MF"; - String resource = "META-INF/MANIFEST.MF"; - - Assert.assertEquals(normalized, mapper.externalize(resource)); - Assert.assertEquals(resource, mapper.internalize(normalized)); - } - - public void testResourceNotMapped() throws Exception { - ResourceMapper mapper = new WABResourceMapper(); - - String resource = "images/logo.png"; - - Assert.assertEquals(resource, mapper.internalize(resource)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StreamsTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StreamsTestCase.java deleted file mode 100644 index 2dcf26d5a1..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StreamsTestCase.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import junit.framework.Assert; -import junit.framework.TestCase; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.Closeable; - -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.verify; - -public class StreamsTestCase extends TestCase { - public void testSimpleClose() throws Exception { - Closeable closeable = mock(Closeable.class); - Streams.close(closeable); - verify(closeable).close(); - } - - public void testCloseWithNullParameter() throws Exception { - Closeable closeable = mock(Closeable.class); - Streams.close(closeable, null); - verify(closeable).close(); - } - - public void testTransfer() throws Exception { - String toBeRead = "Tadam"; - ByteArrayInputStream bais = new ByteArrayInputStream(toBeRead.getBytes()); - ByteArrayOutputStream baos = new ByteArrayOutputStream(); - Streams.transfer(bais, baos); - Assert.assertEquals(toBeRead, new String(baos.toByteArray())); - } - - public void testReadBytes() throws Exception { - String toBeRead = "Tadam"; - ByteArrayInputStream bais = new ByteArrayInputStream(toBeRead.getBytes()); - byte[] bytes = Streams.readBytes(bais); - Assert.assertEquals(toBeRead, new String(bytes)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StringsTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StringsTestCase.java deleted file mode 100644 index 1ccb07537d..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/util/StringsTestCase.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.manipulator.util; - -import junit.framework.Assert; -import junit.framework.TestCase; - -public class StringsTestCase extends TestCase { - - private static final String CLASSNAME = StringsTestCase.class.getName(); - private static final String PATH = "org/apache/felix/ipojo/manipulator/util/StringsTestCase.class"; - - public void testClassnameIsTransformedIntoNormalizedResourcePath() throws Exception { - Assert.assertEquals(PATH, Strings.asResourcePath(CLASSNAME)); - } - - public void testNormalizedResourcePathIsTransformedIntoClassname() throws Exception { - Assert.assertEquals(CLASSNAME, Strings.asClassName(PATH)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitorTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitorTestCase.java deleted file mode 100644 index 72e45a08df..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/check/CheckFieldConsistencyResultVisitorTestCase.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.check; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.ManipulationResultVisitor; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import static org.mockito.Mockito.*; - - -public class CheckFieldConsistencyResultVisitorTestCase extends TestCase { - - @Mock - private Reporter reporter; - - @Mock - private ManipulationResultVisitor delegate; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testVisitClassStructureOK() throws Exception { - Element component = newComponentElement(); - CheckFieldConsistencyResultVisitor visitor = new CheckFieldConsistencyResultVisitor(delegate); - visitor.setReporter(reporter); - visitor.setMetadata(component); - - Element manipulation = newManipulationElement(true); - visitor.visitClassStructure(manipulation); - - verifyZeroInteractions(reporter); - - } - - public void testVisitClassStructureWithMissingFields() throws Exception { - Element component = newComponentElement(); - CheckFieldConsistencyResultVisitor visitor = new CheckFieldConsistencyResultVisitor(delegate); - visitor.setReporter(reporter); - visitor.setMetadata(component); - - Element manipulation = newManipulationElement(false); - visitor.visitClassStructure(manipulation); - - verify(reporter).error(anyString()); - - } - - private Element newManipulationElement(boolean complete) { - Element manipulation = new Element("manipulation", null); - if (complete) { - Element field = new Element("field", null); - field.addAttribute(new Attribute("name", "property")); - manipulation.addElement(field); - } - - return manipulation; - } - - private Element newComponentElement() { - Element component = new Element("component", null); - Element requires = new Element("requires", null); - requires.addAttribute(new Attribute("field", "property")); - component.addElement(requires); - - return component; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriterTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriterTestCase.java deleted file mode 100644 index 346032fac6..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResourcesWriterTestCase.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.writer; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.metadata.Element; -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -import static org.mockito.Mockito.*; - - -public class ManipulatedResourcesWriterTestCase extends TestCase { - - @Mock - private Reporter reporter; - - @Mock - private ResourceStore store; - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testVisitManipulationResult() throws Exception { - ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter(); - writer.setReporter(reporter); - writer.setResourceStore(store); - - Element component = new Element("component", null); - assertNotNull(writer.visitManipulationResult(component)); - verify(store).writeMetadata(same(component)); - } - - public void testVisitMetadata() throws Exception { - ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter(); - writer.setReporter(reporter); - writer.setResourceStore(store); - - Element instance = new Element("instance", null); - writer.visitMetadata(instance); - verify(store).writeMetadata(same(instance)); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriterTestCase.java b/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriterTestCase.java deleted file mode 100644 index 3a5f5d3147..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/org/apache/felix/ipojo/manipulator/visitor/writer/ManipulatedResultWriterTestCase.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.manipulator.visitor.writer; - -import junit.framework.TestCase; -import org.apache.felix.ipojo.metadata.Element; -import org.mockito.MockitoAnnotations; -import org.mockito.Spy; - -import static org.mockito.Mockito.*; - - -public class ManipulatedResultWriterTestCase extends TestCase { - - @Spy - private Element element = new Element("component", null); - - @Override - public void setUp() throws Exception { - MockitoAnnotations.initMocks(this); - } - - public void testVisitClassStructure() throws Exception { - ManipulatedResultWriter writer = new ManipulatedResultWriter(element); - - Element manipulation = new Element("manipulation", null); - writer.visitClassStructure(manipulation); - verify(element).addElement(same(manipulation)); - } - - public void testVisitManipulatedResource() throws Exception { - ManipulatedResultWriter writer = new ManipulatedResultWriter(element); - - writer.visitManipulatedResource("test.class", "Hello".getBytes()); - - assertNotNull(writer.getResources().get("test.class")); - assertEquals("Hello", new String(writer.getResources().get("test.class"))); - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/AnnotatedComponent.java b/ipojo/manipulator/manipulator/src/test/java/test/AnnotatedComponent.java deleted file mode 100644 index 9b58797ae9..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/AnnotatedComponent.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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 test; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Requires; -import org.osgi.framework.BundleContext; - -@Component -public class AnnotatedComponent { - - @Property - private String prop; - - public AnnotatedComponent(BundleContext bundleContext) {} - - @FakeAnnotation - public void annotatedMethod() { - - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/Child.java b/ipojo/manipulator/manipulator/src/test/java/test/Child.java deleted file mode 100644 index 25234153c3..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/Child.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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 test; - -public class Child extends Parent { - - Child(int i, String f) { - super(i, f); - } - - Child() { - super(5, "foo"); - } - - public int doSomething() { - return getIndex() + 1; // 9 - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/ClusterDaemon.java b/ipojo/manipulator/manipulator/src/test/java/test/ClusterDaemon.java deleted file mode 100755 index 594886898e..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/ClusterDaemon.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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 test; - -import java.util.ArrayList; - -public class ClusterDaemon { - - - /** - * Controled servers url list. - */ - private ArrayList ControlledServersNames; - - /** - * Controlled servers. - * @return cluster daemon controlled server names. - */ - public ArrayList getControlledServersNames() { - return null; - } - - -} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/test/java/test/ConstructorCheck.java b/ipojo/manipulator/manipulator/src/test/java/test/ConstructorCheck.java deleted file mode 100644 index 585788bbd3..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/ConstructorCheck.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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 test; - - -public class ConstructorCheck { - - public String m_foo; - - public ConstructorCheck(String foo) { - m_foo = foo; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/DoubleArray.java b/ipojo/manipulator/manipulator/src/test/java/test/DoubleArray.java deleted file mode 100644 index f20c7e522a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/DoubleArray.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 test; - -/** - * Checks a component with a double array - * To reproduce https://issues.apache.org/jira/browse/FELIX-3621 - */ -public class DoubleArray { - - public boolean start() { - System.out.println("Start"); - - int[][] matrix = new int[20][20]; - - this.testArray(matrix); - - matrix[0][0] = 2; - return true; - } - - private void testArray(int[][] matrix) { - System.out.println("Test Array"); - } - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/FakeAnnotation.java b/ipojo/manipulator/manipulator/src/test/java/test/FakeAnnotation.java deleted file mode 100644 index 21d2076bfe..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/FakeAnnotation.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 test; - -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -/** - * A {@code FakeAnnotation} is ... - * - * @author Guillaume Sauthier - */ -@Target({ElementType.METHOD}) -@Retention(RetentionPolicy.RUNTIME) -public @interface FakeAnnotation { -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/InterfaceWithStatic.java b/ipojo/manipulator/manipulator/src/test/java/test/InterfaceWithStatic.java deleted file mode 100644 index 85ea205e62..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/InterfaceWithStatic.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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 test; - -public interface InterfaceWithStatic { - static InterfaceWithStatic ofString(String string) { - return new InterfaceWithStatic() { - @Override - public String getString() { - return string; - } - }; - } - - String getString(); -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/NoValidConstructor.java b/ipojo/manipulator/manipulator/src/test/java/test/NoValidConstructor.java deleted file mode 100644 index b9d7a021e9..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/NoValidConstructor.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 test; - -public class NoValidConstructor { - - String m_s; - - public NoValidConstructor(String s) { - m_s = s; - } - - public String getS() { - return m_s; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/NonSunClass.java b/ipojo/manipulator/manipulator/src/test/java/test/NonSunClass.java deleted file mode 100644 index 1df0e5038f..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/NonSunClass.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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 test; - -/** - * Class that does not respect Sun conventions. - */ -public class NonSunClass { - - /** - * Does not match the Sun convention. - */ - private boolean S1 = true; - - public boolean getS1() { - return S1; - } - - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/Parent.java b/ipojo/manipulator/manipulator/src/test/java/test/Parent.java deleted file mode 100644 index 4f4954cf96..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/Parent.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 test; - -public class Parent { - - private int m_index = 0; - - public Parent(int i, String s) { - m_index = i + s.length(); - } - - public int getIndex() { - return m_index; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/PlentyOfAnnotations.java b/ipojo/manipulator/manipulator/src/test/java/test/PlentyOfAnnotations.java deleted file mode 100644 index b6d11ed9c4..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/PlentyOfAnnotations.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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 test; - -import org.apache.felix.ipojo.annotations.*; -import test.ipojo.ExternalHandler; - -import java.util.List; - -@Component -@Instantiate -public class PlentyOfAnnotations { - - @Requires - List list; - private String m_prop; - private Runnable m_runnable; - private String m_stuff; - - @ExternalHandler - private String stuff2; - - - PlentyOfAnnotations(@Property String prop, @Requires Runnable runnable, @ExternalHandler String stuff) { - - m_prop = prop; - m_runnable = runnable; - m_stuff = stuff; - - } - - @Validate - public void start() { - //... - } - - @ExternalHandler - public void stuff() { - // ... - } - - public String doSomethingWithArguments(String message, int value) { - return message + " - " + value; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithFinalArray.java b/ipojo/manipulator/manipulator/src/test/java/test/PojoWithFinalArray.java deleted file mode 100644 index 2da51e8b34..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithFinalArray.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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 test; - -public class PojoWithFinalArray { - - private final String[] strings = createInterfaces(); - - private String[] createInterfaces() { - return new String[]{"test"}; - } - - public String doSomething() { - return strings[0]; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java b/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java deleted file mode 100644 index 7b12a90d07..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithInner.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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 test; - -public class PojoWithInner { - - private MyInner m_result = new MyInner(); - - // This is a simple POJO - - public boolean doSomething() { - return m_result.getInner(); - } - - public class MyInner { - - public boolean getInner() { - return true; - } - - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithStaticInterface.java b/ipojo/manipulator/manipulator/src/test/java/test/PojoWithStaticInterface.java deleted file mode 100644 index 3fd80e61fb..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/PojoWithStaticInterface.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 test; - -public class PojoWithStaticInterface { - - private final InterfaceWithStatic intf = InterfaceWithStatic.ofString("test"); - - // This is a simple POJO - - public String doSomething() { - return intf.getString(); - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/SimplePojo.java b/ipojo/manipulator/manipulator/src/test/java/test/SimplePojo.java deleted file mode 100644 index fb8a8daa43..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/SimplePojo.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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 test; - -public class SimplePojo { - - private boolean m_result = true; - - // This is a simple POJO - - public boolean doSomething() { - return m_result; - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/frames/CryptoServiceSingleton.java b/ipojo/manipulator/manipulator/src/test/java/test/frames/CryptoServiceSingleton.java deleted file mode 100644 index 660d15a634..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/frames/CryptoServiceSingleton.java +++ /dev/null @@ -1,435 +0,0 @@ -/* - * #%L - * Wisdom-Framework - * %% - * Copyright (C) 2013 - 2014 Wisdom Framework - * %% - * Licensed 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. - * #L% - */ -package test.frames; - -import org.apache.commons.codec.DecoderException; -import org.apache.commons.codec.binary.Base64; -import org.apache.commons.codec.binary.Hex; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; - -import javax.crypto.*; -import javax.crypto.spec.IvParameterSpec; -import javax.crypto.spec.PBEKeySpec; -import javax.crypto.spec.SecretKeySpec; -import java.nio.charset.Charset; -import java.security.InvalidAlgorithmParameterException; -import java.security.InvalidKeyException; -import java.security.MessageDigest; -import java.security.NoSuchAlgorithmException; -import java.security.spec.InvalidKeySpecException; -import java.security.spec.KeySpec; - -/** - * This component triggers some interesting frames issue. - */ -@Component -@Provides -@Instantiate(name = "crypto") -public class CryptoServiceSingleton { - - public static final String AES_CBC_ALGORITHM = "AES/CBC/PKCS5Padding"; - public static final String AES_ECB_ALGORITHM = "AES"; - private static final Charset UTF_8 = Charset.defaultCharset(); - public static final String HMAC_SHA_1 = "HmacSHA1"; - public static final String PBKDF_2_WITH_HMAC_SHA_1 = "PBKDF2WithHmacSHA1"; - - private int keySize; - private int iterationCount; - private Hash defaultHash; - - private final String secret; - private final String testField = "TEST"; - - public CryptoServiceSingleton(String secret, Hash defaultHash, - Integer keySize, Integer iterationCount) { - this.secret = secret; - this.defaultHash = defaultHash; - this.keySize = keySize; - this.iterationCount = iterationCount; - } - - public CryptoServiceSingleton() { - this( - "I;>qOs/VgFe?l@>Kn/RGa0p9b1ji?Kg7uhjAPHdIO8>@ - * This primarily exists to defeat the BREACH vulnerability, as it allows the token to effectively be random per - * request, without actually changing the value. - * - * @param token The token to sign - * @return The signed token - */ - public String signToken(String token) { - long nonce = System.currentTimeMillis(); - String joined = nonce + "-" + token; - return sign(joined) + "-" + joined; - } - - /** - * Extract a signed token that was signed by {@link #signToken(String)}. - * - * @param token The signed token to extract. - * @return The verified raw token, or null if the token isn't valid. - */ - public String extractSignedToken(String token) { - String[] chunks = token.split("-", 3); - String signature = chunks[0]; - String nonce = chunks[1]; - String raw = chunks[2]; - if (constantTimeEquals(signature, sign(nonce + "-" + raw))) { - return raw; - } else { - return null; - } - } - - /** - * Constant time equals method. - *

- * Given a length that both Strings are equal to, this method will always run in constant time. - * This prevents timing attacks. - */ - private boolean constantTimeEquals(String a, String b) { - if (a.length() != b.length()) { - return false; - } else { - int equal = 0; - for (int i = 0; i < a.length(); i++) { - equal = equal | a.charAt(i) ^ b.charAt(i); - } - return equal == 0; - } - } - - /** - * Encode binary data to base64. - * - * @param value The binary data - * @return The base64 encoded String - */ - public String encodeBase64(byte[] value) { - return new String(Base64.encodeBase64(value), UTF_8); - } - - /** - * Decode a base64 value. - * - * @param value The base64 encoded String - * @return decoded binary data - */ - public byte[] decodeBase64(String value) { - return Base64.decodeBase64(value.getBytes(UTF_8)); - } - - /** - * Build an hexadecimal MD5 hash for a String. - * - * @param value The String to hash - * @return An hexadecimal Hash - */ - public String hexMD5(String value) { - try { - MessageDigest messageDigest = MessageDigest.getInstance(Hash.MD5.toString()); - messageDigest.reset(); - messageDigest.update(value.getBytes(UTF_8)); - byte[] digest = messageDigest.digest(); - return String.valueOf(Hex.encodeHex(digest)); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } - - /** - * Build an hexadecimal SHA1 hash for a String. - * - * @param value The String to hash - * @return An hexadecimal Hash - */ - public String hexSHA1(String value) { - try { - MessageDigest md; - md = MessageDigest.getInstance(Hash.SHA1.toString()); - md.update(value.getBytes(UTF_8)); - byte[] digest = md.digest(); - return String.valueOf(Hex.encodeHex(digest)); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - } -} \ No newline at end of file diff --git a/ipojo/manipulator/manipulator/src/test/java/test/frames/Hash.java b/ipojo/manipulator/manipulator/src/test/java/test/frames/Hash.java deleted file mode 100644 index 079c13123e..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/frames/Hash.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * #%L - * Wisdom-Framework - * %% - * Copyright (C) 2013 - 2014 Wisdom Framework - * %% - * Licensed 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. - * #L% - */ -package test.frames; - -/** - * Common hash algorithms. - */ -public enum Hash { - - MD5("MD5"), - SHA1("SHA-1"), - SHA256("SHA-256"), - SHA512("SHA-512"); - - private String algorithm; - - Hash(String algorithm) { - this.algorithm = algorithm; - } - - @Override - public String toString() { - return this.algorithm; - } -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java b/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java deleted file mode 100644 index 9b9bfbc16a..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/inner/ComponentWithInnerClasses.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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 test.inner; - -import org.apache.felix.ipojo.annotations.Component; - -import java.util.concurrent.Callable; - -/** - * A component containing inner classes. - */ -@Component -public class ComponentWithInnerClasses{ - - public String doSomething() { - MyInnerWithANativeMethod nat = new MyInnerWithANativeMethod(); - MyInnerClass inn = new MyInnerClass(); - Computation compute = new Computation() { - - public String compute(final String s) { - return "foo"; - } - }; - return nat.foo() + MyStaticInnerClass.foo() + inn.foo() + compute.compute(""); - } - - private void doSomethingPrivately() { - - } - - private boolean flag; - - boolean getFlag() { - return flag; - } - - private String test = ""; - - private String foo = "foo"; - - public static final Callable callable = new Callable() { - public Integer call() { - return 1; - } - }; - - public static int call() throws Exception { - return callable.call(); - } - - private class MyInnerWithANativeMethod { - - public String foo() { - return ComponentWithInnerClasses.this.foo; - } - - public void bar() { - if (! getFlag()) { - test.charAt(0); - } - } - - public native void baz(); - - } - - public static class MyStaticInnerClass { - - public static String foo() { - return "foo"; - } - - public String bar() { - return "bar"; - } - - public native void baz(); - } - - - private class MyInnerClass { - public String foo() { - return ComponentWithInnerClasses.this.foo; - } - } - - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/inner/Computation.java b/ipojo/manipulator/manipulator/src/test/java/test/inner/Computation.java deleted file mode 100644 index 065af03cb0..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/inner/Computation.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 test.inner; - -/** - * A simple interface intended to be implemented by an anonymous class. - */ -public interface Computation { - - public String compute(String s); -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/inner/Example.java b/ipojo/manipulator/manipulator/src/test/java/test/inner/Example.java deleted file mode 100644 index 216083818f..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/inner/Example.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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 test.inner; - -/** - * Created with IntelliJ IDEA. - * User: clement - * Date: 01/10/13 - * Time: 14:57 - * To change this template use File | Settings | File Templates. - */ -public class Example { - - private String myString; - - org.apache.felix.ipojo.InstanceManager __IM; - boolean __M1___run; - boolean __MFoo___run; - - public void doSomething() { - Runnable runnable = new Runnable() { - public void run() { - if (! __M1___run) { - __run(); - } else { - try { - __IM.onEntry(Example.this, "__M1___run", new Object[0]); - __run(); - __IM.onExit(Example.this, "__M1___run", new Object[0]); - } catch (Throwable e) { - __IM.onError(Example.this, "__M1___run", e); - } - } - } - - private void __run() { - System.out.println(myString); - } - }; - runnable.run(); - } - - private class Foo { - public void run() { - if (! __MFoo___run) { - __run(); - } else { - try { - __IM.onEntry(Example.this, "__MFoo___run", new Object[0]); - __run(); - __IM.onExit(Example.this, "__MFoo___run", new Object[0]); - } catch (Throwable e) { - __IM.onError(Example.this, "__MFoo___run", e); - } - } - } - - private void __run() { - System.out.println(myString); - } - } - -} diff --git a/ipojo/manipulator/manipulator/src/test/java/test/ipojo/ExternalHandler.java b/ipojo/manipulator/manipulator/src/test/java/test/ipojo/ExternalHandler.java deleted file mode 100644 index 1699ff7c00..0000000000 --- a/ipojo/manipulator/manipulator/src/test/java/test/ipojo/ExternalHandler.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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 test.ipojo; - -public @interface ExternalHandler { -} diff --git a/ipojo/manipulator/manipulator/src/test/resources/MANIFEST.MF b/ipojo/manipulator/manipulator/src/test/resources/MANIFEST.MF deleted file mode 100644 index 8bb4036060..0000000000 --- a/ipojo/manipulator/manipulator/src/test/resources/MANIFEST.MF +++ /dev/null @@ -1,19 +0,0 @@ -Manifest-Version: 1.0 -Export-Package: org.apache.felix.ipojo.test.scenarios.manipulation.ser - vice -Test-Suite: org.apache.felix.ipojo.test.scenarios.manipulation.Manipul - ationTestSuite -Built-By: clement -Tool: Bnd-0.0.357 -Bundle-Name: iPOJO Manipulation Test Suite For Java 5 -Created-By: Apache Maven Bundle Plugin -Build-Jdk: 1.6.0_22 -Bundle-Version: 1.5.0.SNAPSHOT -Bnd-LastModified: 1292008458378 -Bundle-ManifestVersion: 2 -Import-Package: junit.framework,org.apache.felix.ipojo;version="1.6",o - rg.apache.felix.ipojo.junit4osgi,org.apache.felix.ipojo.junit4osgi.he - lpers,org.apache.felix.ipojo.test.scenarios.manipulation.service,org. - osgi.framework;version="1.5" -Bundle-SymbolicName: tests.manipulation.java5 - diff --git a/ipojo/manipulator/manipulator/src/test/resources/empty-metadata.xml b/ipojo/manipulator/manipulator/src/test/resources/empty-metadata.xml deleted file mode 100644 index bb8ea7430d..0000000000 --- a/ipojo/manipulator/manipulator/src/test/resources/empty-metadata.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - diff --git a/ipojo/manipulator/manipulator/src/test/resources/metadata.xml b/ipojo/manipulator/manipulator/src/test/resources/metadata.xml deleted file mode 100644 index 1704860c21..0000000000 --- a/ipojo/manipulator/manipulator/src/test/resources/metadata.xml +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/manipulator/manipulator/src/test/resources/tests.manipulation-no-annotations.jar b/ipojo/manipulator/manipulator/src/test/resources/tests.manipulation-no-annotations.jar deleted file mode 100644 index a701fc01e7048785296515a2eac8c0f94cf7c1bb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 26078 zcmcG#1#lZ-mNn|cY|G3sGc$7xGBdLyGc!9*j50GbGcz+YGegW6V-h?5otb&NJM;dX zw=-K$s;*L%^j&p-x6eK2LMzEaLSaI{y}e;`!vrDz%L@|%3PK*JCc-GKAi*pzq982+ zR8?b=m-syf0g)M}tk}nb8MK{zF3cfNZw656eS#Pg4-KFs?@C+Sj1*mF(ht7A>Rcaz z3JATaJrUgI6>KI|B@3GKvi~HLyO;ndx#Cj{7R5gUMqFvZsOHH_X!kzBSRkknl+fI1 zsD{hvI4MoQ>CX{>fRw2~RL0&G5K8~8v*6zx_aDxJeET6R+#grI|C>Mm`-Ld~b)hZD z&D4(hUs;a-|6XqCU~gs5?_lcWVrlA3I3bVF$AbEC*GB>Ec#RYdn%0H%x4oJLGmCt&D+Lv)ytuu+!;h}P za)kpLqdbuZ!;^g|+!+BliMnS$q4r*t8c!qYGGmigYVyW7S@m-HN=+yCV;Kv|Ell%= zs@WQtMvLloZ|^QwqcEZ1@fn9}MU>D(4#bF1NsiKM;+>!^A67F0X}_~Oaa?~>L0cQ7M^0`+oK7+R8SbgVEZf< ztvaKJ;&;~(Q)(wtsO5Os0o|W|BCDtP2gMkE0%u9Zv0$W_^za}!AwphI$cM_|DzZA% z#xZoxlVE4axDF#kaIt!dCv#$cd)5$Polc}F=g`5^4C3(Ndq!3I(p_= z;cQO;4m&(ZkwL|9grh_iv8pC3|F}=ALE{B-x#xYxx90%I}jA8!!Y<+qbl0 zcSt2_76-k2VjhD-gY(SREKO!{gk`ts{ZbgNPFnyRSQ%#vkOy*kPaGWoxQ~MI#M9DA z7(vw^4mZ?%?Iz&GodFmo*VFI&bO(?0l{jiE6Jn4LMAF7kFbV-;Qw63q{4AFEwAQbj zkMN-$FPxP#D~X~oCX6?6!$nfWbSi;Vm9!7)7peIgSFGrGWykYA`SckvaZnKEBgazB z1bfw&3k|@5iGpW(K>CfV!{Otz!Lnr*GnV%Z*Jnlpolcz2Ez9epd-Xst?+vczT7$&n z6C8y6RAQoG=!z&m3DNmn&3pSV53P@_N6hMTgEo91zX&H=A$|}YP#X|0L_g4Z&8e;v zB*NJ6LEMUqymm{?YP51|gE0Pg>Fd~)=d6VTMkldiUrti`hzJJX1W>g8)aKsy1E_|| zS!th{0(kjTwSYQ*NQ{y7SH?lZwB1m5tk+ppK!e<)Tru&uQwHu6;;D3X?d!7~tqVIMqjyv(8LQN79qi>a2)G(5O&8B{Zbs_H zm@6DQ>))XBVU#`ZPRdc~g`JBiENsXxMt2i+#u#B+Vw6uXU_c~obT@`2_K9(KQ?jE< ztiFCv9v6C#cSKKjG$ACKarPN;|qRp*?|4%@?cBS8OPgJ&)%-uSM@0nbG#=ylndHCE)`kr4R!op9agz7kx>)ns(b83*>F= zCFff7tji@97Fe(-tba~bZr&d)HdkYD-fJ~`bd<{*784v@`|e|`b~cqc*D~7c34amw zmtSEFT`OUSSUFl3G2a%79J;qwd;Jy&c9-%1dA!jP=HbS#<9#43#T&(_MVb zy-;J`fC8MNg&4Uj-TX5A!&jzi02vo32#9T@{~Feqf)Dj zcGZ66NL@l;j({ z9nv#hLHW;RdU%wOc!H+2;j;AmjE0}&@v{nYil;PvIx(cwW2HM%wx8S54Y#%sO$ok7 zR2l-6?kyP5&9_E1I(eFo9O;MYR(7 z$Tuu1jdup)FwyYeeT5vVm1HG{ZuPlejVJV(eYzWY%m@vO+P3DIksSt8{9LT0->F;Z zi^DFHomE7R35CPPR)l5hxPPAX!4O;g{>>DTXfteK9d3#gH{{&{`@seD82eM+aeYxQ zolZ{x49uO*$-X;Oc7_ZG{_-o5na*%DX<`4PY_Lr{UyS*6C@Dqew)SC<1z%x45T~hz zq@tX*K1zf2`$fMhV02)(By~$9YFCb%p#tWI*9J?z+VpqF8AA!A`bHGaQqnpouYJ0~ z-+)&`*VL~hHy6ZzT)dAByI=aIW#-@9{GZJAkHYiqO9*=>^M6S^ApUI)$N^+*VfrsE zMf>}uW~Mfl9{-X7od27Fzo?*p$qd1NZ|0Bo`Il@_{eReUHa4{bIa%8OYYL6!e{9v* z-qyk1&eZOopS4T20Dwrd<8^L|wK?9g_3p4trG;OG$igFX6b!2)0loCe-hPWYA?J=JNAMa#zQ`mW99v9TS3ukY(PIe0T!unl!Mdo-~D9deic7X7N7>mCY2a; zTe{~{H&8%W{2KH@C5d)fN+3h3%@>@Hk4JjYlz;nE4cELxcvFbh#UKjkkY&LU3eqz< zwjYei=b_)gM$?NTjR^5ae9{q@#Xyreh#T+wtpiwg41jBdK^pn?K(WEj-l!Y5!H8~P zH-s95-fIHYT(V`5OLm;ku40UPnnlzv#ESZ55fAgLKFYo>*e|KMX=@|bS#&XfK$cGb z!|g#%{qI$Y)(Kl^cUDrOM{+I>GphM5Oe2 z6Un9k6^(V`7)hLNT{gW(;3CVH=N%2FMPm=Z-1*{?`mdt>2QvvCN5*ONkVA4C6;?tV zwWwTw*EriUiGb;3JOvj^z2u&f7OYDX#_=6Gbv~JNT@5iJ%MVhgI?U2edu2I{o7SK; zY=&6si`yzcSscji%O2yoh9%(?QN^kr39*T-q7i#w#@Kl1#wEm~TTUXd9Ay1j0mqN{ zyn{;to-S%u9Ok4t_zR@b^U1dCM?lHvdB1{YvMTH!m+{*uGq(^wN9h#WDLMxg6|a$C z45aG=RCqs5I|e$yiK(3W3q4L?7wYbeSOdC;XRHB%L>M{n8gdsqGx&h{;A9~t1(F>e zFGqi))E>AWSSu-ry~=o&n1)Ztb{@z-`DdB=jRd4mGOPmby;-O(l~EpIK8d=gKp3Aq zt}G9Du>M{|R_Kr|+$LKc^A16P&&YL{Mt>yGHq41(lKCAo{!u4MwIWI;+hvFbVR^n_ z1B3CdeEK{wj^36PMgS&%ggxuqbY0NLuF&~G!VJcO{iC!NCApUbt4KD1hJ z#wrl4`WRdF<@(4e%H?2Yus+De0Uw39A*~_X<|DT{>MaL5qOIJZIoQVx9zMGDBcDjJ zr+FQ{YQ#M{>y_+bO8Eu1o*z}}>pU>fTIdCBH0XCo3GgS1Lz#rYSyKKrqNuyU=oZSH zK;+k*2B|nKy1x7-af#2xbXGmVKvp zrO!*C(RQ7s>xFuOBmMWYROdz(uv6p69}AIC@81RAOhDomFxq8_I9{vf+dI;7{=l9u zjn_x+1g3H32~dVbzFVN=|F-t)0(ZcZkHC(cx^t8$0ml!{RhBLL74{Fyx3JF}ctS%! zoV=0pf3o~P27B>;BiKvZ*_k?t{R!}<&J=$O^_A-DD)UO1`oVefvN7RdB_%l}ogc+o ztz*M!R2XtF!#zBu`g5UV=cH96h@YWe`%q@^2$ak|-vWmXoi?Z~a89CUmEk0Cu~(6TP|pthL9HLoCP=ehoP^wd7kLxQcSSn8$&rRI=ACqH-OVHg-r^GUCtzF(n`>+4?Mu;l!bGDf96^ zmv+P-EtRD)JAoe}N=pX`TCv@rZ7@sOuw zmmLH{48Vuvj$Fr)2t` z-%5I7b(X6bv(9XF?kR)mu)Ol&GB79ZsS&r$G6eE2E2mj~g6#!Nk_F?{Z$YM8w8*o{ zgdYA?)Y*oZkyu}$eH@*?PZG1(l5$=r$J}9Qkl$hIw(n;sd5bX0Y-?9EVyefl!4;yk zM~4&kDwrB<`)C5Prc02|FQu~U99SgH3*~Gs1F`lC5e#+jxnlX{nM;IYh{v*r&xvln zK_AxQUUfK9ywAZzUY9xPVJ!@ zTsPHrd>P{2uUqbk)j8@qL~7c_T)r~>IpEnom7qW?%BG4m3~sGtKb_h7qvjL=kiDy zh7Qw^(l;ht1#9Ylr94cSgHk@vZ5NzC>*E9085Sh>kX^X~j^A`=~Sr9NN^fb zVse*q=2@#>D;1#Qfn?(d32b>LdiFr#4r)mXg=G?ZvkCr8V^JyFi)?vHNkmah=gKqV zs1GQk*#f*%v*G;+FeS-OP2b}DQkZdvcwh>4rM1r*jkoVGhovpOBqSOlO(*Zk!6yzW z`vg<$G-*|c!`34wD!Ro_5}0~15gGxiI&4lE#(@2x5&hR(%Y6i@V<)+B29}Jy7F?5+ z%1>!9K`dX$*a?yYLhnW#IptVW4P_9$C1lNmY}jR&>u3>}O%1h4%~N)bq_uInML6a; zZ#Cw0&=0mJl)Qm?z$-}}%Wt;&5x8uzKXdx?(Pey47tji50P^rikS}z~5-4<&bd|17 zbJCiSKWOv65;Qj0z1M1veqP+Vflpr-&hPSpj&#nhy}(FY6V59INe)Y%KZkXGOSwM~ zqYs&gjjEA+f2yG33VUEIRAEnEk*!Ak{(BAz{u&(r<_)wtUPsCvr zTPa66Ksz_E>kT$8{uC+H&r%^oU_Z)M7w=c8Z0$A?6hq0R@dYI64K*aj`mpZOg z#K=3kH>^Uz{xhs9{co|V1TwY;nVbGSPXET4WJr`FK%knM(n1s5Zcz>pRk=WmNrhq0 zmI^7DYlbS7!t}0J@tXM=BD43M=@7S}%QNM$Puvowr<0YrLR|e6->rrPkX!c|?F zZ8>k3lt~wwgrL}2Qd>S9^x_Du>?&hbD~N+7;<-H8lYM+<=g_s-JqE<4E}H-k9=gNt zpLEt-9ytxPJHDjocWL0NuLX#`M6~we_d4iF;Hp58HjIVjM3Q1+1tulfT@R|Tj$f#A z>h1t8XjN4a@z@w2Olu4Z#$w87^ZLK#G^BG)G-w}~tdFoZ0F7y@`6xA+X%Nd2;r0Q& z@3@NjJp0Ix#mfVkU{>i&5!((m>(Fp!2#0{+P@TMl*&rfPu^C#+qcwVO`|jbqlJs9Jf=TdLyT? z;>WS$+R5rif{*?1USnJCP}GiLTL40y3*ApI2Vz=Jp1xD}f*JDnjoIN>d7d~&!uu+4 z);<@rkORv;=Rb)O5CqP}@)KVseYp&P?H6Jgi7zG}+jW8M)HyyI)#pca4L%c^v)Dcs zt#yj94b<;0`iarNf~h?4Ez+;7yfh=K(Ptx{!eeYZfbXu92E1`sfCE06h0 zKY@$2s7Ft)C+c4am<2>E%}QAf-gm$I!=J~7av!kYFnRb-`SX8|NheD;kjp<{Qd{*+ z$Nshp=LjT$ek8-Z^| zU|L>BbpWT>?eOs7^JB#}@8g$WKTZ&RNiEO8imU0|ZO!BhuB&p>ONlv_xWCn&E0@u>@;fri zxf-e;1$jitdptqFZi>?J)CVfV5_NQCc4&T* z@eHvn$s{2l=NrzT%E?SM()O!SE9{s+K?3x3zpFVQ6o<}OO`5h~j{oL0D!q{U%uhk8 z5U_)jz-q}9AGs#T=<3w z!AY}#Jh%_xW)W1NaQ3^{a+XTMhP*xKyiUkH90@6L5^d5G0%_87)h6MjN(KQ8xpH9a39TElxV%D(c;EX3{WkDgxXt_uxVHMzI=SgYt>=jtNy z;*@M6Eo}X!0uAKT%0ns4o^c~3RxLx>kwj}(kOpX`^jmKX;D7jyG_lW*EztMyvtR)} z{u=ACMuqxDDD%f8YL{XxCbkQ8T)M}#`%keguLB?A{m`SJEz%DU#c(h0|6sSc08d@$ z4ZCgsluuRu*L><^?_z5Frg{IKQBVG4p}(0bITA>qvAFgAFe=EA**_$2u}-QsWL@q9 z6Qx$1Lfl@Lps)Qd8zM|Vfre}wP8BNQh9 zZ=R0EN_z3Im2EiuCp(Zi6|rc~VO`lK62Gi4y(up>oN|5#oL_(xpxX~zY--&U0;M7^ z6A1B3xCr5kq>wh{FqQr#8TI($r$Am}di-mfr+Gp^tdhNY{bCaUsXN9#sFdtu$8)2 z%z0>G!6-@(vHd+5SPC#+Uqhwq__8#S7M{_84-GEzAlrW^K0gMUsxcOlttdM9ZmL~) z_T{exrvz%iw5mq3A&}e`s_17Nd!!}JR8+ObH$;r$G>1VMi z>|sjl(D4Is_EIColGY+9xWv%WIS>p)ECZQui(FPDV(1C7aQaRy%h51r>x-JdD zX_$)CPUt^r_{*L{b$0w1%uVld<@-Fr7T;o?L*v8Qrt)RqyXMy(aMO6))I}tCI4W6O z5NjF`#<9{E5MrY-`bfLdq2;@H=nui!u}GB_Ij(QUk5($&9Y#q>g@<+QBqW7=)|G(C z7dgnXT`6n`bhL^BeGmz9H<8oOT%iYrJtXraiaW6tm1E>i1!6D8t+d@6D^QwD))n5M z>D%b4x}GzMP~McYey;%~&q&A;lh3;ni6mtbo@ih$b4feQ4u%X8l!qQ%- z3YuIW%0@pxS|i|B)fKGAF@lV)Z2k@0ZuehuQXd01+&5gF|5Hv?{9ohJ)yT%u`0qja zA2OHpkIe1JDX~TClNSjm$&<>}D^RL{Q%EC{siDaHzslUSzslUW_|B=d$If3b%gNOc zKWos$k;EqI>dTUr?-;A>zGvL%aDHEEDs0OkQXZe_sJyVUQedw?74=F#vqNUSx`E(#KN??3UBlE6tzKujW-G_XL4`p;l;%Ly5- zNIQFL%O3HFS#QiW>cz<+wn8n1so|NGhaF3C)0}}L5^LOeQn~5@jJXaSD;fUQ2MfH6 z#7KJty+T}-yt;wo7LxUW$S{M9B`6A>)AjMX1so$jm&1-#HX|>0}XHJ0GfG zX9s6IC={T%9pX<@nOgwlxlh{|*n&}k(PHR*9IytWtnov2?HS&&K-6g`U5eFwk_ZDB z?07VhYzuQ?R~k%2YD$2LOTrI&#_^ZB4GoqM1^9k|(@ETUXnH#Wc$VI;Z8o8qF&Wci zNVB7wgbs5USUJ8-xd;!vFY2n|(GaOW$>^DI^1ardRsa;kp?{>{D4kSBc(hL#i;98g zIYrB`>!~3^;M{fe`?W@j6&`VcV4m#-kWHsmHsSEGkByPpQO1t~t3m_jjZ@DpJZqgK zhci^9w4im5RKZ$}Niy4={xXBr15y=w6fSdKu*bY2iuEf_d}pLzIPWO){k9OK#VD3% zXeHZ(b6M-6i=u%F^qprRkTS=Zor!zR5%WA^)MEHkUf5bFKTxs15akIrM&I6CE+NJW za$N52nd>2aYHa6p36UD>x4RHy?1v=cP)oXcYKTQx6GZvIIBqO-Ap(7o>x+C{!l0OJ z37b-yGwD5Jq^SAgtLI$raCr?hNhBXa*%Ju{tqTulhdtn-Y~iU|1Tz0UEU_O z{vMO6`u6A|n1YZiL8i1y-Id#UOeL9CXOeS6!Cb6)TEr~4pYfB>k{H<2HwT|!Ih0=` zs6MEnfAtj}^KcKREmV{sHluo+c;S1Tcz(Wrf%R42;EXXUIm;OiV$SF~U@koBI;^UO zO_OAc@Hm#De6Jb2F)LM`*2ra05j zg$xoAVEtA1Aoh}_Ah^$*hAS>1f8_oNW7nRA!KQ62@-jX^-8n6{fhY;Z&^B?_!-8H-uJ7*Q{AFsMBr_Q;Vm1VOcoJAM}6KIl1VgItr+NJ)vCu$t>>HRpkb{P zYf!n#&#{jcrTQWscrdyqbLppI3n=I6HS&&_!$}aP%nG(Nq(Iq00(Jspr^rpT+gW+S zj9u6WhC?ldVi(?fT(FPHQd4W$nGf;YA|1_pWPQ@4s#!M_xz~7{iFW?BrJVX$vfD4m zE5w-Gr&CwG&y~rFCXu({caQ()rW})$y2O1OS$ulCG5`CSI7Kf z2RBN^fMujxBU8vh12u+Cql1`-RX_zJBVAaS=T^T84l;4y-29|$-OayGEzJ8HT6iHD zJUj6O`K%muv^7aZ`e|5U0^ohc`{jIwD^$DZLR3M6Mpym@V5ZI`0E2&9z zOu3(Hw6auH=+SmYTUC@^W~^0}r)|2<<~pxBS5(R`OS$Ok${ofcwq4a$O-H%NK*xRC z-gXE?1GU_2JB*iEt|Z2t;w6=~wAI^NwAD4_TYK{wemZU>G&a0^2(GHVkq2MLsm~aH!cDj#+iPg90G(PVIvKdzmH&vFa<1cO zY>>`yXswE1fJ@9#Gj(GH|dgGC& zm;Go9OkU-9l@gX7;ds+__>cXxn|(TX``e$0Vahdk$YMq8NuOJMi+~f?(;0!3U{%IP zQE~6=T=L7fvv;3R?Nf(!4{zr7h?c6$LLNZFtv?(@DgYXu@D;3|mqG9@GNR*6;=HCj z@0v?MR!Jvb3cy>2Vg=DCP-VV_to(>?2$I52m}t*ngtuUO@1UEx)t2!Qk!*7i^>qSx z1K*e#iJ1>AZh z>uj7YFD6a7_%%2x`LHK@Jmf}_0wT*& z!90DQeosAToM2iTOLATl@cYw!^Pc<-!Esab>Bxar?wsuB0)EHV`_mcc)g?u^hQ_n_ z6`iP-kJ>J?hTLALdknK*`AM@dBSCZ0MhQWHI|Mu)N)rSslePj;zT;Pa`tguK{SGM`vO*6aG3uhLq<$KFwH==scn15aWGkGiBtkLR+4dx>g$&#Hjp zf?`}tG75`g0Ucb(KrX5F+gOur6zK?riREiALgzS%E^LI?g^!_dlS<*{CA+*}$L;u8 zO42P~VrwZ|LL)Z**cP>bI$(Nw)t(HN=9L@;ww2aFntOT6rS(=hDAih{tYz0)sD!jW z(I|LC!*O1-a=E5A(oXXxwtBTf%avvwCoq(|0q8Fi9BmR1iCd zNl0;ALK&f?gF|~kA!w1`0#vgQ2TNKC<~=^?PVB?#?3SYZI$2arz7{0Pks1~5^V}Fl zCY5EWk=@VYQBXLt$eg-du%{8UG=AHdGITku*HepT;-HPaV*&C#2k!wtY{^GFG|4q` zzE;Hm)fS?SFVxozA`ScL(I}sGf!CBO!H5i zCs@6#`8fW&_#>}>DIw30Phj@F%}e>cjm7=<5tH}dh?p|=Mt=>Igp+>;pE03!LciXd z=QqzpDmt8~pkfXNQHR{D78Q6FN)OhzUPBPc*klf}grgkZ`gFdlV3C~t zxja9Qx1nuSIzXkxeQ2vgACXcHGbcVFS%wk}vaBLb%Xpy8tmaKGVQC!&B1EO$m-g9o z@%)x2tjv#R;zrmHUr5}|blvdneAKheME2{iD}?-*8_reMdTczyL?Q3a^8A;=o!1BN zf&91YY}%VNk7}BlU+>jj7oUGjD+<4fF#DI1PdrvS`C)0Q zjU1XP0{Mo@cNx59bjZzwgG(*BI&GHp+KV&JKO#<#i*jA`W<3-teoBp^5R2Koqc`>x zb5E1^R@3x~8+OgzE?UbFnY%;8yFXoo2U~ph>$f%IGXJpQ&<0pnMv82n;eDL3%raWJ z%yPCZX5buWPG162j#fJA?-%qiUJ{lr)oVX~bWJmN+AvyqyUi#a1od@KPA_;@o%>!$ zbiXj>uRS#B1IG7_Pg}}N)Qr_EF+|rYr4?`$()ioBDp#eJiRMO6(ZFL4CceGPW>MD= zbhRo&Yz*clk!LW92lf3Mr>ep1;tDKwR#s-dDLC7}+-d1EF0r#W&=In{*D-Z27Cst| z2YCO+zyfw41g5x9YbtQB1qL8ehsWJf8IFZ=o1K+I&uS+ zfM3T=N(#aM0PRc2=0-MABT?USdd+*%H-pa2w80LM_TK+833g#2iTx+@oC*Hfqlo9w|^tER~$*)|6_d*%t0e4MV*D7dXjh zo{1VGiCSjc)MOxd%;SS3-uwKGlf$OUsJTu0{@B)JSOgU`Kl|o z@q)V{#MHPN(;9Y@#mBj_Jkr{zOvbXz;ByCv;aNJc9UlDMjJKLIuU!Pog0O$;9K8;O zKz|QepOT71wl5WLQ89Xs1@Z{)0A3#WdWuODP)tOQMyx(7ewmTD8%&`wJyzmJu`93} ziesJMbK3#H>Q8XT1lsY!&r2V$&Dy?)%8+$=n?y2#L0Ml;f#oERN_JlD#yj* zeT2JxoOsM34O-laIt>bNjPT5?Ha4=(7e*t}IBXR^0S zN&J@16bX~-3L|@WQb^y2;ciMT5R$hNZ?Z}dyD)#848xih7E#R8G0x7=t3=PD;=s`V zY*V_dr-HhiHu+5E@KrgAzj6(@^0@%Ood`WPp?>4(8~5$w+=T9jtA))WgQXDTJ*cLb z^~5_djYx!9O$&9>ttS5E7IyLM0%i0U|AuS_)3}jeC)IR1v)fRSB0p6u%tSwQMq@SW ztCnxj2eJe%a*SoYU;4y2nUJFztQ~h(CiUR$f_@e}(g*flA=p4i5n3dS{OvpGdJk>W z9V}JDgl5BYjFAU+6^cWW$al{Hy!asn^bWzU2)f{mF)k?V^{gU7H*5^o8X{O^58UK_ zTK35xW54;tj0By*l=DgiCc5fqso&^n-Ej^yJATIm#i^5#KWOXJ2`yP_<*e85x>2x7 zo*zmBk;k!w5s!4>1xP<>_Mrbz8{mdt3a{Tsw2=$u3w?QtTuUOUS|u-*(qlxx1+Eod zGP&re#{^xmN|ejg-4Zg*jY3L)SMoJeN-m_*MW?XjlWMiZ{~GH` zJc$R|M`rS@SS7MfKCF|liY1OUhkCTyD7*&d)rfyU={jfCmaG7tA$WY#+&C`6-2`;q zLtJh6Gn2L?!1wCxT?=>$f*-?MxY3Mq^c!sNRJVnqF>obtEHfxx+w~1a?UKyHx;QZM ziQ~*8T(Wy4pHdiDZ!W`rzr1w+csyZTpzzO*kN)->X}sj2K&8IKw6QNLgA&2b=X`Zdwha35BtGKz3qjI*qHv$&%z&3X-LIHTLM4nJ(n z5zf0c0yo(Z2RklPn+hWx?0XCtRt@pBY00v@DDkKuz~b2b8fO+0(Q(emt+&_ov$UE6cA|0>eg2yoX^W-vPLaowX?X1BSrA<0@)D`+p$ z?R5z7#}>yki9Vak@mWAu;HGVn9*`VMv+Kof&}W{)b;HJMX4&A-a6Q-pt#6&J$eJbP zd3E%7|1$X;oZC6Ju}+U~~oak^5T)jeAHA`qX>2ZfDX5h1xr_fJ2c$7|NAGMp_him9s%ws3c7a+ zArQ^G?@TDpLB}?j9saC-c7nO(DMLPGxKxjhVvfjj3(JieVrNlrb48U) zl+yiZ;BqiEhUkZppi~qGHU_$yPxCu;aXAB@^YCv7RWi|u5RYG)9>r4)Y!eOO6P&o0 z92=8`)^>7AKEX?tRvd~pq~;di>SERd=CxQV4*HV-l~)Rd!*LN1ot&D{~Z0TCI7Cs`-VMv8CG}ZX5iwcaH%0Wv8DVT$#k$ zgk&~Z59Omh82R)NwdGu1{j0XT2zU?kPEutBObR2+LmNJj<}*jD+){ig+~E~aOslP!9OfvEaVgZX$(dNz@`fCqy zX)O8)#snPtDi*@Vy;6(XtM>M{GAEA|X5j`}U)ryD8rI>uv4l;utd z-kVlzc!;OcfIki`H0D_9ofAZG^9xAMZOrgKdn-$+?xlN?p3);OM5FrQvw;{9ai(fp<(^G-%i+ak zuN3IJ0EBG96uzo{bgGwUj5D{r?zYt9y<%k?ZOoutowHFaEbhiP!nmK+9nu3XdZl`9wtftk|Q^uLw( z49-T5-K?jN&w+? zl}FduA7-z3e9Y7tx|Xz;DY&HE&7+$?;i?A zEXC83Z~TAqgZNzi6dtJWO>dsdu4z7YOC-)iY@izuYi^S?6i+Li$E}3wFVGQ-VoP2l z>ke0exOXzyP_S#Ef7;H-=>cm4aHY^7Ee9OAx#r6%TapDfB#GRNaRX8Y;1oV#Dv}2r zvHGd51Z$4|Br3W_IUnw3iF{T1b#EvT@(O}6RApZAm(*rPuD#$ncYbNvNxV;PwKMZ+ z_~~QBKNk1oo0UdVPxLvY8-p&aSi zX9>mPYlJBb>{N%&kZDT;dQ!d!#HaV7hRi>CpT52RCE2C2m&^V1*5%Gb{jbUHKhnFx zzen%#|K$h+%Bod=nI1bsx6*FIQ^sH)9-r1^CFL3~SXsl?M23gR1yR(vwM@?Vz z{OYcwJhkmgW7&{{Q4TV6n&6yX+ez>9Hr=Xj9YmOh)BMhus$jZoogf)t2$Zqr8T>@l zN4vs`73h=pb!Q>^vd0qKC7}WTO%`ej*K4-Afp^@2e3it*z$;2u<`r@=kp>sWwIR0? zvLB#m5svnq{rwk-o@u2tJlDwxiOC39J+lD`^_GpqXgx!ns!6O-+^O9TFj`xSu$9O# z&Cv1Ta$qvK5x`h}r5IT)1{@9$`&G`1Rxy3s2o$ko^vJq4k^<@VQ-b4v^?a+N=2CY& zew$GP)S@TLZah|^XKu#J5ef)^5m^!&)W$j|M=EJ3OhZ-J8cE??(|I51Vq*!aM|ohm7q7Fo4FEX?N) z*wy4AX&_D>XNwwUGQ>+r7_S!+5_~0Y;Xhd?VtB|8@A88C$i2rQ;fOBSp8l0g)MIB7 z=dNn#7tKKG`4cRl;>&PP{nHFJg@&-v4kKUpPTy_vy3}RQQ&S{-pImSXKB-w7tr^!q zf!Kr%#svRZ2dsHakL|<^zv3057R@{^l~Y&Nma!0T8!zb5##c%&`8%tOtPU za`#J)Bo(UBZ|*;RiVH|hQpmR+h4?>hp2_}u@cU~6TkNk7IsCz&^Ix&Inf%Kea}jU2 zTkL(iP15>^{){ilD0mb4-MauCsrOJ$BIy1iYE<#kY#{dfi3!oXy-KUvty6v4N)7sw zN)07+67`eCC4|Pxhb^HC;kn{%c6R=D*`%1^2kP(rW>el%o<}~y+mCvO^RF2{;Ck4e z*#jNXPvy$_OAD|XC1u?#X*-2Wizf}(Pb`|^8`LM27&aT?eZq2!*=Yx7<;hnEgevQ) z3RjxUn(IKpN_3=-XqugPV(uDgZp~RXcB=*9@SI_l(r{oI=j}Sp9*1G{MM)T3_irbA{~_k6>DU`R7%>%r3h)B^BjWs@#U5^93>* zKY~FMxmcD$5$=W}Im2MHMmj>;B0BDrvN$Vap}Y%x*-WC%q?(iRPq?LI#sv1(Q&BE( z&J-0tWiZK7BI$wXw-gm6xR9gIaV1qY>2UCxKvuL^)G)JrAc|6I!v@ij@4v|H2#zb;?keUkfv}fmTpb}8p zIp1Qg4OqoG0IY(iQ&u)y#fB-&9&mZ2+e|y6i#VeY|BP`IR2z3%#5fNsUP>i&=^UZ7 zb_uRT%VO~9-h;}rL(LM1=QklV=8z*_pR`KrDO$hh6gmToI0lm7=aq<525OfTI(`q~ zq|D{aRtq;ik!V&NGc_zP&ojfc_H7vIPzg%H&&Q31-?MbaGz|gQ2Hnfxz)u7FTw@*d zDa2c;{GH?vlCAp;8$+Mf@kJohL@g+05tDQ=Cs&4`S50-~Wr#8K^eB4A(B6g@FBrNr z8b@6&8g-T>*o|G5w3DP4b!V~rkl{5CV45DZ4&T*M<*$V5mZ~-%a#%IV&uR}~C6XHw z^)jwdh8=Oivxh-1Q`NN#hVch>qrQZSkJZ2ulG32l4bh2VmR++15!F%cN-seFYMWsM zA^-YZu-?ctImctx?+a^p2BgnNErc7^pV7xYB4nxT97WW3(mp{yY(q%;<&`uapQXZg zmv9LX*P`;ym&%PEWPYF=w`9vKlB1&pjUGFiEIXxNgCt^ygy2=3Jw0F0moy@1=g7Q8 z;hHpCU!!j&7((PQNdv`rNOGV3MNO6rdhg41ba-~7mWm4~Cv0e%NS*eXY8#j|ex$_h zkDghCsaq4Vh+}Qw5Bls)z`LHhtzp960%E6{&K3Ig2aw7D*hCR~XC5KQQW_oEQfB7m zzxs0eJO(xwo$LmXeQ3fYZ{%U*P|&Lw>%?$OUwP=s9+M;}35VkKv<(7rDs?#~2f z0Innv_Kvn*f?L=Ic5QZJ*SN@`KRvj@j;;j)ZmlZp3?-yj?QA1*2g0!QahdDZ5DZGg zZJ$i(4t49(+lggyx2K@-?pou!Fb=*Ex3(Y~@&G zr5*t@24yr`d!nRi*yX6LQT7=%21a)828`IHq>Q|pC7YRYj5*^CO{_I!2SsLvwQVYUmWmt7IAgl9x=r4Hbo^WMg202 zf49QL!RcK_;jC=&K&A+HMTOUU^dyF9xFd^x#-TeQ6xpmAFg)JiPuN$E5}Llc#A={B zeC^~F(U5{CyU2CAXCz>KaKS|?n&b9ENc5>a(DhXo(SS?4!+kTWEosaBSzKPtC{Q|x(Udrg} z1P8zNX_0!z&+S^!gk5oPD>ds^T+L<_kce1fhmrwL2#~-0APh9HCJU}vu%`M}@K~d_ zA`AHo!SnyrawXtUwO`y4m8DQoc3EnWF-Dfinrzu36cVyVmV`9)S;`XXvr{QlTI`f0 zyC`c>$(FGsQjH-+T6gG@u~+!@!|pqeMn_tA@1mh1OXiB0p) z0f(QQbEpdGly{dtRrO%fgHKaEKJL|3A@Fx6@48w6>55E`7z_IYq5(G;#8NV_*Oe;g zsc8~QY^g7&qu)t#V@-OigJx`OG*F`(Hyl?HKEuMe}3w2$MzsKCGTlFw*rZdcy4d1gDQxb;r>MseJnKGy94Fmr5Oh=z#5@s9zB(tS7 zev;{`u10B1QNqmrns#*zEk3EH2*)y`8+FcgEWi4l_$&jSi?__bpM$roBoueN>S4&t zI+otj8gCwaj~-_IVXEHSSk7I819zMHKAyEa_!P4Proj{vM zo9le|>U>a9c$Fx;HRr%t&Vk1=we+&J=iMXN27ET4X%F{J&Kwvbup?b^CZeZkbLiAh z)pDtdjEwl4*B)|_SJqPZ8Rn^z+qYuV_-%i+icsbhq83l#X z%Ak}{5@@pY5TrXp!~XzJ)xp;0nBmf7C6+?e0}-foz)`U(*R>tue7cnMJoRgtSU9YQ zYgyCuF0mvFYl<}2R#3`pOxv`9TeQJdO+5(tqx$leeltR)HhQDmB@l$D?r5Heh&wh26=G--4`jx;3IwvMI z&@yB9@6TSv%Hx}5mJFj7iPEiBVp3ZKnhsPb1=Zb>_sw}~Tvwq&aP=JBnV2Va_?S1> zTW5p}MTm+|>XGoA=WXq0EPLDaD9pNz6PZ#}oK1b*dFpZRKUTd8k#c(#D=Yg^;E)C; zx_Pcr`~EZcRv)R1h3)vUY2!rZPiC_8r$^ZRW$(Y2u=0(Su`BiG7iDkCL46Jz)6cnj zra@Jzg~qAzrlYzkR~6HhPfa3ypL%l<1X(L{)#9hyA60UynOmV)s`A}3{lC^2h`*Gq zDh908Pu5~Oz+XYqmTv?sODrl&Bq*N1CI$&Hju4%!f43Oio0e>*bD>n18pRZBzh2CH zRh1=;>qSY?-L?V_7Xv+6Xs+Z*vGLR@bd-hKr(-F7wg)2-*A6u`H)nLdj@%242 zG<$4Z9B-0yWq6N_>1n+On1vI`8zYY4))d_EMj;YX;<&Ew)!aTA+IV}m|EzvdbV?wO zzt5@cHUGJzq8GH+KGkSUbQ}n|_V$e_pZNmL6D=eZ+}OagA=|(@+CJ_;0J~Z?CKyrs zzD}m2r_t-p$X9pt>3qxv8deBk#reOvBfybD?2dX3x>U+cnaVvh7zzazMM|+KZ&zAP zae-*J2`T5~lTrhp?d;-bT(}n~6zj$1ls>4MnB2G{N0^@`P-B^kWOq>^KWN={I)J&@ zeet>F{&w>`hQXlEGzZ^Go}Rs(naz{UIniVuRd>50cfXlnWd03|nTgS= zfEdOT9|oS5C`mVK*WF`#z@x|dw0o7yQITl+lcmIkf5}Z<=&J2()_`N4uyfUzi~gFsy2J3Nym6rL*0` zbHmg#JsGGvEuTSsQV0m3nQI^|pTJjhug}^7Y3f_VSlz%wjBEDa>N& z_^T8OH;wMSR5GS>*)QKkg-b?rA7`XbPbbrCYN^Yvj2On0^up4eRrYM`XV+R8j299=W<}Y>lNmgx3V4JRE#d(w@*e4Kv#*g0|?) z)*>VUGc5%^zxO|@723kX(Z$iz(aZLy)Z)_XW64fuV>*tvDQ!G=hE3X$BR)UQ522r! z`{ILHK;Q<3uy7@b{qF?*q0B$uYFAt8m;r`iJC%_q9vx8Q}4?HVUnZ5 z50hzAsj9arh zVaO^h*ymPwcw}PWIPaKRW*j@>O7|MBL-AfC=cC@d67(`sz!I_%R$SWSIzl z5}O-<+?pjC(`p=3+9=t1^ZI4MGKUhCEUW#wtrBM&JK1*Z$Q-T~j(aL#Z=aCnAvXRv zdsMyU+6&DBw&Zip`P+R{M?>q5WW6pN+}dj0zJak?i>obmt;Wa$4`1$ABgr08e78sI z@fw+%l03w=?(o zkw|v9B#*PZdS3EIzb!ZB)La&D$;aQ@zmR`68t^5vEz4pL0j%Y z>fBOORj9$r;GICNo4z(B)kX@4vldQ}3UbyG%MVgi5(ZmRE#N2s;H!XSs*q#>%ft^Y zmsVb>%INK-@ z6CXwMAL}NjRD~mf?4@u5K#;u@l5!x~O2!<&m<5Ogumi#&Kqf&r0UgLB2uVD^mkZ|= zgpd5bGx+Ww#6EV4ZYlC1Hv*)mgCy(Qh;OkHxq%=#9VElV1DApGGtI!F+}ZTu!i zBc}u;rh~-o_e#D7dgL?-L27`jNB=_;6f%<2DNdx51$e5znIcIT3Q^R-wSyZ0IDZjX z%?XLeGPM7ippFz1&fBsF0tBusS^j)Rzv4+EMTE0YfP65JbZuH8;&0etNbi8C*B*ig zu0nu~`JX;TqB;M9^MVwes9Tr_or7zo=s$P&lcKxBdLqG&WJub1SB(CP{$x^oc>fpJ zc?pTDz)JCd>cb=jhxhpqgHvx`A^6V?XQbfpl6e(q+Q3z!@XElK!dOx~cwxFM5nes= z&+&eg<-=h}-%ntbJ0vfF74qMGnTU4gZ~$;sgqIW&uZq&BWdZ!6;++%|UgrQ7D?-vQ zy(~=frHiES@N-_Um;#bY#bv?&wEuxhD@d{7IZAB^7`ReWT^9E5&XwW7q>copKw$#p zc$VQv-%~u~fRtb;6coo+2J|%@3P%Io7oPV6)1Q!Z{Re39^wqayDCrHr(`dvGbOG?K z71)(D*+>cuPcea6I!MIyR|E{7^sm=Gc&3GT&gX%z^9trnn$aSiGd!&UCUPKI1m3nQ s0EW^!q>%6}Dwr>UgdPa5Rs#92vM2i5G(a^9kVpi6Sb?2rzA^aQKZgSwkN^Mx diff --git a/ipojo/manipulator/manipulator/src/test/resources/tests.manipulation.java5.jar b/ipojo/manipulator/manipulator/src/test/resources/tests.manipulation.java5.jar deleted file mode 100644 index 456e356407707eb035fc1a1fcc680e94c57926cc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 22366 zcmbt+1yo(hvNjsr9fAjU_u%e9gCE@8HMqOGy99R#F2Oayf;+*3%MUa6-N<`0|DD`| zz1C)Ny1vs@E!EXkB_|0Ah6)7v^fQH6&`I;lh>Hj-DAG!c zJbVNKN}rUM^`%FIICesA7p&QyAi%NIb^jbDf-xti>dt}&y|1kH2HJA@OD;9o2s#Qr z)Td?5qva^bgb4|*BSj^t5TGTUPxToQ`HJ(wVzvYva8ZgJq$J{ws77%$#D@8cl4Yx} zDv&9IbgR3-bqq#=UqGrT&Y_#C3RsveI0l&&Jc{}+L0E6K%)lC|52e_ArIrPjV5cb> zAD5KC%gPtS#b|L}8=I$$w%sce2flw>`_@8^{a7A`h&acncszs|?7IG25%~l&%Uzcg zY(F-o+;(=*Ck~V)#NrwWgs-QTRky1y9%G$q9++fWbU9ZBHU5wED>%jWARxKFR20;c(*CU|(5DYVKt8MSsm&ks*9{S#{{QcW763;BOS*s3 z9Or*GH?g)dwW75*u(P-ON359tp4A@=X)OSjCe{w-0DBWFOIlNaBY@=}VF>&thP9Oi zt+lO{wSld@iGdyNur&13$md)2kU_FuBBVeIS;?7xu$cGJ(wUx!$P*6=u5Ea4f8E|Y zM5|Aslc!a$z1s!3Q{{#PtA7P*QQbypH94THzui%tBV$U^P%_>kaI|?cU6viMNnmoL1|Bc~>S(jc+kr!Kt5076nq=LnarcL&?K7{V z!k&7T{PcX+bk8qynd`skyR(IPud;>J0xROf0njxjf}}#LxU2 z75jxg38T;o!P8Oa}8@#XB=)exkWfZdmXo~=Z>O9?m*tO&}!XvBIXH6pOHf=^26UtTM48 zK7RIf`fP70fhsln>pC$H!l^77n#L~Ih#VM%3AJws+@SeEejg-At170@vcY|VcTouq z?fIn);Mfvu!`h=%4Kgyas!HBkF-<9!hy*}2pj9eQk5A$X>0>$!?(;K;$qe+bZY*7O z`?2TNL1}j zp@`0Ww|p*i&|Fw=61J>l3W#{`%U5hm^6!R|8TBcJl5}`Cq!viu7&pZydbw}7+^^?W zMy=uLN+-DV%~&mkc&CkeH*hp!X+s!!jvYCqZJ%);YiIN}>mS4tRBd7LMw8%P7+=)9v96iKbKm3c48ir>!cKf;Vx!^t&|z zi!j>0la#Qg*)v&hYOun;6}*wO{I+$Na4vgq_hDN&w^RDuk{ilb&5{U0dWRkZN`Gc% zZ-Kc>M|vx(Pun45Ch4U(=rWQCO57N4gL4Iy zESCmx;VVwC-PyF4j8D^AEUwZK6RR>P=F;VX#ycfa^PpkG{87Z zBORwj4MSMxq(?@`J;239&KCPorE$DSUsrFEBFfH?S0Zg+C-CUFZiqo`Q^9)~KG!s= zc{$Qc1!mI9_ObA!X^gcs+FXXkU5S;KrQInx&=Azw5!7A5dtSY_u@*1&ctO5v1!?l> z@w7>tfpga3ZNArHIhpb>IYjjg_{fuf?YuxC{}FQ-55{+|$uqxLioZo==FCa@q=V{H zSQXD8F5~FISHDJ$7Txfo-9p9jvL@d{^AEU)WiIBfx|(Mv$h=y##9v^SVv5RhSRvT< zd|YR7KVUrXUHK}dTP9#YK%e1$T+!$PH@Ke`v40cn)0>5XJwP8|51@ToqVg3x zLl)=}c?v5Zvu-RYmhux3+jt-&yk$s=Xp_?bgJVUa| zP`cKbZfXN{Zx{Fnncp^m9`~19KDSf5ZUe z|6=fm9rTaby!>l6&(_aB;zj!Z;bo_1UWDKD-w{kA2JP%Y}K0?r>I&`CEN z>BbtyBAG&+YCiE{s}p}E64{8Z0)pRKr~S(?PQc~K^#%M2Bo{J|_mtdNd_}Db={KR# zc5-!p#v&nxV&j4R`G6uRRmIL&*}dW0DEsP8d{i09GDs?l1 z{d*SHv#pH$TL_;nYfA0BPlnw}3T67m;duTr%Q7p}&~BeZS^YHAzR$8>h0XV03Hwh$*D0vWqVS_W6sXU? zq0}*x2Sci~RcKj5qd-O!6nNt&*8`DJU_c()!ZdOi7xXBB&wTPMamI`})^T0E#vWZt&-nPgFD!5n3>gXB^b_am$&s4u`mD3?=^-E=4#!wsiRv zdI{atE@AF+U?qn76){mdQoyP_Gy)>ACJpFa=LAIR;x^vWd5Q0rGiNE8rW#&8G0NKG z1y05p!>vVxhV8+HO$q%TE zz}3JntnDz$HY=g38-=Clf`hSU-(yNG-v?CD=?l?|o5eU1NGBT73zN@4_Anb78yT`c zl-3sNC*iahwy&?gecK(Rnl~WEpIU7YjPw1dP=mI}XZ@nOu?_IR{t(ebtC?%&rwO8IvXCp)t4z|9R(`2AMS| zcsdVPzWBR2@jDBUh?SLsfvuy7o`JZ9wfUd(B0qY}a*7YJ?}Ni6ySSjb8px)Ve@`~Q zl1dssn$H`G0g${Lyhe*fi{|JWy}A96KoDTESMc0G2>zJw1(m2J%X>PxZo@AxM-C3& zFY|hWIQx_%dUxO%C=|az%QSV#K{=C8i8FkaKAJwPXQ5cZ&q@gErc@y)du3y3y^<^TS zm*^vo6$q^J*DL)XvsU;LP}NRKQBNBU?G7#&c4Lo{=pl@Ol{Afhk#tmTvkf(3mvv~C z!0-)3wz0vin}*YTkuN5%tN>?|DeB=H7LH{z2ObsCk=TPRjZV9MBHkteUM}aWB!c4k$*R}%U8m3|NZJPzR={+R1k6+2$prVP7VGhP7 zi#B@?$I+&OO+w1qJInSOL6?D5HGYv1JOVuZ?2Sfs5_Z`mO@C2v>?g56U^sLPk7=2R z*Fl}OSBn?j;ohA^XJBox=80H_yw9^ldrhk~;i-eoPtRZP91_1F0_h(-H;hb*Pxg#~ z?Vr*pSH87FQ9^xSoqJ``EIxe zth7LZ|C*5>piJ^YQ}C>{$-F?quqg?9a7^9b6jmN?>M`640B82Gj&jJcQzBgX0KCPN zPTkDTwyz8$i+^ZpCwp~rV6xKWe2RPmGmAlxSWquPgf1K;y!Hjp5&KJ9c|mg7&*RL| zei{HI=>c?fB!7u6qLT5j${=cHD(V~^eI5$l>GG<9x7i=J~M9M5D8Wpwjf8IdxZFn+G}GJB0E!%sC8qh%oPKvOQkKCX&G| zMxxitV14!*G3PN^0X7Hhhk2J980c#kB4H?&Iz1g+&~?kMCFmwx|M0; z?AN`3zsG;9k%2qOQTj?)PE$jDPSTXBtQjXRd$4VUsJH#Cgv4iOmG#PuH>W>TY%CcK zDf)uQ`KxGDVKg_Ek@zA+uYT)6Mt|f-=f*EFddk9b?;%j&c>^@$ZNDY91$ol3(A+P3 z^hYVshP(rgjQ!;4cQiQ4ffh-;Z-DgtF&n3FR@XJ6$Lo~Ex-}u>sV*G5{k@%FJV)k6 zs#7^BS)RTrQQ5qGhIT$wVvX>_5&>7D?uy115u%Wx>Fjn9*PMokvQQ!UE(`~c_;Vqz zHV|3T5Y-cB&fQ>d&MG?8-m*sb{BxoDj8a-OVW{PVo{sUofcSFd1KX-tFXOjI1*so7 zCF6Z&%+A6s74BIUu!NTcA_GOhMy3s>*K!t$I(wzQ(ioarGFYL?uPCE4u~a7&hxbZJ zQyZEB7!*K5lbe-?r%QAT@X(kXijs6y_L89I;sGJP9h3D&IqQ zIuC^LHmC7A7z@lkehmSxj~gzrqwNdqK3vWqACPrpl3-t|0H| zw%zh1Y4igJZxmE^lY^q|mVY;8yLBdUOjJQR{ravA3{T#N${H>Cc4Jsi!WvBy+PcMk z>@A5i))+;{lI@l_$rX0R?Mf^v?%K|Vu*Ll5FZQ6RxVP?}`f)UFqI#j0-LJ>=dQ5R%dC6E2lxm5HPp9EyI|Z zv!>Em(Xif&<722kZmV%x&26ZuM3;++-B)L*AkJ6%1{n><^(7hn$^FnPt0)OBUpia% zoiD~YD9%tpov-|iGA@tXOELh-{qQSuBr*xo1xnYHry)@eU7n zY41@facwrp$Oppnv^zV$p5NvW-P?ioSOalOzbM1;F)J)w;|y=zvkYz+UI4it`D06w z!Bb^h00#n^e7b7*>n(- zDeM{|#X=TChX_SakjgyVGq893I_cPRufmB(fE_&cAm3-VpCh&vYBrg1mhLv{^uf;U z@De|B3<$NdK-VXG$CW1CsmX=>92B6AZ(q7!ugQbxnRQ!W-DuR*ZrPk(u@6Z$?$mgx z)>ql&P3C6K$ZrPdO#>VTJc3}qQc%e75M7@`)Jm-LfkGT4@5Ouh9ak?yA$ zw;{th8E~bW$64DG5?=)jOsH4)YpaxPUatB}_`hGn>Yjg;pX3&swDm3!&rZdmFxvPG ztUr?-F3H72CMs=+nBgaKod{{ubvkziGAkxcL6-Eo&m6KsL?8;j^P4dwW7T`VIAFtY z5&d_y6G8A%3=s^E!D6J=zU>S-FAQy%!Uhr#hpk&cg5wxx?k2mSEW>Fh1+;rDic=Mr zJC^|0*xyKpra*_;v?#A@M8x;z&Yc0%=@juP}wqx!E$^s}q-*@^Wpht!{5r9YiQ ze|U4gdtko%N~E6#$N!i``7uK>APlGhvQ6wCrG@0=Q8Y0@aB$cxgBmcU#rR;ea8wN5 zRI=B`)(dXTXj}okjyr+Xdqw(6L^JJrVRYB&reXW*{U#bvgw7{#OmDsXz_{ySj}7|{ zo)anm_aY%`meee?iBd2IMWuc1F&b*~x;MdQ5XfMs#H@g6JzKGbdnBiFP)V?htx_oo zgJd*`$e{``o(6&7SuhM*kt z%ncy4yuJ*3z=qK-5U5V=P5g?CY#0Vn?V9kLvP)O`+KWOvrzx}A3P^qIH?|(T40??= zI;nj3__QbW0>y|OY`tQ-ZlqOhFI597N0bRzrkM2&Q~VdDR0t!JZB)ChV4*7`QhM)& z!;k~vKKs#VNUYX|RoQ7hJSh(^-tlGPq_r@S0#hXu1~dLOgtST@qfs@s z>!~1GrM7;elw>4n%EveFUxL3JeN5AmTlZ|w|&i-F#Ld78&RDM(*76j~o1n=m=oFH;|g4!#gfIuJa7i2nJV8ks26aifY zrBh3SI!CfQ2#q$`!AKK+jkc@!S4?~58Stl!3=_gLdse)!zk*^4@e76l z6kSQW?WN7qam*Ic7Xqv|1DHV$Ap)#y`p^B&;Uq1aCs$>3P$}dVZLUrEue<}m1n&cy z46y5W0g-(5G4r&DZu+# zkRQAh9LXW)FqFF>-=C{G7F)%Kl#;~i-0p)cG!Y zM1;?zv#PLuZ(Q-Yhg2ad!GsRU?GcO+udYAgsyKLdWfIYR^ z)z$zzSO?Mk@rel17t&V>sg{-9a++(MD6-8$1uP48V(gn6S_F-mQ`W)RC$)0WxMC`T z3Kt;}r8}ggmdR?&aWpSKz%<2XWW>@6^OWX7vf^bjCf4k_Nv564~jqW4nS&o|Mb+kH^Sr zcPz-kZ2gooxFvBMMfSiLxe~WRRN{`iOq>~Cb850EJ$ucyx2n}V_&!Zt8G~GXUK`s?nw&a)p!1O=C-^5%DR*di-o*FJ!v0fXIwzG z=)+~)3(FJFp@tEhsJjsAr;A!u-p7px2)U})gPe-P&DE4n5`G!7y+Zo+e&9c!%0EGTzmNHID$l5zI4jOzdCD@zCcjeg z2Ea*TK^Y^*gn{vk>q7xd=wV1O{rFA{w@8!elevc5KnZC-OPC3FnyL$xTUaPHV~__B z_^U}+%*?l;?;3v9y_~mm`l4XCB)d*Iv9H=p7(; zL%!7B`L3-zS$)$wf#}9lM5~8<>;+DHzzR&m?~tZ*Ou5T&ylGjmBS?r!ux4|;_ly(q!6GqULv}J--)V;fs#MP_?^ef=vWeV+Sqtc48p`^F%2xBxQq6fwo_69& zMkF}l+KsXjcd1ThgaYU*(bUo`peb&xxo|Lg(2IaKYn)&n$`_m zmiiIe=L&+OK>>w#~N(m*&yj_H`=2?Mq z*lf8Q-{|ah$SRX|MMt4u=7?ogio|E#*&=9f;MERK0|%g|+*U4;q!IfkxSpXQ0w#$i9B zV}@B77{Bs2hY__PWLmjuDGN@B+s~6@gOrj=wc|d|$#^|$Z`_GnEL(e62{4_=A~i8n zti-cIX$*T;+bAA@jf`~aG=qqzf6iR*h+K|FD&08Y8xArRU?;-Q#EJxV{WhNgXkCqb zqyg~tPRep}A|;u(^)og7(giV3_c6{Y-iY>=_KNV3*gD$eCkyB=5nn+=bc;|>?sF`L-w2&H4N;iMqZc`q1=)g|$UqjV_LvEXJH z&nxb_H)}{udk8gS_BPk&i z%+ak9=Lk7xVU-uE&<(POCiTcBEKXzM#^$H2!lH|b=h!^=A>r(_!v^zEl&e+Xjvvfi6p_Qn@k1bH|R%^fWAq$mb#iVi>% z`>s!>G%O^N!uh4_XYmQFK`EMrN3voPxUNuQY9krBIR=s`v1%V_{B~CP=w?DnxZATC zsg$j-L+=g;J?Y3{9IGx5Z!FOL*JI%USh8T!JhVeM4B-7IE&;h7V$yI>)YQ$j5*a5* zbDpL_ws=xw1Jv7O2K-;wZ5)JBL25+b#*w_eY1E1jlw)FQg{5ofLt~0SN$oNWWSKZ# zDeJiMUKj~A0s|pV6P+cDw5EG|>+R6*$`9 zctI?mt+W)sM=@kaE=t(#irSt!8e&o$LcDe_(mO#ou7<#PL)Q2JL(xb+R+o`<5OU0S znG5UW%DA{X_=p^om;Z{_UGfyr_O{^kgwk`ha|}x}7xT@r&9Q0LU0QC4=vrd?0i zTEg10H`Dw&7o=k|f*|Tx04}jF6SuN8Xg~U@SumIM(m1jB*oZSa&*?z|yBiLc;w*E! zZ+}f4)2IizL%VZGOcVOT(5}zF%GAF%+;8Acc>$&oVUv)3GTQHE!YPSOL9yHGr;s#k z%Ce4XXs}9wiU$DU4R=ZPP)Qd$xzmcf$jQM7y{+6xGO$K2IQ2B5V_Onn1$H?;;qWF# zVF+jX=rWgpSnzr16`_>gtt)k16rH3u62vNz*h)?j6^FOL^63Fn(V?(3uJ^P$-z+ku z{4^(@yTjS-IG;Jro(Eg}=}befrfWTdx}=2c+SUv0BB_hIYtD}{*$P<*&2*kGN!59( z9a@fX+qveP6FVptEh6!2UB5_9Qt6-Fw+lK>8L%MS;?<{GmR|Flod#}f!~r**ic)E| zlfh`%ekJn=gw`mo(n|(QpgEA-n; z{V^hLZ`su;_tM^b$aN;zz_XWaFq!%2AenZxO>D&@;OaQ)$+;#5GO(pmM~~5riA=V) zR0<=?aBeCL6)L%qW>^z-(>k~bD=#7}b;qQO`q3ZivV3pOb#M;1Z0_mn*C8$YOtc$&enBo9-jIHnEl>W`$R z3=`cOuXh@P+u6$$wI#&A#lMs+nLG%2v8#~e4 zB=>hPUNsvIdWxuCBYag}V5ost?os6MD7}O^&KoiEcT3ghoDZGaE(j8G6J8bMS9H%d zW&*RaP1IA&xa3ph(qEtD{`2$lPX?fXm9vSZ(Vxa&ow9`jiVCVHEf{ha5oQr&j*qgm z06;k3Cwd-PD40sFlU%J-ve6GFb*ZssHNU*hiZ^fhriqD!FM0P|uaLK7%Fam;8HRja ziYc~j?&)H0+a<&9u<80XbNLa7{#~X|5dgFPpsZy3+c2^UMib$zQglNC&CF&*DJPcY zUVY_DmcmpbZF+kZ)dEh_au_BYp?BGjQD29^6&gQLlTl3TY>={SMj=@M6C|(-ec4^pebEZ{zWb|E^y(gS6Jmwx=4GieNiEj$yDmTd zq-|Dh{l*plQ*!Eg*NFFTFGAF+-8(RvMm+StNiGi9rLNupK9}?yTi`nAx>B+@d~%DX zwS=y|^2=t$mPGlKSJ%;9)N2DS&E7X&1{EudZhN+vF|!RfNt^Q)Ye@{{?X^}4Y@=is zK&&-V#8U=JGQE2#@R~q|5w;y8lYV}J!aGy95u3+{bOt;oC?BW8T8*DLj$o9rmS(@S zSqBl|o*v9;Dq2IyPqJ!TV+G`-Y>$tR zlyS0r7-q86eUvhPRD`ryQ_$qtw6%S43r|C%9T|ywo}HP^qi46Yc?+EesK@>kW;Ud6 zjJBsoM9i~y@dChgS{409OIa@P2C*V4u9moFvaL{+4UX2ThsFJ64}su$ktdo)KVo`3 zwUbdE%zI0+F4ThnA27=|(Ds4w>0D+Q#wR_%(-}RJ{BoVV_xO=^n3=lFL1R02ifd$W zJ_Q893;_g4NqHrN202ytnE8zB(1&7EhKx(ObPWS}GUQ^bc!Gh`tGpfn`)()qqw!kh zv7U%&Q+?JWDq}u&KZ=t4yhQ1@2TL1rm^ZETel3J&$4x#EN!e4Y+ki=1GMIo)>)o%` z7bUzj9^8sieZ&C?&^%u0wBb9^K={@nuL3#1`Ta0WPeB!5&hu}pJL)FxUnJETN)&%k zJl0_CTJf2juxS`i?^)*gDnaXMZVT%nnkydcmpi?bV?Mz_|L z>wL#%FRa@pd~PWa4m)1j>|1Itejlc@f&pgQz;J*Qj%qWc-994Mvm|XCEuJ!7&w!gq zs)khKrK^t;Nu^4M%#TRvFHr_ZW`m8pBTOb@11&q@51wMP18wrHjJuVD*23AFOrMzK zDra~PeNL=T8u<;<*xEt3bw78yo7j>a>ZyCYkhDRtR$O`;(W?HyYLLt!-VuS|+eHya z3@ST|0gKMb4ensQqb#}50oS>(guzPWE3iH8`Vo5+Mm z3xNrd`^denLlwb%i7%)+@6U`Ai~7yznjmMC{q=3`ODklNm(U?eflCL6ZQB`kPDl3- z>t`xJxvJsWApm|(aOnnz+<`g|%aDeY%1!TS?nBoUGiymFKl{2EOQ;s}y^N@YdewSq zzz&}FwwC;1FQNfv6WDf^Ih2(~GkCUzd3lh9&&VFFQBg9IJ>w9fc!48k&fBJbGbDZi zeil~jr4?|S8 zQ(Fs`z8QPNiC6+7*vBdTsDh3K??=7!h@{q#$;^|AN#+`S;I77 z&BFzvd@7@!n_Nq1Fl@@O#EMH9(Ldzlon%pHfSym-hAfRLUKH09DFtCb>BbFcGJ7?@ zIT}shSdV4>Av6QCc{gCJQD1t=0d29{BS6*L&81BUL@l;hqP_j%HTXTI&JMv;IpQt& z@-{qK0?d)X_V#1e>wzZ&&(kW;t|&clxF=e-Xav2<<}>bACSkb_WH;=$o-{5kE!XR6 z6GqrOj>En~U^eb%b$mgEW1w7EX(P@qyMW@2_@sQw?EUdz2JrPHNV{FKdv{t{>GdRi zIRQ<0r=f!Fnv^&6aFj1d6zk8M%Tg^ncA&dx6Xt`+pbhV-FatuBwky-|RP`Gp=!E1=`|xKPpY& zvv6SR)lM24GOHkX3f*~FYe?!zS7M3chD#Xp+3}3P!hJ~NMbu{*nWHmy7X}(>s+}*X z$6enVs-1TUqka6~q$v%bu48SzgGszRo{azC7YI8g|1Elc7Kx{G{hYyYRN#^r2~1j! zJ>JJ*0{kKes@u2^?CWq2IE*n|QF!30Y%$5s?(ix_^u7T8)?i6U>-@M3I?|~{2T=lI z{@EtM{72bm;|1RLX6WR}K^FOwgX~xDmCWx=vme8hp8e7a4kq^hx?L_;kbjDGMSMV? z$BU!PCo)EB%rTDcfeY?4p6Hn^B81?sB|NclTdG%o-!QV2G3%92mtwqza4d?ojqc-7 zIl=s;dw6tYm~DB~<8pob(-F``)xJ)|YF&h@Mws7nVk;FW%a&;#L<$ZT4&E&zYV;%n zeu!Ln3?F8`peHj@ZBa!sIWew2W(eqs%rT!IkLM(w*fRYFykgNXQ^57!A%$Q;HWy>0 z3pIL_a0FmZA)8w!zyhmIh${+~MD~`5J-^e${ee;MhSHGz`~hPbTaZ--0amsIU8$d^ zw zEi!M<=Pk@cyNQ|E<8R6L%shG2VIxbv94)a*=XGg)#aGSbZ0wWE1enmp$Y;3&Hlmq5 zmc*OlU>dzsVZkSMH8cVM4l!!Ph&JZimW#_ml{(@4ShhS?mDuTS$O4746{m5&N@tax z-M9>JqS~B>xnF$2pmwj`<(^CPc-x0O*Yy_oT50 z$r~e$Whx8R76S{CI()j0Aut4U#4A$eN`Hq&R3&Se1;>?nEb`ulK|1++_(RnUCmNA& ze`Km`_6%SlJq^adr*;3YEop(@8;rkPisUOVtDuOYK8S#}1b~~XAy%4}^pXPCfKcj^ zTZH>WLn_jjUu+`>R5s3OIa`PF2-}>nHjNDu(Kah z3QZ|qAQ3#XA5t_@Hh-NsqbVy8MA!t{r8_v?rjVdMJ~Oz>;1K{cl`@1SaF#IBA2o2e zl2jj3Z(ut$lvGie?2-ZPeuMR@dSrP6UT__R&HRME5k*S+u47h-N#Q9>jqVz>%lzf+ zpspXliaH|~(ZnnwunMCbIwgy~*3cnVHZG)QF?qre?jv_h-DyfRu|!WJH`Xb-eIh`= zklV5MRsPh9?NJI%cKYf$Q#`5&4yVvzIxJ|F=J=b11V!!!1Xu{P13}e3LdqbZ7+}6h z2(cR=ae3KlHCaaOU1i(p>Vl@4yls~PV;n|oApv=Cx>fRS@78XXNUMFCZbj;rA{vvD z>|}6sQK3@%WY~xxO7jpWiG5Ztd=}MFn=0AJKhGX+WAu{pNJkx3_AtCLC{y$ zFagORA!J*gA;T!13J#1i1BGdKiB6LfnUpEb1>_hj^t>7B)EZd5F#-&>EEVZcCAlrm zFgwfyJ`mF-0vZeBiqaLOsOEf-OVU~*gA)Pj_H_#Q;>$>R2FGZEq$)Yy*P_cQ$#3oeMfZ7_q4=c@ICO?9RZSo#vSA?7F<}AX; z$v+Fbhy|YF(j$PCFmI>&kVZ&6LEiG1C|DuOtB4O}XBEh!kHRKeN~`lFd6-n13`c^r zy0WM+0*Ne}B7^t^r&DkV2!(naQb0s1GJ0^6YXUSZYB7D6K098i;P3?n6uRKh3$;p2 ztBJJb)S}Y&r#r#M+9*&uM)~ ztPQD79h8AukcPmrklO4%xItf7eT?1d^NzyK&RR7o-PpJ;q6Mi_bn4Cv5(@;g5nCo9 zyeUk_S(Bw)-aJj0Azk(fK1;3`VScka>LjS34xbG747`4VjwiS+l>7bv7fTr(#x3}vyTYM>$704-ab3OHWPyN zqSxnvReCfaUNs!}99*cE9f+LPc$GhVUWx$flMw zYG;>LrhjP;t-^i_)D zxpWgk=dg#i%JL2F?V+!py7bZ9hUg1_E3&}ZdDrFPOb zJ;`J3>G`glUrjpc|4w3p#s+$3KgmowvQ6eGP0Y^-fz}DEOB>uOin*+af|%bIH7}NY zC#OR z(q559sHH*oiF&Gxp8F~dI`_+W%^I(6ikz$0V4%T6ZKuyu)_<&Pb^R(t*3~)h*0s5w zIhCiQ;U=0y(-tb;bY6Bqz#<_~EUGUvfvta%;9%Y}x*Z2|3_?N)lfnFo?0@KQHyD^FR5Jvl@HUOr|YOo5~m}+{g z&Q>6<fg14TBDOdvS}R3wy2*L*hu!X9Fpw?YgE@bl;fC=2I? zWDOjaFwvORcLyyT_-*@I=OZ~}zyspvDNW*NHW!+6h#=FOHcvd15dQqfbxEUv@%Dt=)XG55t}|ax?;$@G%vUdUQDZ?q zRXJJL{4u2C%ekBGo`i1xw?Y^G?}qeqXxX3Q)(qo<@1jQ(GP>^Z3-J-;>kdiriGYTB zC8JYD!p`W3%7tWsOF@RJU8ba8pk-FnB?-yJ=M6&*&D>m#Ir&|a z*q2B9ItY;0G!H8C6NE(zcAudNYsm>l(%=5!8Nu(XXi0hMYTMKE*Yg|jUkbz4#KOeh z#L?h?o#Fmmo&OY+f6Sci6g_Hy7Y3UNPC|9O2ZfxRs_92~gSv3SWJY?ufY7avBSAe_ zpFXO}ywD1V!Fv~|8x@g9>a;<$yz|K@Ggt5a`gWh~9gVxWZl|EEqAvlC(LEtT`x((A z(uN)bGXIDH?!arh8cGbt&to6mxhbkSF$@S?SVnHSuik9lx}?iq7d9=u-|L))l)l1K z7M){;2`PICmU$`Cs_kYB?~MCU))XjMhFel+ZeDHo zuH7KY฿u(YgQXrL+=#QT|tCaZ^R}&o5T=6ozM=h9Qn<$^;(9e)^Hgp6Dfsv%I zq9`MLhDc$WR3gWv&hV@{BSlqmG*BWxxxDJ>xZ#-Z5TEF4u}6*;TQU}_;Z+p=s5vEl z9}xiY%_Ylge{YsH2iU_cRh5WV&;N55U=8Ud30^nl3A+rU>>BC`^K6ijb%Hbeb})u@ zv@=v4hx8f^y)I5eu#ky`@3i(~vpqs-)ZaThJOaK|6TLvatPmv z?CER#g-QK)OrDD&d?(AlX7a3!zZJuCDTMFT{Qu$fJuLt4zTI;ngztp-q}9LZ;ve7c zJJ0W-{y%bmHgtc?*%$iG`svO3H@JTf!uwtn;a9{TGotx^LR@+(yYf%_^BwWeefC$h zACqf;?%xUGKS%p+ZGMle{}u7aT-N8S?C*q%^3M@}N#Xq!?8hu8iSI~HZy2cm9PCF6 z=I3PDUvYoTMdAMm*A)AAaDU0D`W5cSEQ#j?m+!=l`@3-e_jvg+r2jeV;yWSX|8u0D zb1;7G)sLa=KaZ4Af`5+nOUl5nU_Zw9K8M(TCq|-w4yO3D`u*Z2{t@ukP2@Rj_&cSL z{HK6Fc{_dtcwV}Gj3)WHNB6%6@c&y&e!OV?Szixyzty83Lsow6-H+Ez&v&=qNs;BZ z!2Zvh++R_DyjOU>%KA<%?7xNj}SJ}^onAnq@^q*}EKMk0FFhGAc z#7_8r3-5p2aldx#M>mt?cZoi|X*{i+ztOS(0s7S$_bc#^9++n@)_00{67YWk{J(u# zze4}$hxobA2TybLzkvR}1^?d*_>X7)XE(=p0zCcsUjTo1di>hgACGW=?|4sdmLmTh c;M1& diff --git a/ipojo/manipulator/manipulator/src/test/resources/tests.manipulator-annotations.jar b/ipojo/manipulator/manipulator/src/test/resources/tests.manipulator-annotations.jar deleted file mode 100644 index 45322aa819299b87eeb501502a085ccabc2bf823..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 83285 zcmb@ubDU&RvMyS--Q_OZwr$(UvTawFjV{}^ZQFJix@_E@ne*Pvopa~BH}kuhx&O)B z5o@m%J0iaLR_s)e1_eU{g8K8O&X3>)`iB=95EziGsEQ!1q?{PNte~8vn5eP}ovhgB zI1o@)g1p@Z1KiMWhWNkp)M|3E-;BQ7 zle$YnWYy!(V&O0_3qdR*D;u;2qUB}WRx-$6<+{bT~#kvyd|gQoD$s*0=-{BfhOZQZhN3f^TZ+Z3Rk*x zC?ALO;H)Ke*x(B;CnVOWInhf=s0PuWx?FHt(_sFg;nN*hc0|q<@ zU~Q-3k(n`{^Mx;fMx5v3Vvi%UxJ6Wu zhJ=#5pv%nw1_Fu$1p-p|mj;IZW9PW9VvXOaJeP z}{>5T0hP3a76ZS9;5oh|Ha|Gg0e{-Y7>?QH1m z9qsH*9i1&qo$w}QVfq=61onL7kWbgYmxU{w3cc@?&gv1$mar-@88V@FbqyW8VbpLK zi?{}MU3LF-2TRTLBZA`yL3DPyAeUL-2`!C4h4c}qshTS)yJ)6b@$|D!trhEvcgoe! zUiH^xZP_Yl+tg-dnmSuw`92pZz#y#_Lkc%N(eDQ&AGK>l;!w|1{|fvU6BE7Zjr{mC zsnkEm-%U*NPtMQzA5Yue#(GL!+irsm&DYic9ddeAn0qj3!9*j@0%DU*u&byUx$XQ_ zWfp~&IawmQ(7Uhpt6Ny99{r`A5FCYHgo`Ka%by+B1#b1r0HN`s93W>y4T*OGyLaI#- zE6-o4!^e-|S67E1YKq2NIHfrx(6NlXU>GF}<}J?8UNw@4GzVFfK@KP-*g-5QY}9Xz z_(A8^l$tzC5|f`W?w8z@nZIH|S)=Sqj*$uQ?cSmvkltD_3OK^v#&6j%jj zb?e?A6-{zuC=Pjw)u*0rBADN&SbD(?EK(Tyg{^dJwO@du^dn>kHBe{CQ(#aM%dv@G z?*~`qo2ILI?f7zxjrxqf8`l(`YzeBo^~u5laev73?_P=SYXM#?C}FQ7!1p&T{FHauDjO`uihiWSOxGbmjiob`8?A59NCjBY?;e zJ9T>c?A{=Fumxdh75@$K@zkYgHyhTXy?E)znBsT;`g;Z`#2|pWeYEg9utfR~(rBt= z6(a^0B@+o#786tq5MKNfl41%BW~w&I#HjHk%0v}#LSl-jBnxf1@ibfeffDj6wUhh7 znL_v6Jh4cYy9M7k^`)s!CS;r4Tb;-?R>+k))x-42|x_bDw!41+9 zFb>Q}-{pcaHjqDO>ENjWQ*=GeJpt>TAG!-IeF^nAHtFi>Q(8bYi#4)K{ z!@i>D-ur27llyk%?jXe)02^iv{E5aRG<3m$P+)q#OR0ww-Gz@6jkm4T06DSnb7r_b zIU+{Gyy(VH_&Uz1`00*b!}2`ffhMQEIY{nlXeL ze4W|!{Tn6P@=oH=O{*2WdL=d1RB0ET_YCiE6D8y}<87D`PH8nrsgy%|x3Y&vxmwSi z=?&fMkV~?!5oG(+9!_Heiey^zreyBbzI#4H2Ra)EH4He1_=&imR`B5+C*tQnN7F1@ z^mx?S9-Du|Jv|xskANG9@3$bkIrRgtJLehBGk>hkF@+WM5OL6PnRzC9lvGj8!+m`?!jyl0 zJj*j4?7L)sR&{W8#`7mxi?R5?9OXlfguJFP&rsH@{u{%>Fo1WSh;wJ;tIhg2H_D5Fw)cWl{Atx z^Udxi&Kw)<%}ml593{-pI}1|4)=^4IPqm#I?M2Vj*GkI#m6Dz~KH3Z1D1}%k5giX) ziWsgL5Mv0oJ~iD7Y{X~}B1r~8_g5IO-{`jx_UHOa{v3bL5&x%I+c}#5kF)+~8Q4D> z{~}{(Z)glK{kKH_Sl}N;%}lK=-2W{FnExjQe?=bumKxlDt>!Oyw z#vXsW^@~(>l~L8PeB~r0!Z!jdh)Mz1kw^^Zke2AtAo=-%){2$uTB(Of7^z!nTN-ux z>>t2gm!>tIR_0V(F2j*}?sH$W>7NPBGi#Nj0H%h<#IY-{?(Gwg?brst_m2%~An|Km z6vhC_7B$Ana!swI;lReKkx*5aRGop;Y&&<-vozL;2e<_Xot=Bym7AzKsUkA!VtV?~ za_8}R$|@3M%+VJ6CKWdtzrhEp6h>yRv39{3)M9e*eN)W`Fh{pYS~)uD9h!`83z>CC zO|H*Ufw%m|ih45p`lUP<`{=H0Mi-ys@yR2DT%F9i)&j!W6ueC0Naz-t1;79#Hdh?R zDUDW4r<#6tY7@?Jr)<9G9Buj|u5jM)p2?xR&sS(ln7FXokd#g_C6*2c+Eo+vu;1(n ze|&&|BI5x#!UG_R>_f|FSPIa(I8>h@SV?B5_Z2E|ZFB28-U(5gdF@j0qqOBXLwKy5 zH%;`w5v;7&3P3W(o^9Mm)QiVKlC7N+zUWVhLGX?3Fl>u6zZ!Z%9PRk+=mQ4@Un&h8fdliQZ5N4@el-$C`jn0Lo;nh1ru1B{T9LZV zFXF@CmAxA7H1hY2us(p~944rV>D`B)Y-yK&7TkA26^Gaf{4H|D*{C0ALvXu>FGDsr zRz^XF zvgMqfrwl&7WserwRgSYcXh4V($c=k?Jq7F3F?Vm#dtE;<3TrIZz- zdT?Y$E}Z-7lqBz#M_QIXLdK{piiO^XU4&bZdd@Huc_x*wfC~P^_8Y5HVtvQP^BGWi zJmCW81`z{qKH_|w@ladCLYU=~!p{om2QrSnkw^<5K`;z4H=Z0c8082hM_%)3`tF+g zgH6;`ee{ZIO*Ve33BCdKne6)Qvga?gTbD&a0tq+}kUHEy=H-75&NBa5aQ=INtnw#~ zDZ5xWoBl02SE*^sFAAW2hH3-fG!sQc5E9W5s-Sh!mg;nwpzot3kux_AFe#WVpV9R9 z%wx*3+(16ZdNXDtKv;pyRb7$oSe#6HpUf{fy*|8^&;yAvp5(Sff=Q1fVDe*O$U zjG?FY6n;}1T#g0JYmMi6Y*Siyq;87%DAQk&ZmdvAR&xg!oNksA<;)BVa+&hzra1BofCv;|*Eew8tb`<)~lZz5Qa3X2AK7YD2c~aB-n$l2);0t62TRfPEFV@00>%SQv5O zqDSF|LhGo{>>@AKFyEDITu2m)8l3T-adSq&g-oNw1iabul=RHJRhxT+2eFc^1OGNX zFby3&Pbd$>2x~HFHbjcZBgw2i<&083c|t6y4c($VUM8fyl=$04u}8HzjIExS8WwVK zx~<9WDY$w@&s~(MWv#SPMZPT6R`sVXW7Nv@!~GgHq8roF)I_0u2`hVEnAakqm3i7m zog~mbk-W*Rfvq+LH@dClQGnQp$t9e;igjCk0{KU|Evv!lhtpl*_aa)^^tplJNkiT& zx#kq-C9uGV2sl@K7ALWU>>tvE)Dpff&Z5L|vjyBaB*beR&&X51v)Yqu$7r)hko%jv z;7MW=tos;ozdW9CumSwFZ{Nt(969p=^aw}O-U25I)f0v-1JVfe+@1T^`x98h>Ugpu9yFjLR?{rMv9V20;nL8^^l zJb3b#%&|nE2Q>Pi^cD~T&Q}ZRli9Hbv^O35+%CYwA>Aczq0q9jT{$xxn$7+G3W(P^ zn}2@&A;xz9Fl2uR#Q*GgBLA7=IT{20_?oe^%O9HRua!Vnl9fEFAX?~7fY3xexTdXR z;y(C#UXUdQKxj};6Sf=bXqD6tGS5xz2=jpp{ zr(>C(ujgC%ULLl6fU(BYd;O4Arwa0Ny#0mpM74+NOaf7yngR;llMQ`s>$zuw^oA3t z)dIb$HKi2Oy(lgtL<4jIc6+nVePF!}`eXLSTkz(7fWc`cR0)}PX!84x^0^o2`O$fQ zMSmn9o_MfamV5cz`a(Kr=xT}^1xsUrwm2?y=yvC2#MX5y#k-H5v&7=47wHx5tjFRj z4^|>Nx4|mlxL}AWE-yx4l)Z@qF0|;2D=Cx@j^Zf@4)zQKW>I`p(`8MwK_=pqGPZQgFlOm(hbgBJYT4wni>ULoUfR&B`Z#W(TVXoR0WB{5 zBl1nhR_*4;Lc5M5o#OPJgF6+8GIO zXu^_ioIX`G)Old@aG=pGsVF6`gh5GS=##(FhH!-wAOo(Cs>$7iN4{IF^x_bO7$s{s z!$PMmTK3Gzx1vUX;g{Op3FoQc|I+BqFBdMX|DZcWXxcmAk7S7!p%*~^k@papi{=9R z%TNcH2~f`I+U1Ej=lP=Vb*g@a%^OY3g{K?Wd=la-$N+=`A3wJm{{eQ%E4!Y%(83He9A8+Yx8sk0FP4jgIo1XRLDHZ<_ml$l zLBQw?JqIWxu-IMzlG5|H)$`Z6E!8QmCtxs%$~2_mx01;=v>ZuGe~XH8*r^3%_Lv~X zfA1xX_I(&;j1rVlQaLO9Rq2EmoiD9HR>Y@Ovx|&eO8XPQ-zMkvz;%gC6pP{%)i@&Q zm2Z0a5PpA8{+B#eh!||w^~YV{qOUhCfyI-Q@oF0VG4p;gZi1<;TbRlxiV1koZfC?$)U zs3ey1DGs9i7!IPCpG*9>K95RweC(bs5lGsH#!P;9on*ab{myjy-F9-@qt^|!E9}l3 zMHN6t&i##@Nz7VnRgN3_6kRuZd>(X(I~+;B9j z-VtOg@}`sms!%zRd23DvOKJD`=}-xb+P-POTgkv!7~GID7GQp$fd^JSrx>IaP->)` zzhX|NB(`i^W!NMD*=Nk>J_#D@vCG&*jq!{v&2biGoY9O!El8QNa;6c42t||5vXxbA zMFPKqv^vkgVS~%GPdShs72B#gk$qvUGa2n{sO@bvF0&w166y&|YlT0lt;vkp2j5B= zg#*5<4wZWlq;aB5C845(neRM;Zf}WH`jZeRfDCU6fUF@1S_HVCgd+hb!=V~^|1v^5 z;LNCvTYExPN5Tlfkag9f|ad9NNk^lm}BXE`?53#QtLyg&Pg&aI3 z6)i&Tk)iixaDm|sdpTVvhObO;0Cid~I za|;1y6wIot47vAwvcgzTk5t)-jZpGakRbe} zYS#yM;QXaUdwIQxMGE%^umJ?w^O&GlQj~bPem{;QsO4|!{L7V8RC=VIo^egk=0(2PpuBdxH z^oFX?B>jpuE6~ayTG&8cJy0sVB7`yfHL~V)Qer3emj(@;z6e%sY)zvNcK}?=qXSEJ>jA~xIznc z@TH?j3{@2V3v`=y-u)=|VQv4}_vvmJ`>R_Axb$lW8P2l<4M%ALn|D#FABL+?1H?`?j0G2i8Ocy<9vI5AGoF?mu~VEE;!dv>bpLJI9rM z)5GoRZ#-db+;MPj*f#@v7W(;L_=0OSX#~UKPSF&df8ea%uoP%FHkh6Y#hwb+V2R{l z8CKLoe)Jn8GDcq#g#kODaSwK_QsNt(Tw{d}C0b+2?YZ9IzJ*{i64BL)y2BUj!@Gj` z_1oUCJ-WLY*7$A1x_u|w?q|QD-3~?Hk9}s#HVV$)ckvFZx2#03nU7TNB#z$aS?8?i zgK$Xk&E6N?BFP?M&J3|=043*KXwA^I+e`Qif%>)myXMLlV{6K4{k<}Dagv*Xb#9iF zCN@;-_e;r#-&;^NlFyOb+M!A+9ggG?<5t zkywC_i3fRCN2KQF%p}%fQm>hr9c<5oae{tHr-t*}J4~GdGdl3zl&_p$`SVJc{w}&_ z{p3VRglJNFtVdm`l8t@ehIlKCgSA~skII8Er;iV;ZkLGqQ4MdHbJHjM%6LVJbgA}& z(9EaKai3+ZVgxwDRMS+$$#qnbhig6l0ojgNZ|l}XQh7y{`__aWo_yU*s}$=ZdfnS4 zdL6fjRahIJkSnu^TiQiTH>B&+pQ_ePeeeoji+lLNp`KgNb!7Cao7#;0+6(as@o$8C zRkWMS1SAm98`A%M=pg!Mr`lQ2#Kyw*Z#cUt4cZ%R32)?Uph*~u1R>RbR0t_ytJVqy zVSqB&K9nQ@4Bp+jKHUV8jd|jVCJss!xd}slohsEv5m{SNP*NcO9?7N&{m-YW`JueZ zT)QT_xrd#Zn>*v89oFK-+ud%vGkxdl?Q*g?qsEZ;&jJE}v+K7s1 zPNirDx}WNlP!UF;sglZZY3w$(7`a+y%Ch8VTp`<=)qQwA+srOSi6Vmdp?~2-H0}f9 z2)2+E3x&8tl@zTbn%cG5m;W-#vWkMeibDLbcVwk>bOPPWgs>wle#o=ITh|K$^}t03 zCZ%UBmtnoW0z$|Ul=#B@nmx^&H`_0L9o?ov%XmirAzx;69>$D2E%}l|NYT$z!HbO6eaCEJ(y*J@b>V zp_O^H2{DyweqInv4;?W(ROD8jKRD}m4{#iZ*^op*A z7@sz&45~E3I24Qxo=^r&QLON?o`x1UBHhCiW$~Lq9o%qe5TJC3WYmtGc>@qb;wqHX zw}L_D9gqTPJ-KCdq?R{~(Xnn+u?25~i#0r98^~@U%Zf~P~~_;pXj#HSaB{mLE5piRT4wX`dR!Omv8 zico1Q7}n9m3+|q9mx#!k>viA8vB(YT%LNl`m^*?^3kfmip>@nmE)cphi9UPp_WNT zcpqB1si!2arT)dg67t3HaP-F~_0xrGW-I7kqropT(N9@lX_slWH&hb@-f;)(j7k{*K8`ze+!nBois9v<%u6c*i{ze4p8i0wkIkPS(H6&MM zyCDzQHbteg3M_fz95-Lylv<2-3e%QSvyH>vdelrULF62t*tf|3jN*}$`Hs9uVWs8% z3U)$%B6I^#pSBD_A*UmN zC5jfkc^sxk!~b%qC4HPRedt_zYVpL?j?$}r4G`Oj#7mpa0Vl<6n2W%w>i0qT0L&O- zUm%AyFWAR&>FWsPz;Dt(xLbtz#+l|k1Ak;vmnBkC{=pkNB0H*NR~iYfwjzoQZ{m7X<`pOIYI{+ zkywhLafnicSRfqijbDuSmK+eKbhMoUsyslqPeXiD#C28$BdK||5z3J&y7q4o%6WyT zhopxly7EonK#Uqn-G^A0bBCxckAl z0IDic?A&n51PE$NgQ|1NWe-54zbafMih=Af0H(Istk+UDXvsBVdp!x;ifjE_?@#DT z&EB8zm7G|*alq$NI94?ws=twI>VsA#GtP%-!_K%8tAlKj?1UBsTf%q3K_P+OY00ng z5DXl|HxmP@NAKoRKs|sJFhSgrncNu>#-wpaAJ}dkaXi$qO{janzO#jJIi41OxeO##7i^&YPpoNO386#_S$ca#`>Z=?lM1}+9BgR5-< ziZlV*$bhK4OyW%`9$v}QmA^Qdg0dz@ErmBw2eLMXsP(d`y~J20ifyIGAOFqSlKrtC zq<13_A%#Tn7!g((#?`qWUmbiLc1E?@g&mwx2df*T3xG|y(z*~@$?L6gQ=qG-JXuc? zUr=Z^6>g&xTuYC4q`ugO8qW~$V5YDGKB~&?giqRFQsA>yzG|dMbsscF(C4Cd?Rgf4 zEXlH$>_+p$J%MvR>cmU=4Rqo<=mpv88t8<{;bxrCxzN`(cudp48C$YvJrU}p9N54N zJI!0`jmhyF;)Hj19d_EQuMIKt$#mCy{&@3G$Aj!~^BUzR&(%V2s)#SY zH9yciq~I&kC_-)^!amLm1KW@|ZXr6GMVqWA5xj-AYhgxaVb(WE#DPcTI6j#90>X2! zGh;#@+`l8&pE>n1jc}+84BGqY=Xsi=ZK6tvZd>rAT+s9^o+0hH%jY!?_BAuYuruh{I8X6G{^peMYqCN3}PM(wi-_Z*{?R@0_%g4q^ChC zorE>T&@p)S*rz}QXy)e>qY3fLS^Ygmp}}yI_mJ20&%|)%N8-E-U~rGCUM^2pZ6})@ z>VEGJfA+))_B1gt!H)Y&k6YneJSnnH=AZPq^oV(2@JNl1235bc#$yi0;DF^hCSyX> zHGC?K?Fxu#7J^?mO%t$!%5Nba{5(mb#@VLZQ`^#jDO`$$r&GHb_1WX<##zjai0I5^ zqi4Wsb@_%G1q>QCZ#OEjYk0Gx+-PKM?o`sL>YKoWWNXl8JeVM0Y3Ui8u08;oE(~Lr zKDw75U>IO(v_Wgl-Peq2tv%7waeHa0VHX?#mqfd$uD9RA<+MPRMvN@wmj!X8LjdGg zMJ}h#0K9Hn2FO$KD?rL_=cMGR@%Bju3k!{b^~9!Z6I8to+kJkJb`zsjBT=`fcYiUX z#pJbf^5K!ud@I$Z*>bzLQNZ>=L9M5!jNOTZ!Pp4H4eZtycS0grNY(PSyZ4fr>A`*c zO}xIGqTip`!1-tT0oK;UKHbcd&`5-5SDKQ*UfmUGDM+$XGtsx0|`QSuF@!?fXz_ z%jZo9=*Jk@IXJKSSj_Biw$BXj^;~^>Jj(Y7?>=m}xxFLbkSy1D#gYEEC( z*RW*IIGlZuqE?p2Xd&MwijD8V2yC?pO3d}M_UEjBRX5oO7A3H$0Va!@nu@EU9#%aa zPtdfNo12(Ymc`bza3*HmWhc#yc2Sh|i+?Fb9l(&a87CeS&uixm({@KtZN6Zvpx#Q; z2HM<`b?-h&&l8-GsMJcE;2>apOC}m7$)1-Ym+)$2ih8FS`+C^BmGX&I9Lc41q=-mtUw2Slu~Fg zF9cYS)>@-!E~RZtnIwswA32rDa9vO56CfyGXh?_~^9Rj4_*UiG<<))n`}6Bpj^Eci zPA|zgBMbB-=Te}d+N8H4He|g?7gJ?~(o0s)6g>dr_axiu(;-_#Srzthb&S*$T>Q=gc)tV||DEwN>FYOWholoKE{yNgbs zr`a7IyyNAjs;PUFbKMy)*oXou#)gBJ83) zOMfdihoLEEN1P&Fph$P^TfHey(M=<;KojHCF{?~ANzZ-ZP~w@9qE)ZIh2HElfFpo~ z)3^6PabqNjE6g*EJ=K{yXhX<4J6%-3wK(>-NioI!Mkb5pB-LH7Gb2mdT4O93C5(B> zpsTLdRe4})RfO`9CCI^8pT(Wz5o?Y*0)|NdOORfKt@)&KtZJnMT%4HJ=Ocy$wCr1+ zPFj4p+3|oAL$ME9Zu)J}0oTEsDDGO^8?>;(2Cen^yTcf;v4W{H3?&l3TsudK=2EIm z6Neg@5u{*P=+b*7>S#4&%c9qqS(d~zW5vDy+jy5B)vPTya*;MI;t69xB*KJgB&E+7 zRt#w~IG6CSJ16d2rg7ibL(tluVu-P!Esr_lVa2?P#U=&~`YHF(t%*ku((1Fm@3|3; zO_ND1JDOb^M>o2LkN#QmLCe+(`Zvn1!!>+7H(vwU;4d&QWbvy(g;sRu1+Fsr)AGPT zlki0ts=O?fRdp8=QioC)R%DEF{h}XuC2CU>F4DS>V+>}xrVJ3R#pwis0c0*tx3ang z@9x)Y)7gD$wKh}lF@yBp7D5R#Y<>)(2z-fsV9xmyn6HFdJh2#GJu#E|r@n$A6+L++ zbO{C(Ddd#On7_hXDt z54WIk$J)%|1Z=f0r~PdFyc5T?fp3c=!(k71?7G@Lu(yKZ)22PiFZ0y_hFNZW4 zL0~(ij^VY2KV|N0g4viGIX$5>azxo|9#t)iy)!ZbrYh^pc<(-Z@-Ab#j!MHcp-xS( zRC0DL9p^%LcS3qo;aBx_(|CoC-WD@S-+rTI$2e}^OC>v=;b49&@i|BEUQ*AopfkR+sOxLJ;THfA3oE_nNSgKZ? zQ(d{uL-aWKwj%-{VbxO?Md>Zy zH83eB6+6%yCtY%KAB>hKmK_%rsl#>roTHs^bsnj$vNT&|z|)Km`L3CwCaCoi0wn}; z#ua~TnX-plS3ye5%;>S4X0$8VMFlPdu2~IJSRK23lbIT$H;c#XG@Nud@AwMVKNP_$ zUs9}Tkzy*ktHFDMt})a6^IIE-gYSOkTd#s_37i%j6pO3#G((192ca=Qq#+b*8MZMB zI|a99>cqrUY9?KVgU|BB#VHhBai*K;a1vVv(5i<|uOiVjQ0`njfozR&`XR3!X^6VM zh~Er@dj+MCom?`%!r6cTvcV!!M;DO_UJn=d2vWEOWWg?=bxGaTSmV5%O}~MGNZIA7 zPE~-1?Mg&h+f9$}M(s-{CpDSfyk(UxuYtR>N%1Epihf&`9)qF)E^RxEAt_ zXqCE_-v9{yZEmmV(8@gy)T#)rQ&jaq3A-NADmtDWzD>WdvKu^ zCF&LR`Wf^Xn9#_Y>qNcPV4Y5=urB0Ctm^Gb-+@#b%4O%YO z_d&FLTQ&0))-ks#E5jbjXuOX+;oCt&QuoeuyhfQ}j5cZ-A*bvTFKAGT+K?)O(Op#N zr&-d=8?h=LbGyr#;EB&j^avA;Hj0V1j59AUt5J&X1A#1r^|@iS#F5dVCjZHcJCvVlE$^uoGeWCXD{HD4|=5YA>eQS+$4PIpMlIF|N8R zkX!vwX1)ESSwX^&IF_&507G>chRxSMQVwf9qhX*tf*oBm{_!JJUNtZ;-?rB5yL8UU zXGq@{a?1SvMY!yGla!vLkW-P(L#|v!@9L02^!tz5a0u2B3f5BS!|fNMGE^L5)1ciR{7V-}(RxnmFZf18SV}pgsaq zUTX$v+Y+xXxvGqeY6w1I*e9A<5!Qq9w=TIu80UtTfe?#X5{`isxGKKGANTsPiHYS= zhkvUCWI~>$oYWD1fe@8h8I}p-KRNqCcqAIWG50DLR$7KAXC0gW{2~H;K6uQe*Y;@y&yNb=p$@gT{^NMO| zb?5)Yr;mKzg~ksLllCa#msB(8HWGda(-goJv#X< zE@|kuy0g#m^vE1Ma|7-+AIQ>ONHop)vf$|GFRAP7}L1w`bQD1cGY%2Jbg z%eyA?-Eo)G4DVC7*G}hCPD?7##fTS7IhZF6H{MFUmZQ=zd10RX$U`No>5%SOs{=Wu z?9?(Xd3Ad6k!7`Qx?Jauv(A*W%TzLqC798XLZhZBO#|kfvrN8 z`gsg@z;00L@yYzJu|4rn`DetfV2(nkVZ(r563!~QWQIj1NK2*ad4zhpouebeT>jRt`v zLO-onn!h?dg@CeFR*d8d5Q}|;@g?>ovy!kI-lDqdLjWeVNUzRx1$TWZ_8x@Ro)|5m zc^i9<&rD}BA>uFTz<(mD+~o_nhMZEpLB2p)jZ3lh)iE$9Y484V1>_2Qf9pf@+h+2K z?br+FZZjNxDVDTKW|^tzYCYjB8|sS|haeBCh!QRooH65nNDwc%?r+eolg9 zYTd2cpvqvKyueh=X-DP)oSBhLVGlnSwg9Bl0?7m+*G+C<5D22msQ8fZGlfH$P>r^#(?6<$q4nbBd}XA&b^TG9At_D!*8mZG0iCy8zGJ!h zJ`0lR4-;X5f&qZ^s0;QQKxj60I-{;lI|sl29^#3WZ${&9WqT=u9j<*VS4Snc^a4)p zVJ~$aFvh?JnCaT;ly_My86@-qjuFrP!t27q^Z0s;rfRGVzY`+cJ3`u*9VV6Jn~g^;INh z_2RN~;`C0Nw zuIfEL(FZ|aXU24pl1Co)K7Y2$OvM*DbJLn@+AuEz-Keet32V!Mp`V*Lr;!HETbb@b z4|8vX|Jgv*eY%Fws^)8ol*(AOJ7Fzc#PP7+%*LF{ZHqLM#}{6+Zv~@=bgE-cV8)t} z%+6Pu{tBjS*Y+dpK1{VUyashUCrQ3UDfOK4T(78!&EIYoy-VYj>xQ=G)K7cYo^x|N z(jAEYPC;# zs%()9entOH8J&M%Mzh?xgg(*5{Jo&y>o}E4Z=hy16Zga74DrcpphxjW`#lC$X96)- zfW$Em&NH16ybI=&(EbmeVd+08&{168*|n&tm4Ekt<^Ha@PKMf?OxeH;@{IaJtfODB zGlUbo;bO2wo{ZlkB2;zK%i>(MQ1FaH>*t&=-ohruL5T4NZwn`#BGuUFt&xJ?u>J0G zxP2heU7mSjN06HSNQ!Zx242XtU$c%NS=|HBxTjcBv9|mx^V-pZ?-Nya7*(-rT5TUP zwK@3_<5tjmV}8ppj|#r`H)LOpy5H_4_S=-5CnHdP?AMgj6}wH%rU-rP?#kfFJuaUH zplrA5Q}VsK-jDul=$LK=!+tGwrpOs1;k8G!EXe|aogmsCJFOr9V`P9AGT$BiE0rXW|OqC|pPt?&WLLUm6u#uFRy8H`+V7S>D|0Px4n5F$5sXm`Pgg>R0Z zvt-obXi1*2XSChh0XEY26w0Qm3|klwIEFU z_5u`WIqQicxyRSkvfuh0sQYYpMW~`OYfHT~U4mxgy9q>?96|Y=F)(t9G!?A)2Ve#H z5^F97*@kzCPsI!~$dU9qnP9Es2$QV|uMZHqMaI{U9>7eBPFpTvJ0=0Mc}{&Xo>O=r z*>hMarn*9Z^d_I6V4K9*kWJ;3*BOBSScmnzVLR5#8gNdouoeHABEG@W1ji?6hs_RV z%hne2BjdD!+0JD3I@vglpy24m4=E9qA-Tk}RoL_W=ZWcR8Zc^5E%>@AR=H&(nus*+ z_osza{q0TFq3|iz>oWg7R!^ZP^CILh893u$=_O=yze>qiPdZ#s4*nY8;nN#6g_P== zst)6QIx-D8_G04cjY?4-h^`T~+pMGj$$)09(*FAG2nhGj^>KPg#A|STfad~;TgL5E zn&_B&Xi0eh|Ac)8NOHgkOTH4kyHS2B#Btl&gStDQC13`e=^>MCqL(PSL7p2JvAZbTppuafOAlMcc!}-JkN>XTTYn! z60JIq)(!j|%!QD6H_RroI;yAdS z_DzyWWQDiyvqPYSbFwiO$G%e^F?VXNh^eqGm9bS7Uaj4L2gHkmlp_)dy~~3~f%7=l z_OKgLyu)uYB$bNi+q-;M+Buqt4bTvtr;0i}@r}pzlDge-qhyG`U?1v|nv!JC>XJ>^ zibi76VY9tLE}ZRIJWE+&`!l;mO+HGMi82IXS?*v@+8Gb8(3ml>Gb z{M6?kHXr-Xf1v!|=DTDp%uJ0vjIB+D4Xv$>42`Xv{;Rf8`zzn|i2#OrpkRPTp+~F+ z4a}rkr&gdLI=hNxt*F)1k~sGLTju0oIx2ma{zdGmaZdZI*@|WSAHJ&&(dWv^Pin)* zEHntE0GcF*>UnYSAoQD0U4Q4n$B z-Y@fJo^uku;*zl~6uq0>PnCP4L2r8}c3+0^Q{fsD)I>e;0%QQT*{8O8kH?V>#oGrr zE;!NioIGQUr)B;$(x=$5zJv>9P&Z!wG3?ZNy{#*%yFFr<-oft4f_(tJmn4p<3ZH#4 z3lX}~sEaA>W|A4ojS4RSF^)1QQAOTa(P@^b+O?ChVUSn4z?~62T7Jkj(Y$}7XM$YC zXgFf~!0i@l%7m_i>c5h2a%{<+u@%B!HFhL{)f{B3B#PC{>^5#BXp-8a5Q+w#h5*t4 zV#N7nf_B`FZL0EQ>9m>*KiyuUEc{}r7Rnc=Sv{nao}9^b6i1;1PWBa%%kEMw+WSOX zfr4u-)|+9?Vq&F00?`Gg2pjcNHxgmoi8>4tnjjDQDQOiYDYgooakeT4yXr|^*5XvE0ZGWcRBsE1eAmM~^*2*TpBIq2Qvi`;;mx#O7ansdH!f}}%zc&05rA8a2 zrr;K(UWXng&hg~NYt;%tdtiWqZqU8gngg9%@gAdcD}j%gygm>23pYg{(*V?+H|u1l zONv1yCRMebR;6ND@3fktqE{}B-VJ17r_6TSao<5$o1J~5SHGOppaw2XEqz6;PAtm> zcCR}$?goaU*{xqZl;DK(;UPVA8Y6#&w8ie>dv$|}5jjQS+;Nc*b=j{^5<{f6Y*$tA znc+yKNKZiDWzkoZP{ao%WkNVUFTo5cS-duvf78qtrhKX| zr}hq0B$$=%mV|{@yd-uX5MZ{%(l(18F-A+@+cSljxB}ma^RSx^C#JDy!cyugn1NTi zL+|6yBTujr4-wTjRCLU&`_HqI+!_mt$C6a{8>|X7JCy+jx!E&Jp_uG`m!3xcm=cA9`KK@`gowdI}w^%DP?r*^gnj>YJ{Z@Go zeE-tUtl&U(>`5()8$FAHPZ<#hK0qm&io&v}8rBoEMdK$dMS$Ly`V=|xpyXvZpEb7X z2+D-?{%=+rCiGJ2_@9NQlE3Xi{4?i)|F|bRI=Hzw+S&aFx#B|MQ)(w53db<6aem7X z@SVC5!sAeO05lRI5756_#E*JEo1vM!S?86F?eTKs zv#{iP_5Sqdf$uvHe?)$;@%)`^s5VQLsRO?Aupq~Iq~>qDOi%gk-=O_&`ig0N zzc+eD)+IN5EP42Uwe>yXhrO_f;oM^?9hTchi8E2JN;rG2Z;>5j;W&j>n_jB5PS<9A zcv@XJ81efm`x*G*;%WzJHJuFcijpU9S%x2VidGW`5n`|m;P~7%kHak{f?ZyvLm^Tu z-sYI|zNn=%PG>7S+d;vvS9$3vAnYyTINj8v1`pNV8#d8M6&PZ&^wh@Nh~`GkSewjb4=O}UdK%rG!s*M}RJEV9a1a1lolc~%SgA*Ep1HOR;p@?1{E9#e7 z)VV`LnAApb?7TNqCf;m!i9h5V7b|&7eU_tH_gx$^S!NYE#7PNbAvaMT;=LbZ*gpgO z*9d@|s8p+0G^jjb!%vli0APN2g|F+=cLShhY5ZtZ%b@T}=bZ1pO_GFERy_An-`>-0 z#-H7#39H1S8vg<+lC<-aBVX+ahl*VKkvwyAH za`7I7uJz6VA+DjAoliD4VpA{TXv8(VZ!VEv7hSf{GhD6Q+D`iVC*C9ZV7? z$1u$U_2ZmgBSIV%O{<@mB*p|hZiLF+2j9f;74)x~EgGT(!Q7|*4(o6AcmJ%Nr|9&T ziJGz9|I*IW&~`;vM}K!ja#QT ztTF(R5lSx^n`B94b`!#5oLI_oa3trOm9Dg%JQ&VppYUcRK=_y>G#8mt5CkA*0o#`%tKzLoOL%KtEs`P3(#jxv?VZ<6QqioDY>eE zey|P)X{c7*NLLDqx7kEjsI0zE{#|Ot?lS-n15uqk zV}LOXf03(#Cv+wG{Ex=p`jbZxK)~+k+fTDAlln~=XZ3obr8+!caJPEi6!vpdp|^QfPZpM|#oKBdFR@9rI(qe;E?&ePWs$UE0KHEbW3qfE$C@q}=|p74 zokR|&AF2w%y*@2yML7kw^DkfReqwt{Sw43B-Eai}1eyNsA63(JG>c1<+{0Rn;nF3` zTRm3Ht86#Q*G-gfk2pul7r)!K8bgO$EqGFK3V%v;DGyuVDk#Znx4ojaD%wLj1YJ;p z@0nW)_qGtytT*!}v-3X?L3(catTN_2|2>B9M^p;Ut664Lp1!gbdT^f|CjNvo2r&e{+$NX_} zM&BLm0XphP>HnNmJEIP^N87)TNo$akcdZ{vyMZ6o#a$smz~sBuUhFDw+4mx38oCDU zcv8S4VA?gWmi@L?uNteH)GOcBzGU?kqrU>w_HyHxPS?W#lcRI!NN>c76lIvsOLSAw zamksxntf~O265|%9ll?pqV+n>YKb^~^^~T|cyy3g{OmZnxvZ;`AcU9AaSNpm_TlyXf_kOY zo$4C)lln<-s0RMidBp0J@}9`A>E%gpkIBYrPZbHh7L@MKk+up4CrZBHOv*Dvg~DwA zX>Kj&1KASp*-@=A^`bHPQSAv8ITk)1I|xN~weB&ia0zS?g_9bHb^Z%Fub)G&t&QWCVD+V_+j{~0LOv?Rg% z`HY`}XTpT-1h-BMBkt^air!$wG5I7755#ey;jF^_oMV~LZ9MD;N&+Lh$nm zEv_Ir+|vh%Qb^}6L|Txz47`_{R3!Oy}5BrjB+3*O)I>mGgYJ?u7&^=`^& zPH-s1b;*93irW^sB2Mc|MxSx%6xvXDaF6i>WzkURDg>!2T_;rGg+Ee+D&gAZW0FkEks?2Pz>DMaGCk&6QWV12#eejVY((Dpv%5 zE8fqRbgwnhwx8+<-sdB|VZ2e;KW2;NNiE^7Cnxh+P6=3E-MRl2(`p>QWDPySG{PL{ z*Vv?SG&GXOL^f7Yg{r%z>XXF>7(IO&Q{@~!hn{dd7(u3-Jq>l*>J~TAXeTOY^A!@$BzFO|#{g1XCk&zS($>Z$ zIHYj=SjbdP6RZH^3?#0vCzilpGI@ZaU4e0Q zPNqFDeZYM01a=vjHQaWyB3Z%1;rbboV7Hnc()ZhuH|ym zIdb>1%IT2?O7r4q(}*Twy0jr{SdMdH)?un{)IU>WZ2T}&sASEqhrRhHveaUB3#9bM zVUJc(>oi|cLA}(jtzTjfSZJGoE&@{T>N&tz-?Ae1Y;;I{qe~U)ib4sMyVak}u;sk| z9*~#Y%#(iN1}m<%h|#zJ>ZGhqZ>tqJ*__F7NXv|B?UPZ7Pa1|Hb;l~NxzVnw5zm1T zw^Mf7j$j%HmQDbv6obw5y&aZWgM~o?#ndr9toA9_oQ7bDs%dAb3y@W}z_H!+W-?Br zb&pn_O*G5-?sX{|;YpPnSwyDic{jPEdW|#P9rD}NYH8G6vsBKANwdoMJLCC&B3k3F z9jSzG-q#o0mn+o#7YIc2Z@na4js%jht0V$lvHMK%tKdr~pywo3R6fwTl$E3>)?YZJ zKi>{2VXt39W}8XSmh@}8nB6C&GQ)~Kr@Lo$lo>7zhZ-9D@y!PC66S5hbjKr-!;@r) zb^PhXMLnUHAxykK;%dM+y#Gm4b0M}WJ1jUB)Gm)bx_q-3 zC#Ce!$yLpM!;nF=HaMHlHU0j6!4c{Ca4W0UYJF0nx3t?G#FXPWkZs<+~*#vf{$txiY6J!iID8owy22{R_XE(!hU&mMWM zN>+-Z=;hVF&fjj(AtOhh96;*7HJAElrX5QE(+l}uwa_N57f-cCoXs#f)>LC;7mB^` zV`5AIvIQ(SHH?@@A6YyUD)g;V>*$7@L)rv^#ibZwH^j@e@lsB1s9_2Lee#0;)4Q>yJr~a5& z(!z2=&KN}M*WQ6VQ-m=YZ_3{&!BfKOKp#Mjsg{QNy&1&aU58;7mnic!Z|Ltcfmts< zn3wW|^8gXf$@rU2jjDKiv5Fds{8*~Gn@#*b7{GkC^Qo=HUl0V6m3q*01>L?wLY%EO zR=MnQh0F$Nj8Pm~MD_aIVXiXbdWPwn0}8lCL+mlN?pC9e=SW>whWb^DvMl=0?M#!M zbOMR+f3@@$=avP5)GlhGr6xPU&wLIZ6 zol$RPQ4Ht@o%aXh$(&$;@Fu!uL3(-zWfq8iKE`i2K~}pY4vcVQF5i#9u~=D)xUw2b zNX%-(nW_Rn)V6UA3wx_H7U^$d@DJ4kZtxUlcJAW&E+d$`smFy!7@#~DsORZr4LCI~ zm?#^RQUzv8z;SCzn0>!YU&p_|Pc;|HPhGOtIQgeM_|(@83Gp*2(vKsPf!j0KSHUX4 zu`6P>h|1bZ3(QtohQ$bOhI&Vojbm?6Gc_3N8tlHCkge_GXDwrQ?o%UF{_GY{d@E;( zuveh63*o8`&OnlAFowOhuR>kQjde6c^3$#GfQatU>R{a{@hRweWe98@73o0kK(O5z zd!>CM#G=1~r+Wef5iy5V`;v5hHSuW*knJ9GAQT;W1U%LC4AETQex=Q48%qw_bv$W<*1f^mSx$`EmOZ}-J_Jmzu8j0<@Ou^z%qZC{jR-*BgW z-_|l{)V-E0LP|LlD5bG5fHl&*DdBtjEx!g=Qbo*ZyHuOcGIWMyo$_WuwV7kZe4@d{T!qMm+Bz9V z&a#I)lrLYDfxsMH=~m%yv7nq~1NX1Kj~HEuGECwZ>S!o~cc+?2^}i(4pcaIGZ}8a2 z$Ty_YkeX5Sxh<-MkjQ>_2TAM|#$&B$()CxGz z$j7X(SAIb3q_PR5I>l66uv0`oBks0yJg)IV-`)uyC~ct;cNQeg1Y$* z$!cYG-gM9&n~;fp$LON3_BDXs`_*NE$kffG=5_RG1=`}}tudB~ zoe~L)u7d?h1Q^!2(c)ZOfZW3uuC_pgO0jjPk&?2_`NrP)g=1@-BkS@TcK?PDpyQh% zd-3Q5c?moR0c9b5+d=7Q0gyi(G4b(j!Ocu2qgz#EJ~MIQUVr$#+4Q6Px!;+CfT{s% zBF)PaysGiP7sG7Cz>NC`Y}S_!^r)8hG4hCC zH4E)V;j~w(>=)Q#zE(Yvy^B#awBo$m*+yTJ)aF#V_`DCszTNzbcVdxEB_H!??)QT6 zcMaixcCb`2cCh__kUwbXs;X+DzjKmP_LLnfE2*)2k%3RtMe0B(gB4gI(_x(zFNxMm zBjQg*j7DJi)?xYjpV|_=ENJqn&X%zW-uH&RhfUq5HopCq28SG-$j_cQZ}`3DTXm&t zThrz7{`B%ma@`twL|K3-+Ax`7hO?k#iovngMS`!`nQ9NElFd;blNzSiaTsML7=DnO zcF6`fPr4nMc}QUvB_=CakOajG)raP;)|+~FInY?*nC@d$!n6~x%c>A3CI0{j?P;`! z9(LYORGy>{dFxKe4xgc|#HV@)V?rn_u#Lfv z99x)^o!+E`LbAiMmoP{g&`c|i?}hN#Czj@TumJ@I`Afakac*xhSCJO?>SFH`)LO~A zMn%ANA!6T3dT{F?s%V4kK_&M=01dbF&+R~5;u#=GkQF)~#MGQ{{T}fNpVTuVfVTWV zMQt>i?^BsbDDUDf7pd40y17C&la#n+^*|4yFg)LImAf-k+F_cI9Mz?aTj|`Sl6;l z$2xo#A$#(L#I?lD8QLd=qWyU|_fxVfUAz@Vm6K%`TU0|;Pj z2B2M!(vojgA|BUuXU>|A-kw5s(ogdxZ=?j+;UI7Zed(U({WaVur7W9Z})c)kahBwC^A{gCYI3qdJiwruKTq; z+_dmny2}xz#5c#(i9-Xjt8)>rg^EAh93&LUJeyMUf)5}@!I`D@v$u3!}>{KrUuWHf#NXs@-gXk&=%MTb+dYFFw&d%`>B& z$Xx$bQ>?b%(kl8*zi!9DscQ{~K-CQrM2DJXg zNB^8MoKxCE)yy;doO1N?sC^a2@9gF6((tdkVlB-&OvGpJdFpd2!+*~Q`e(O)RdW{) zYg6;jBe0pZhqZ&{zjF|^y!}3FFYk=$%uI=4J&A*5CWXWy;H;=>NkY`%!dB3;LdZ_L z=C`PX3P&+)jw(S-w0i~+YV@r_i#p;ugA8K!b?z0iO&&F}x);?REpHD$o432JCdbLs zlfJwiK4y9@yH0sdc}}-+)x5o=2Y<2H$u)*Y)7mLoH?1wyI8pe z4*rIXtYTwJ>A8N;AT=+BuvjGWsc7Lu)17PeJGpgLD+wh%TG3OcQ&JOb(k52>)u@Al zp06f}ozXMm!)MK5#-~$x58FT?TrAOr#)URHK>qS>G@|cl366Kr#B!OW`?`cj8 zFS>J228!8h6`cS*1Uo@b6y$pQro-0M1`fLKj&90*BeQO;U$SXqo^c+l);D)e6R0Co zbz7uCQ>HFsldNZeAygH~M?gbmO|ed%4iP68PzI$t#rE(lNk1+ zN5-zAJSv&D(6k5u=D;JTvA53Aw+tQ70xU_Y5Jps&)i8%h1I5E~tyv9#5sOtVd#O*> zR6(w_?9mhxZe73y3Mol~T=6cUv;Z4szT*OxLkN78NJ#e3x~%R?+m={YXF^4j4e54Z zHu>gI3YO6|t~ad4u@;OA&t7&A#tHpm4Bbu^N8}Bl`*p=ZR|2>XQo)_7^iHt2o%*)o z;jrX39~&AK8)VOebLJHuOw8bdFH!abVt1ra3@0G^Sa;h7=&{_)ic4Q}N|-SCIZdWZ zkLE=m*A8;E!rfd!SDRLg%G50)7MyoPj7h@MFoOfl?c)hlS*PC2rU5dHqiNFlU`y7$ zsCTe%l)}(=IfyY%{o+t`T0~M4tNx(1AOL5Q*0!NatRi%pg}_5^0t7+du3Xvr)*SWn z7sS-_c7)dq%1Iy-vr`vrVo1fV3}D{Y9{5dXqA`>qQ2+esyuEqas3d*FW&8njj~#() zPU+i06u-t+JtCWQr$Rej%M+$Io%Hw;XCS~xr@u<24&2YTCe|QqBY%RG<9wo_XJT@z zY@_(-3UOxC8)@F5$vZKW>6iUh(z;*n&-6RP(e+Mg``=?Kk@PrZI2+_~qWrn#NHAHh z1DdfQbA-PiCgXeGGh%D@6No>&C|Zr$ZBoV`WgYlEMo6=VL#X`h7jX$^X5_C^X%6QX zNGiJZM3I`HSTc4g+R$T^y07Pi2-vLGq{-=Bj_^R;!!DwMAVD%t$lI{{Jisyjjt|om2t0PKcb(>kMGOoXOFz^-;w?dv8d9}t=SA5)|Q^Wmb<|qkdAH4}N9`n40)P2P~YS!oRMZI7&@Jp4H);;3a5<3xg&( zpv&4&Fs4oJZDhEA(?p+PpzdP%`5ZIfg2zCE6JSBx?8;alI%6oBWT9LP-8>`@m2^1I zv6_xG63Sg9TPsm8r_>KC-+H|hl$fP@zxc1B1e6p;&Pk%#!k4(T?BKQ6cAtu#^5vi^ z=2gNhc<#kNWMdxt0xF8Heo_0EAkA=9m9`tVvsB<&P9lnn3Z(IMtdvG!;#qo{-pp%p z!V6fPHl3J_L6Fh8_F2gl$tPOv(%8vMKmeKP566ad6fKQR-Hl9(9rtgN>LX3XH}D4k zXvsHX40J-;;y4Aufr8gOL#NPyV-cc&?wcT{L6FF6$k19JuxD^($Cq2_MO$Rc1Y01h zaGbKRAuZK^(a`^5tMH|Q_q#euPX=~R$@q5jXx~naAcV)9cKea z*4omZMsweSW*FbfT&X=MLut_K$Ec<&2ti67_$ej=Z5|RKZ(gCyYxt!)3PM5K^vZZM zRppFYF#aP1%LbKYu9`9&Y4fyKRcEb zg+I3{>vuMk!SsrG^D2^Y4uuFo8f1UrmIKq{fXYT zk?>?lcLP~6$8RDLPma{p?WF$IN`ZOQN^$ggS$tl!{tlC<`~D79 zeLt^5_B1dZ_pJx32wojjH+-fn4PfkV(y;P52=8R9qlWplr*mLf5Be9#ZAA)Awi>|F z9=W@vZ{7EQICM^g-smel>`W?E``1D_;(VQWc)D4g|9WL8zwMZRRrC2M-mWR6SiT$B z>Y4X6HL$mVpV}BP=LigJnQ5#F zX^3%Zo?p;~`Ni4SmR+=(097XN-Ocz**=iWOoS?72)YZ$NjlS|laA{SRQk54!AGt1I zoBt?3m4y~JV=2bdgJk07ZPtWGC5x-RSW2#x-|OmI&Ns}f8qNUsFF$t=uA<|f=3~D8 z-cdC9_Pto7xILSEiBZRkD(Xa^e!#P#;KD*>v)`;e(YO@}Yxlhqw|Q!qOc#(R(o}t* z4DiC-t9imph$f%=S%Hgbo_}Q`yHu-~bouQS>#t-LhQ-8_>(hFQ2>b7n)qgexM9tjZ z$pasfZOB1_q|BEsQR`myvz03<5^d~FNQr>*E|a~?R?oV>4A3Nib~qsPq(%`D=w?X z3_srAsZbW@70uNKO8Xl_F*ph-RrI7?^zl?1qj^kd5nBib6`Vwy*ylCW`k4t9XXW}e zp1pZZb;`Gf*fy~DBt-T-aDHG9!mi+s;%3Ynt@UTj;cZtu^t)BqxJne$R9m(VT3Ien zmiU<37dO;AzHj+o%CgCw&oP@I74DUvf=J|RxQ2(7rC~~zMw3g7x3dR7n#~7qoN7Y3 zb0>F9gp?x*rFuQ`i7Lo6;9SrRu#7u>sT??(>XpM8jlRrCY-O&>Qx_5EDZEf;gI02| z%dCLHL@DGzq0Lv3FzzKbHNV0)H*?@)acZ0I0E#&LMVY|W1pHw@%c@bEF@%MhZqvqv@ zljev{Q4C=k8)jdxD>SB8u@5<=9JH+kt?C9INSNjB676@t;nrq713fkIfL*ia} z(5ctg6^)rL@i9=T@WohTCKw)zuFvYo7nx;J>xjB>VZtw2+&dizQ|BV5My<*(D<0eA zE`x3u&hDq=s?xV2EI|iWXOfVG9v6v(#Ja|&%j6$lh2XqC{>gl0sTat0R%q5r@lh!V z!+BtY_Nktg#IDLF4UCF&FMoW1_ApX_Di6Lss1itNaus&scZHFl1Ah17Ay$Ctm!B93 zv32&4N-|mKGP)EQT``{>8JdG&@F;NUT zQP;qo)ZLb%BTd+ka0wLgYkGISaVwY{6vr==jIIa_NR(WvBX7+`M@Tx((3l$UA{A6I zAvbhDNh6E789>j>TF=b35xU(?My_>}9*aVYn|*>~B3JDE#ionXg^|Po>&%&Cwo_M!nEuWL`Aco{KRIQisfquYX(To2zl)Y@XE~gA>}eon;_+U zWf+gD`M};gqEc(vg#{=ZS}+b{&0wwFFjy;Yb}EFhL&-av(!gN`qp}~NyiNmo!XWaW ziMp_8e13H+t22#0!^xb+lp^#Ebt+3ODfR z?#D5FF2#?j{5l3SevwtUOXl%QpeX_Y3H(#yV zi)*2aUm-Ep8ds(MY@$;$6obzf&CEqYw@W)_GMqTbalSeYQTZoZ`nwES8fN8>9K$=t zvI(AiJ$TxbuSY0eJT_t*?ehJdbCq?)_iJl?`~CHV;(H>sWUai>LKQt#RlPd(*a3ik zH7?O(Ro^)=r_yKCMwnM)(4#_n+*xn>)^53s5-YNqYFNLb9y^fI$RV&+#ntYrQCGh? zv2B&cH}*T4hB|CW7nONiJSHp3meL^1+H4 zrL0&Gtl!tk6RoSArUmj^^y)Ko#Jcg{DaY5eG0uzltm!wVo(C}*QGsvGp@?ut3OLe> zIhclb@siRG2nO0Zl8dS56V9Nhmxh7IIs~>~R^rDVAB&|ePOQXEENR@;vsxa?s;F-> zXcc=8X-p#&9%0yPJkM!}+gC7XuPdqhw5;w@fls}byoc{{L#mMtKqx%4%$imSQ^*i_0GTfhr!z=kK6P!@Mr@n zDoto3RYB__3h4Q{3k-(R=5PosofY!d%Qegg$J-5>HE3b7R>)PNC{hg*AmSPeT6^AZ zsSRUEeng=}&oxc@x#{&C^7e=R_>uGHrB!~)^8@094&L zS{9Eh%DQ>$LFdS@et`b18eUQSk~7%Ve0I9wO)I0}-Aef|7sHe-kQ(Ui(l(VWGZPbQ=z<)yh1giC?yJmwBkn zXNE8sTE0_P-WTIh^bDSGU&r zB6K+yIwHL65A|~3zxR569ozO7M0Yd{8hTn49uWxP6Iy5Ko;@@2!n<-p_u_(1Dv0x0 zCiuV^zGBw-z=d26G{q0h24~j!-VT;0h9(s<$|a)9^9~>Udg+76W(tqg-E$(m&yNt6 zYihQJJs)b&-Seb0T~T114O{&UxHLe$2$uGqGW|M4BMBMC5=Pc48ArkDGAer0ZZO@| zD?3aoI7DUUf!t6VZwa3GuBt>oeW$u3S2%bu#%!CKpL;+rms>1^R+S$yKU4Jhu_Q)Q z->IB{b}+9f4mm=pAP$-SfXqYw`pWh??TFZ~c7V?IHAda1if#`)@&HWS0WvZgA~FjB z9S0Vj2a~!UmHHMzQ!?UFQZ(VMDw2OiE&(W~ZAzb{G$bYpL}8d+ph>biMOR>VkEG5% zeWuPAkM#ORW*UtODSp};S4;4#&HWyI- z6S3~UPDbYaN2F!fe>E5WcIfbbbx-(bx}X2?Pa?)H|K8E~SELY+VR7gaLKgqP4vJ7E zH;*;Sh%TKc5yPNK*eJ%UfwW|>U0%~iwk+KFf)BeZA1Qak;q&}_<-=$ArSe9tfY{Fe zSWANC>zFUWdBnxB@3ge(p4EbMtzbR(uSD`Q{e#k7tC(8}k-Nu~G&BPr9$2J3-gi4+ zjtFL33OVhXZkTa}dChB6^3J7-xb0h#)j+m|_{t$qk;Nxb=JtkQ)SM3l$F`rua<(Iy za(z(r@q-j8Xe9g=v8RZCMbrwobII0E+;=~(|Gw?>&rZ_+120i4b5q;@gqVC>mqNb~ za)>2DtUU3n`Zc6T<=Gu@v{H?$$$Pdj1Gmk|~_WhL#8J`BE_olRW4>itTo{4Gk z(HM0b*fwysujh5?G+-n%k)fC4zD?;A-c5oTH%~Bg7#PZNNyPw^)=<(_?*{4e9mH}? zkI{B5y19uV-3j7kBTmW9C)@}^t;`R3N%Y>X+_)$yLng+N&>WOa0G7$>fwI)pdEjlb65$#^AJcF8yEs`1EwwDYlnmAc(@I%51PcFCi6{$FkuWiVd&3ZtU zK0v7+B}VdxbiXe!MPK}?L*i4lOK11KebXzf_spPe1%H|TSk8PI#D%&aC$VeHyG{%L z_05yHzOjnB^YzD+<51;T3-wI!)VA8{d&sVRKlL=|KHXo~StXb|_k1E_^|#plzuU#1 zQ|JHFniN+YmjM$-u8e5U9FW|Ddkr}-*bH`BMyq~^W=K4;xad=EKF_2t@r|-vX-^Q71hFcZ_`XbbARFRFMxTXWci(Qw) z-;qs|c0_vimbR~Etap+P)L91@aA9Bx@0!t}zL-5%&&1tjCJxc@%KWr&{iS( z-?fdET)2T(am|f);zbtrg_hU?P{4Tc`dSiwZR&%B>VcF9rpFhHIR_hsF?!(gTzk+j zV4}pwSALHY)*r{Bn%;gV@Hp+uF864N%yM1s{|NM}B zfBr<=_HPka`hT@rm5g0Jrw{$l<;wD}yJvB{JZv8`@(-$q5*^_UFQ`rKd(c`-poANU4)A*cP}ev z5`v!^@1#X~HE!X-g1rYlff@eNVX_pQI1?Fp8YZuQ+JwKg@#4uT`oL*4S7QbbezV(j zmw>E_aRAyQv78dtrwBy<{0p8L5}A(tPk6>Yum3)%sQ-VknEuO>`WHs_F)V*!BxYGi zX+yE%4Ql`D1=A}dT>HWJ)me0f$V2nS4wJA)Gy;YbQ{g7Cb zxi1QBv9qU3)sl?#r`CPY)d@GEYk6R_EDoJwBMXDq2|2fW;}3bh8689@WJ89d9KuWF z?_WB0tZ6O6RRd3SIPfVIiM{uw%SPsBxGY+)+4_%BZNepaaVG{6BQK!^rlB`be}M$S zjR95g3Bl@r0_nfzM9lx&AelOT)~y{rH`xDCCM5k2eqY$q(#72J)3NfuD#fZ2si zkV6d}=j<{X-C$_I$HH2bX%|o1pvw@5NyLe7X2G~D+3X1H&#jirblx$j$Pr(^1fZLE zw5)Pk!SEQ3?x)`zr{A3A{_Otv;`CiokUy|np0o@|%TMtq-Nc{qVIj84Er~Zh)J(0w zo>r7ET}O0iw2)ecTIJJ)IB6nW&TF@j5jlD>9Z<)b;KzrrdJK*`-8g&MCUh}+86ni= zD7helaE7NPDr#h#htQQSADZN+)Sm{<3x-$z6yj@fV_tu$;7)t(a!n*5fUcFBp3hlm znhbs3nTbb!?0iO-GO^X2mV?=c}bhMFFWDa z$wU#@C6Rz}&7P@&qK#%)%ReZ7M?3H1XeljK;|4US5&7|UUIYGH6Q|;9>K$@iuVIAU zpYt26`Uf6>AFSYVPJrkg9Uq~N9iDf61m}88!T0G&IsA+A;M?o%MJg&h{mv}s`Xka$i|37G4=cdY?C6#kWxHM;U^ z?RjvH&qWxCm9L_(d?q_HdA7{?|Dx?3!|PzTt>HGdZQHhOHcn%kjT<+%8r!yQ+qN1u zXqx0*>GSNp&)MhfUgzp}eLvRvv;M7l&pF2&W8Cvr_To*6gM}K#?fE9V4Mcx5Q_f*Jjm2^34|$e;^!;^)xl_meftZZTnmCtp=vY(?)vcr_L)|E* z^i!Rl4w24)!1*QU>7>xY6pGAoxjF^x@{YX6Fd#JPq(_xq(6khkJ+>5`H` z0Ek03;Pap3@P7wD|B8d~KgxuPo1O6oV+TjTDuch`Qm!B?4*-r{fq|+5g0}`dZp!dl z9ELJ5L45&cIRPFT;uIPy;|&PU8W}P?55PYa2bM*9MQt07Q!A5F79SrxJ;0~>1;500 zC5#s+WuTvG$&`kcnMy}5IEnUt4#*uvh{wzrW|=CvU6%=(WO6HDXW_;+n>QWO)v#J4SAW# zWh;vS$-u5ySO=wAFG6;MVQ)(j|>o*i{D1)|K8vJ6&(>{6MbhZCrN8ND`RUwE!ThB zH1Y3cHbGHV9vcuSIU%H(cfLZ>{g5HR1itgk5U8Y~0VoMVRB-K_6CgO}E35VFewlz@ zg?--fml(JJ`{7af(eO?tZI1Eq|7?E+-lFc916+x8KF(JOnNcGVM@g|XM`CwjiiV%D ztf69^kUrn()2I=2G0Ur=Nb8dnVFXuUm~f#WwPf8_s~=Y6|E$PN{T70=s@$rhO!(;6t)-I5GpG+60q^r zYkfdypo#7SGxs!j3O|&ubb+XO3ss%E(;Z$Z)gje_(0M)XKimGqlV3Y(rJ0{&b;~Sg zKe@k&LR-ody}Y|Y0AB)uj)v|rg;O2C@}TWFrO?;S^@Z=8qPeDl-bFez-UfDTbv0YB zQS5;-tcO^*imB$L?V?%;{aFaakACa6&UFd#mZQFnG`aqO6YvhOMeRT5sK6gI*#8mm zSS?#5L6pyvGzxn;dZ+oJs#>=BX5vpqR;)2tGRP&8(|iwXG{W2+Agz z#Fs>aK$X{V@;zaXDd*x-<|tay3k9qsP(K_t(~9x+7jG+h$8}It>U{3bRNq*zR=IVkR*pkg1U4dI|@_`?+P;kFQe3`8o&3IN+a}S zJFI51J{_??DcPm+*kqUHsJDoqO=Wj+F*rYNKCtd-DlqtXTzy}cHkTp+N1PK;%cfiQ zv6a8L3$7NH6~a>&*?lOmR^R#rmb3~JywQW}%v!yFv$ByOgbNg!V)n?~Yq(5o0C99h zeWLGDl5lUj-3nPW?s97co#My}@kZnVeuQ*Pc@D(cVi#QdDKZG0oy^tjL^l5M3UCcm z>tJD3{cKrIs))77z~SK;T7wIm5Y539s)h-^<}6^XU7eg-Zm2!Xx#l2XtuZ>yH<>>s zMYe=PvQ#-wiDt%;+uj&jDG zMrmE}I?HM=NQaE(_1ElDN)XW?3H0vW>u)#X@czNE{cn%>q(@Im0VtkKP#Le4pV- zf^@f`zR6EEO^RcTpU~EItwv^ec(NF6*6>DA-MwI;q2FLt5CR(=CZ~F%8r0RiF#<};_HP@D_@BoHP+1&| z4FS;oZ;>niZ!DG?6-LGwqG(liHb)dzPZS^_00BisX=P-~EXk(r64lzC#Xl-lbqW5E z+t(asK==Xe#$;ox>f-z_G}dhcOX}MpZKBjKH7O}a$rLryXS1DGI5(;iry62kJZFQ+ zExjMP)3M5ALo8Xe1xDn>Ge%UPboNPY0LRO8Aq4hlx>mCc<>q0?C-$K32X>E7G=_WC2l z*{0D#Dyhy&f+TF~k=AM3^?-)U%+qMdkL6f@TWp$@&{_tjANnnc)HmNj;W)0TDn-2! z2C$el?6TZ{`bC)1Nfj}Ji82fLS2yc!wW*G2fi_HUuWc=}iQnUKXTBAE4yJ@c6QM{{{1Smp zN8VcG(ezN9s5~a3Ikue{InxD--B02YroF+?`vWe~;z8M5h|qv#ZDK!5_!Vau_af`3 zzr_>k*xq6=S#vA!&0IC^jGt(+eZg&Wc*${{vn4MDU$M52w7u0&Rzfc6Xy!8R&xCkcp}9-#L9 z=XNdo=ehM)- z>YRzo+Je6n4_PiJg4lo|p-&-+O9JFq+xw+{O+-vzL-ch?Rz-J#>qM~w-LE0oT*s7m zObbS;M%py>*z#$lr^eFe7dgSo*T9SXIg%opZYSt5$VKq;GQ%-7uGeksBl~H>tmzR@Fj0EcLXz7v+#O95{*DT zjH`ZNx0DvuPY$dmj5Mf|P{I0g-tEk3^%x)2u|V|L6`ql%2)EOMZ(+pyQuEeOSbFTE zdzsdJs%Wt-Vu>v#+6ig*w1m;Bp=BRTUpZEkIptEC9+&d-mZnBJ^Jx33^G_v;bH#mw zSx9NktzDMdk2DyUMrY2pjm*Inz*`vH_u-C3hvI0W8)e)>I&yrGiuY6Sje%XWB*1iN zhoPQ#@-UD4)%dqIT*KPrnQZ+@KMB;}katn>kjNS;RL9v_#sL$rRLEvsd{o*83n9%D zhol_QY;W@t;E#C}XmFc%0r&--Oh;2}k zlrO+4jj{G1TAO`ra;K``V?G4Ax8k$m20iR@q;8D!@O*#y%b1GdCvlArIFKU%vGYF{ z8IeCJG7h%Z|2`K)#7e*MZG(fUEQIhY(LnimJU!BNsDO8ygiE0`QHqs7l$5C|HX>#@ zq|U1D#HMWDCPnbqUWG7&Swg%|tMB77ssk zQYCy|K(V(zn`+lTs){z`Bbp94>{Y@Z$MBJk0yb zLP)@o+>((pPDTVQ?sDTmd|ybL&n4L;o@I|DNi6nLT`mCaCA#xbOK_`Sbx`{t<5E5b zqFGF{BNz!HIts*rw_Q5x^M@fw7uuGG$)G?l!a&Zh{hM*-GEOBO-5{K@5Bi`MARktQ zu3e{x4!0?LBO&Hisq}i8<54OL`ELs7tNIr)$?fNpt520kya-!^X-KNlMX$hH@u|Zq zY?!6j^_BJ~S_M!$n7qJSlEum=DppN)uUWVv!PT81TWMTXP{7(qcZ$m)QQ;eFF- z)^VRxrtnza+k$60z&#_OOrhDU3i`ly#s)F9gi51W0Zn~4Wc#>S1w#sRX*0dig(50H zMQ`op|3eLir-?KFU94?(IT`jATbaf;T$;NzjngB;sfO|Gd-^d#d+e)NQ=lJqnIS$3b%MZS)C)_V`KpR1bgdw<`$uYxPar>@!RA0e}A&`Uo}$F z+S=IYU#}MZgVRfm;=a*G%1uv5*EFh*2N47kBA_VBt6J3_FzQ(caC#uGi3xh!Z(Yu@ zaQYXg$Id*Kx_%$E$o|fh142=W!}VA@H6a8o51;aYe4M(`X+`f= z;Z!kpDm(HAN(b?qRnP!tZCFkY%TtDUGMsy?ei6PIWr^n zwCW~Z&C|B4voenR7YDXZW%s6f)LJat`=ot;)JPJCM8||q9R`$qXjm2bk5xA`c>yhY z3MjxVAgLdLV_n0%OS{;(VzFmdGZ z2!ia=WWy--o{7Fve)64M^{R-d{!vXcTQMLc7Ze8`Xy zqs6q^CXB!1!udEJ@_6!tj;`jpQyY>$9p3I;3RY;o(P$k=YLC;f?~f~DHawDI0tBo0 zel#}F)eBgp#*v$IB<>?A7?RbPCE$%;xDd)q0GJpM6R_Xnh(FOu{!3ic%$>~S^sWCP z(JM>>a6Q7yhs>`g=6C*C%8e&m3(F8fP#}y&RX0D!Z2@+tv-!Xe@3=SibghDH6oc;2{eqoM>z&BE_5--CqK-G9xf8mA{WM% zFDKkJ9^|MDUmTfDzuV0SEe;UK;!|`aB{mkjwqVGff<}?ApMH@c@UdG$hgflu0HDE& zoXEzxD$m`BxwF<(HL; zK(9;V7{2aI`VsXV2@^&I4)=i(WNuCsj4(`%0V+dh#V!}x(MnTw;dJYWcGwAa9JXrE zzi@mtTJszyAYP2Wjn|*lw12M1{wseXVs)f}1W|$}k4lUSOqRiQoEO14oiN1^gb-*z zQFWczBgJtsO%vA@PfVRrou=WB#6?YwHK>u=m)uMf9Wz`vYM&;~Y zt~72{51=Va(nAe}q3U4z#Es|7;E7^1n025<>6FUUces~-2p0M?_2wtKcwy@v5xJ0* zM~h5o!&C{i_S&K71ekPCVe>dv7`zLPRNDvp00;L3v7hfTSQ4>KV)G!u1(fqPKTpT` z^O*a(R98fsNSf!=RZNG($(=@SX5C7q!oa~AP7GRkIQ&x`uvfYi&Oe>5zGr`ijD)u0Y z^}Rd!;cZI8>`b?TPNbcCm`dSwylWlfG@bp}>GP8$C-{~{4lS4UJlAj>TDj5IBH$A*3};Kq1dI7!yOc37SAs1wF*1chL7m* zBEwhv*d?^ z%iZV*_-@61+J29M9@^Z)T#%d6W;@yUb10eLBCrWmiwXVHU=hCSJv9(Ca!QI{%9j>$ z>T)K@Z9jGmw2hVp)Na&V5Wlnv?0bS?UvzS}{S*Y*P+}T0Rko{9vMf%$@BvLClQSSW zird}vE^!B~#q`*vXn>`&*plwSP7J#JmTR>H4P|DYEN(TUbX<69n)a4P2<zSqGpwHcHv5qh*6LJoUzId^RYV;!V;n&ldat^eIRbn#a#>QeW*|*(M%uF+a&3&Q z(<3!eScQRXFG{ye{7*NjDOQoEyHw9u0SotZ0jNJ>%6IsCD4avT`2_~g69V^Fiv}h;Dfgzni}VtvdRU>!yQfp z7r{iP?o)NbF|~SDgsJHbGnw4cQNl5fEIt(n4ipaWb-7rOGr6LvvxmSRd^jtGCWT{! zc~vN|Lp|q&)pP?0Xy?X1qOac62W%oICH}Ru2PZLnu?0{Eslk6YZV3IsxFPE%3=j(S z9rOXuvj3ea0M+SD9@ODOLli~$UP9jO535Vq7tq&dH18keQH&~;NV`lc_8NySPlosN z{R_ozomEbEZtz4~%Hm>&Ie+H{|2rpp1R}koRHvSPp`qd(c&Y_?ZThh>yHci6=3=B6 zi#U7p1L(M-zU$IMLj4#h%NYdGp!AeaC_HGx0h{5bQY#3?L5UZ1<&lq*-a!r@$yeYo zpw1`0WOK0GmxKbbSwbl47m0HzE{;B`=eruYaD1H7n#Y#1MJ4-!z2C zuRQA8b*bYMzpyQI97ag4aQq(ZIEE?weSt=~n6B<-`N3$_8gf!ll^TEAvwqhg_qZIl=t-~C{0!DUTB*{A*O(D4K~*6LHhBWXet zBN>%fT~9H+m^-i2Vs)4{hzw}8<#u%x2|p_qVT4xBM6cPuAAV-LAthX z+t5EWmVrR~eCC%*Yo++W_N~U&WCP~L>9Z{A2GV9+w|4L|?_VvZbXNoA4et#C zKL2?{{}cQmXZt@C5CHxj=&V~UFR#}*%?u;AJ<0CQRRN(y2~YwkAoQ^j=BYKQG_A`y zQTvjYZ;s5Jvxbx5Fi1}T$cx^Lj+$(AeOI_tncHJ$GK+~G67ASuNHrs`P41%Ktemo& zq9T^JVxqmmQ7wi!IOsx=S9|P;izi$K&_IX*8VHy6n+D*Lg{+7y%o5-cYgMNAr<)f&VY6JOf`@;ouk;Sx07$5s} zPshOA)%x#gQ&Tn^hKe0E3vRp18j2S$`8M7yw|dmH4$d1B^u+vw(LNMJq+}Q9Ws(J9 zI7J!ldWRZ*NLYS?iZD|sR$i=MHfbN)fmR{<*#lRTR^7U~$=~MIZeK9zH!I5QZ}a6( z6c0Jux23rH04Lc$Jt+AJI&W|+XwphrTAK39=dF8i03LgO$M~KVsC$mZtk14HBBeqY zvnJi#r7_|SZ!qfB(khu{2?7G9v27oJD?iS5isiLlp8G2rwT~s`Y@|k#}Utr9oxnzlc z1iS}wCf=ZK8atUfAGr70`r{|qV+arB)AIw%uRmVH>IT{Y3l%GWn8;g-l?@&Bl(s+_ zsiLR~|EM_&EfhBpyUC|RjY@)OC1~4vhRV&`QALr!@XQ(GMX|JNjAU)Vs0cWv06b>4 z$5`+oKepR2ATR|NVd1-0Og@P0fm!$fGe{Wch(hADf+SV7YGq>J{nuW~+?ZIGrdEHQ zVEejcm^;!k{$rE&#+yD9r4ESjZKG@qO=d=ZmH~JzLYJ<@@JAi7=Ox!6fya;@nc=k{ zcY^f~VR@I`;~zw-3hJqw4B`c=vQGy%39z>e@{53wcRtTRNNcLf{A{B%)1?zLEGIe` z5tUIn8gwPXU$)k{$El{2?Ub{!CyZy(JlYRm)Y1X+%5v$GPMK^g&(4yIiZJTPOd~Ih%q^!2*6?VO_&&yg!Q2{Fpe&F*s^0}9W#&g zUuassFv@4Q!_Wk>QwS#^?0?-X7hA)D4N};k|dfIx`g%-5x__ zOQM_VMSB|`FYr>o1tzDjA@+TKsEVC%jd*rP99Io6H7_T-H2LNaDiOl&rjm)kU^!WO6lFZq;NWTOD4Vf*z87CCM|F>bV#`l`Fn zH|R1QvVl{=^pqHvukai{ehBM5RkCin(I2x-Gjf`gCc|U8-3dYLdDzf<31vBDMcf5z zuP#|ZqsUn$l?)j+L`up)%COgG-xw`rKTsJXBwMZs1X`oT9^m);bxwOO9Vh>IWlp{* zZ?HlFpPQomemxnJKIiS5Zg0i$s9hiBypTFFVNa9Or+!d2P~EfH$6A78(aCy(BVqxu z%hG6+2;5&TKE`7d?--t6rrynC`0Vu#T7B$?G$x(t7+`JW%La4^Z{ee+%3G z#3>#2)gEklm14Y#&m4n;)HaP zWhs@g+<{8Pkj3eKAKHas4uo%)UNM^#+Q`H{iPp&)bO5noL?^0QW`-=NpNIQAjsle~iJ5fr4$^z}q;~Q|>N1tEgj7ymnVI_v`xc2OKSMVxKoqKf8;L)uZvW{et%z7fU<_D}~gp=SYW>6wIMz&9(7Q7hs$`n6{eI}_w59=5>`*_*+4a>tF7cbcNF)`?@Rcj$ljeG1>t zAxcAt3-s=v5F~HXqkDX!M%UY=f%*;SchOL`6j3dzB=oXrNnSBvTGv|j)Ukc@8){M< zL&gJ7uS}*p(bUf*CsK@HaXpGaYN(AWhk1aW+|K6Q|SsC+2W zOz)kwlbh!-s$tnB1?v}*JOnF5xJa;dEsKQWNo^G2$eUj_f$zx->k`Z`h$0u}_5rW^{07DP5@;-6#@?)oxqZ`P^s3%N$n(GM1FM`IbBPke{z%(cgpA2)pv zrghwr3L$b;{~`@}^)Et0J#9z7ZY=&Uq#<$Uu7zpuG^_4G#vGNLqFC=!TlYDXn(>pf z{m1w=j(&`NcYnwHI#czEbErZ>=^ouh_u5B{!k1T~a(i-uH`Z`<{ugU_`CnPXlbAQw zP`ZDY^d}v}Ah)^+ifUUZP-3^1=(nsl(oh{h8isa8UW-o1;u%_rQXTV(CZ{X|0Z2oU zSemag(-;xt5NOKrStPmHekwbv?V2bPT5yHoVo)u8)LKjR_~2oRw(>ph4XNKZCQ-2e zD`_~D%x@LA1RxEumrUlO+Mi(5lZVDo#v+P5YGy3rQ0SV5Yc3b+Dj+H_ND=m&)|

6HDpEL>=jQIm-&Wx#*Tt&-Pag4v7GVK8^zNNBFnc^-uIK1?9ilcHw_}ax_2o7wJCuT5C-i zU#bUM9{MFIQJQ?9F9{3T+}h7PUcDEXPc|tVW*I=c&kn%nD`v`gUIIU4hZnBWMz;)M z;oY63G2d|CzftZWmmvEzI6);>tJ+S19yE_Jw{zkZEeCye)WD;_Y8Knn$aafPEn?Ev zkGi##&m9iN^Jb^mlX2c?=0SnT)97o+E#sRFa(R}u$$CYkj`VeGAJmPVy8N>}blJ&5 zSTvV>ZO=l%K*JtD-Qb&NnIbk^ z!J{5Io)_hOo*bj-pNnDCmzoQdq25QE@cyJqx5lJvrT;~8HYx4ILAst*WmYL8kGpgbvxaDHJ+ZZqHs|lr?Tw3Q) z3ud!QcF}@~a&xwO5^}R(aSjBG~C-&cff_GJD)P4d1Md_{zUUg(XEm(5Dhoa5Z!M#c#N+qBoMmM@W5d6x@%X=3i_K-Az-vk< zA_6FHR1mSIEigkO1Q}WXJ}kORixwE;uf_$->1;0)5$?u2f&5+g#ys3QP;;bZ+a@j( zDP9vE2e<1lFE=;npIOWHw;9_Q^&`T9F6Bx16McX5srJsnHZs-lT<4=@Ga=rOoA;U( z({5I(7%eGvtg)>GkwF-#n@jLV;RRKdJ;dsRf+ z?HVCDcYV~Um`{sHmVg2FEO%-Na~7?C;H9kPOeNitPoxUFcY1>agS}7fL=W}MoFE&t zkqGgXNqiTq*G|MxX>i2#UGFzl)mKZp)TD}9JWIx)jwC7Sr%*yQZ63WNfK#^SGtM`- zZMJU=;fV=}9^zhB@S7dGAD~pQSOm+ZRaYtiCN_ETYM_XWl(! zn@9Jl*jJy8&DK$E*((Ko82<7_NOpzR5Qx&u3>f7sx!^Q1^lVC%Qh8<}kTi%V&^XtU z&U+PXMb{{q1KA!<)?$EHRa9bqDpis_Fw{J#V@v7JQ-qy);?cA!#Er=q4$oci6{HSdz;{8=VG4scn1bE&3u5>Wx{i5HT&F@B zK3rGH8kBNmr@rIiqvh6H;J8imUH#Anz9gIhUd`YYdOa-WZ?(z&&mg*Tdi3|rVQFmw z?zj$c@GX*e!@nQ`+S1%=gT`$(1%@e$+n_x5OVCD_zu)aZ% zxoH9wmT>mr6B5-Odrx>S`=bP7U7uBi)5KjEXqnF0m4>%yTew?IL9Pc|h;fFxdy(R| z-~09#sO;=!ZKA!P2el)qTUbo2G2^h^(!<|$2lgGDV!Ap#p>B!v`&vlP7c*ye=_Xox zMqF3dM9-a@6qgRF4!?SnfYhZ;S=7PF_s}Nn#8+Dm(vkHCeW0sg$Il%9n9f1Vd)aI@ zWG9-Cnu`|zAJHY4_#tW#n%fU+%XqtVGCKnp+xUGu=-kZ%DlA74+6)k>%6$RQJuHn7 zB5a#&yfj8m5#&j;TBqJ4ITo6V!pd|uaFjyg4#+1M>LN&4HtW@BGs3L0~ z{bWy+;V z{evN(9a{;kPS}a0(PR(J{K)>n97{-2U6tw5LSLW;D~lPDp4+*ix5Dk3F=FCKsQXNf zy7L!?l;?ROVzdqmF|wE#cpF*a*9$$EQV;yV%N0E1GRk^T(XTN2Cd3Fx93DNvE-gUVwf9VSt_UeBFI0Cn6CppJt8)bW}C**~b`7i^mr@Nb#{sph*}Kb)U0 z#!~RcuD+xcVk=&t$-vZq?+9aDoh}t=RjXAw`cNaUGm=_8(#&VEQa$4K3xkti2Uf92Yt>{^lATjb>8Wb2) z2(P4=xUNEUO6KxmAmjg%^BZTayK54#@LfzM(w^xY53KGED=+xJ9MSQHC zUd?1wxr&N*G#blZSgs;hn6{E;HxbucCjCm1jP~s#EP6+Ii~jiuF+TJ{irj6ljV+hJ z(wgU%CVDB|G=p%5_L#Tf6+>qgRZciDpuOU|i6bUpcs0=6mFs#FS!~oS#b_pvdQw}i zja2tkg0G z2X9(8HL7E(HSZ_XGJ;AUhTFKVMh`DAXqM$dqQ6aT=mZ-jig-foNv^)j#|THj{+Tn- zbSj^vAR9SEKk1j`VnDWCn*nQxnJ-8)#q}n+0BHnqay~_nnUq&Ly+G$c==3F%ZR!Fg z{zQ|WBK>83NvXj2HMC$rFn|`$ctxsiUoLUHmi##^053RFgl}(W&d0O*r!wpS47Mz6>o$#v;wAyeY zc`gQa<455XzbUlfgAt|ck`6Z6F$8zuL~#S}Oq->;r9t7G6ArA&9`fK_8@WL+0&%_> z6rKIY@JjK|;dLv^!gCmqJ-;7b1^%$T7&|!qbNO@rUq-PP6D>_mC{YlQ3-ovg9eM(> zFJc7AU&SIY@IEolGQ|^~%hYmP2W;jk;)nlz3HQv2QUTCggiQ~|mM@qN)AHVA$@g1$ zc%<75JPW$Z`>eVv$lof8hVCoMj=j#Ywy_uKA^UlYy&CgMS<3^MzFEpI2AJku#(iOi z`E~>5O0Au+uGa6R$RtUEvCwL`FJ;~vF*oAswascI*@UfW%N8Yh`+`18buUB~lyTCk zQ;w;gu|1R8!c;?bT|(%kQTD}jP%o%i2)sWINgoj|5pyS0O_IRm*iiIa%p29?G>GPx zx|OjPmbS`M9)en&=O(0YV-be2a2qK>9CQUE#_$zLV~ik>MYw?=;gd!sTHt+RoN`dM zAKldmT07U5-qEJzI3ut8xbJjdCFvy}dej@QwD~TL4ZY2D@bLnTGHIFeO0>`Ia@+ke zV3BL(mraiHsX)?uPAmW+WWU4`}^Zf zJ0NR3bp*O$CctL2MJylmgs*yXaot3(?F6t zZY1HC=o6IsD#pIy`|X1S`*aR=os*nG zqAun}#*QMk&H#Dx?>RVj(gr}=4|F=ua7YSEDMJMcW%Fh=_*HPAs|w^w2_h1Nx*u8Z z+RR3zr4Mb0@Ss3&5ZZ6O|3uNZB$uTw7SY#zGx_4h%)Non-{}Q@38Dqq{{kHPLn%VV zE_=TjZrsCMjD_IX>C6bntdvN&8pe!+sI)xJmgs9TGj5~#8gzYBP1kqduN0V6t4Wm} zz_=XvsJ?feBO{s)BbYVS;m$0KzKP-@gBlbHZWd+s;6VB3>Bzpa#tci<#eD_Jo=9$nP{WmdisDSTV7o^yfSvvDAEs9vPKwv7!3C7&(m#M zf~%SJg(95x!Xs0P?(01SQ7nu>Ez*oMizQO!hY}*4%~udFInQIy3m->eh8C!*xGZDo zJW5iWI121hj)>!mDt_`_>jFWPb>eE72DKQHld)<0yqI1AdAzQS?r%DBXhFGp^1w4- z8{wyJ?OxV)sa1|_$XiD+59?NaTzU@ufey#Rvh-nQhp3|3+6X@@g!ImHvx+AWUsk{J zmQb9HK4!zVCNP1AlJ9Wn1EHH?WClC*uxiDm1ii=N&v@bsl-R~97vsqYp=&nk1NQ~K zgQ0RE2VB?6wW(g9ncns}n=QU4E^+uJTcE!H%eq*D#@qd5yWg&e`4cthA4lqqasO|n zSNRuR_+rvnR~PR`;g^$>Dv@k0+l7rqhh zriJKLbn3mm6U&Z|fVZGhn19t?z4uW{RTv9(A6-5rv_ADLBWHLX4wdjt$x--CL273= z(K~N7wJ6O?6-~JvpSG-_z8@~R6sGh;L4xrIZ=1l4Dy_N6aUxh_2qY2CZavec#JyIq zK;`hgJe@(E2wKpJ*hF!kj5m*X8kd3LO=$GcWUi78s#aq~9SL1hamE~qCC|X~#Y_w( zXTU2oJFuSEVVI0oXcOXT(65$WBcI^9w=go4hB<~(Yvq}H$(Bv(k`W|**$DW`?1zcX z&c?OOB-YJ9o<#Q+BEo;~QbAp*^6E1+!QyLEOur5HH13sVdduGhR#{l%3m7wKpLRD_gkJW+j->hjSf*5?6lMwmv4u?1E~Bw_k~meV1tQb>XhOWV`9F6RWm)S#CR3@Dyr%q8k(WRj}%WTdrfA(EXG1+H_EVY*P3!n zH#}szjK6{zJHX@(V_qNQ%CH<_1hC&CR}U4_agZCv%qE)?V|!^e%i|6$tM8R$hiSPX`PbQPriGcD1|8dm>@oH8d;%Wr z4-E_c%MpT(taMlfD7=LKzZG6ZXMHD!zbyp$aay*s3@C$9v(gI{ry~tQ`fCIAxW?~8 z8nYo6N^**J*y_MPIq)_*OP*8MQ}Lldd=lF6h3^U$O3Oo+LQxk{9lo=Fe#-2ewD$(g zy}0kb39p0rclkOzp*d4v+m#MlUu_^oVo^yu%4^~6#XC06fDv) z`8`{StuR&q&cEPVSeas`4|_*W>x97y;GjRFSccy%MAn+WrEy>V6Ob40%Q`ZUhY$6V!68F0>1sJleY5OyCppk*=0kheYRe|nPYG?L{od^fe&_)lW@jxHukUZiLHW~~| z`K2YOU-M`u#|`Xt?i50}F($4JJkL7lMv&5X@0(4m4MMmPC${;87OECuNq-|LQs7N& zOU$CaHyA#Jbm03!2;1hxuo0lek!0`8-G=VFqQ!u5#?*B4Yc)tlDGQY_;L!U1mQnow zf)@VU{j@lpx2-lon;H}-B1Hz)sP*3HKact>WpZf=yAiDWZiOm?&IN*Lm{Zq%A97hv z5<<{_ZMCTq&|)to-3Cmd%QtO@W1O{}-medkTbLFa95Ah9M~>Uj_v+UfZz_-{GsD`* z)b&(?Cdf#@8msUofHUWZ7*od`uF4JSAg`5RE`#k;x065O^O?n!STu>zH=`+_`AY#B z62=Tqpmv*0o^VR-KT(qMAWEiWGr2Yj#3@E%xTv?JW&y!OfLF*4^vuK_%1V^y|mtCZaPMFBjDOt zF99ZG=stg)`AyW>8!}H;R6z-0ISO)`nPGF#g3)kT6}u;XokvNA`=alaL4vg^x~T?UGlHHIj%|s-VbAFHhcGbyF#pp1%0fCauyl zEBe`u5alC`*KtXP!y#rWbmYOSd}T-4)bVKPE?iNyU6mirv%A~1!?e3Ek6dDmj@vD6 zplzMKLLMtJE}BB<0>wMaCXvJp(h=r|VHg*sOar51nB%l)wJJRFWxGQobjc7+xyCTV@pILC$$e%tN;Jv9jtD@h3afp8K{AHwoV|npg4)OoKN%vp3SpR`Il;0L@ z8U7F4q4KZ0LG=WoIbU|tE!AvtQ1)lQ0$D7|w%;3!Ibn`OyA&+1v*ldjo6mt8?)d-G zb(q)b)X}tig%5AFJ8s6)MqhqB?~=ch5#oab^DUgAORW) zlLL+_Kt(d&P9}I6)`rnhb;RJt7Kckd!8~w9mkbDZo}F6>iNF#BOm`u0wA4zLrKwjM zwZZcp8G|xM&=o^q(qd`9ccOsG6xFo|i*%ld^`6y~6t1;VkU)-9Kbv!YJAU^E1g~r) zuR`JP#d<4Z^|10x(gY1%psx72=AVp!B^?}6NeO|}lERl8F0+kz8yq-W*t#cd-N4~icU|Fc;^gRgTA#>t&oRP zE_@IR!8?8zU(EksZC3%8#nScZk_PFJmXwn2l9m*Z?(UEjA5ua}q#Gne5G16fTS^*5 z6r?*j=c4_#dh_$W8jog)Cg$y^;}` zAs=x&xM{GHyK4X9Rakp8cltf7MgPlUIG61+;;f`v6sjI34mnKqa7L(n4DY-qEH1CT zP9{bqw2eMF6*VVE?8Jo0OXBwuRU)D>KhmaQO4`>>ToIA7gLAAa#TnFz+*$5SD^x*I z29m~EKPnRo19h%rUhIaaq!V{}F9S7nhu%kVrNH=uJ;HmY?n7+@O;+zAh>7t*BT>J7vX>G|BjiZ2@{7LQ_FD)n}Pz&0*>IVu9`5I@~%O*(g3d?5e zCAxzn%?bNiF5Gw;bPuhoH^ngRpw78(73_2a)oAQ);4f*Q?!cUVgjXfAX8(*&hG6w@Tj)AchX|Ct4y7{H5QVO|@X!%6? zhiDusjOm}6iRD-uc+kWx zl{e~HZ}URazMw5(Q@|DiNpoxt8*MV(t6Jlv|0ibyCPvti)-Wy^YSi$w<`)D{!Jn&B1l5ECf_T=*_f!8Gb zY}yz^ayz7lU^cnQ5uPfPqlvfd2rX3K(NGk*!=|bl2H$~69$kcR)Pc4HofxYQr|HJ> zEQuDM_)U&&N}VLSu6SN2!MMlNomwF@S6UtrS}J^Dyq!k%q&+6N>iOk`7n<8dI_dq1 zhn&}@Lul+X-esYv8+R4KU7Q5|Mzh$Rt-0;ymvY@m`hq=q_^r2OeWp6EF*YPK_R*1o z*WQ57N(~t-F7N_V$kkt3Hs?7j{dsBo2lw^C4vdWlVltNbDg#!~%E~Sxv8sBG1h%Pt ztg5ED>eElUE*9tBx*G5D_)RyR`H6cA2{*EWC9#}$)sgeF!`j#Nb6?#TFABWy7oEAc z-ABK|ap?CF{Z^X>kg=~YzrW&o#S5C9fT7_V^$jsPpUS)D%-8E?eOO3Y)(pv<;AC~V z42Dg&Q_?DHU+p6kkSb(McLtfOFr@AFDh;Vas&?u%N6{Jq8v+ejqlj~xa44q9%;L~@p8V+4{I^fXhHU?$F6Qv~{k zudh!Nf^-ykU-`jnGBzt{Qj`o~#`q$6+OGSUjH81pf}SRN1>Fk#^4_fPIp( z+cZpNn4OhTiVqC?548~X=|ekuyx(Er#bMEL$c7yRJSKh3s7Zfr=S`O*F_CQ zqj^oycWGLiXhW0vqC3}ow(l&EpgFUZ+y1*g8f3fP`QvyU0!u1SV2mJf@0<;Nr z35NEwp>$s6j4%Qxq@y@01Qj4pmYfuniIh8P#r}`;#MTvd%cBeOiqwW~h%rb~&pIuS zy>nA>JTMO;eLElHrYeI$i&B_DIucM7yyMuf>Nv&W6X6g!KdYBJgX&Jwl{!b74)yt@ zI0o@216Z&FzcPjQ-6SJD(ovv(PF=Yl!5)ztB z>1C|8R(y`viak+3+tRKbu6ck>zAxXOa@4T#itFg(${_|+6=LM90cNLMp3x9d1$u&( z8JDm9c9KABu2C_&ZW!{i!%|Y*SF)do-)*Vyu!nDK%ygWify zX5=bJws|WHn8byOhl><*V*wV9nj^i=OWT+vZ54#iN5^gDqNM2|BKmu}TCyOA>lw6@`-eyezHK$yO*Mv{`P5$GKA2Bkvkx)b$xK z++V8pn+~se=T@kjQr(&Sn6-l9;fwrBQ6hA7D>W$8T@+WQ=K_aV&>17_L_EiTiyIndp`|6XDk9xH0x4Ma|Xe1LG-FYZR zpV6&Ev{hDVyp$h9Hy7jq*<5*-Tm+)sdQ z=WWDIlGcTk3-kg(Ur6sxyu|;%YLfuwyNk`3NUe?=UcrP1~71*ayKT%`OU7z_h zv6x#s@OpE}4#CCtsAkW;Zvr?d5;8}zJFHJ06Uw3@=i_0wt!MYsdm&bXBO`R{Qdwqa zH5n(qcr;-Z&ZXr0Tq<7!qCGTu)Sa*5Cc>Aga%`2tex%0rz&~DATp5tM?35pjZW~C6 z@0HN)c6nQfse*ZB+p?!-%Cz*x4D?M{vgHGE_?4Q_{-g^lUw3BW4TYPw0da%>rPU($ zXX5s^rG)B#HhOuP3p| z`O0psr#P>tcpdJH9gstnpkf#qV7gPLK9#f{o;Dt3Dcn53d(!1&Nk7lfQ<0c~9$#$Q zW2JyX8@rc#BP;a5v{S{irA{JeTyr~AO1Pi{OaGe}8M;S%-U*edqh`T5)gvoWa4i#aL~-DY`@4;ly5030OIBS#5<%APEXZ87wOA>8sPZ6+i4M`pt1 zyId&?M@wRYBmq~Hb*EtI1*NOfV^Ky|0V>AnkXwMyu&gWDm_^)$VltzIwAWHWu3ARO ztcL8!#;jzBOl-)G(wGDc4o!N)g_84ixtjE#XuonxQ)2zKwkAV~HAki+%e8ddQ9KL)*P40S;L1wmK(E!VDw(RiS0)jdueTml=o@syyIMz+i2Z&DULIU2CbP>O6Hg=CHTV4IZ8Zx z&OmdA15J&qi1U$MSwuWpGVMnuBJX^3gBYu@t5C*nF2=lG%;g{W=!RK!o4qCx-DT;H zU8M~7<0aJoFT7Qyusg@JdW#|gM3{M-L2n{GNU0`2544vKzk5Eo>x=c+jr!xOARS~$ zmc0xQZro~A?qq3S&+y?qE)y zV}{m^iED6)MNTM?WeOLtSZ z-z{|@c5W0US0hzdqpy?Zz57je;2H-V$x-DpnGd6&m~mm?hg6JWhE!!~)Ib4up#~oz z+D#WFS51yHP7z0UybEXrAnw2vAqc!~l(;Js9 zk;<=h3CS_Za?Qc{!Fd%Xm4+kSlzET@qZpX7RzE92`V0+D_67}QbIg03hm~TvgZyT3 z^$W%ld>b~)m2#4*o6SSTQO)abpH@2tEc>|jGAi8}fv+9_;x9~Ee1hrTg}10-s=B+(i-i^`|~_xvf}dt$gzmcF#O zNugV$<5D8s6oLSz|gbSaGO2!KSd> zte(zUg&w+1OIC#NuCDUb>n}3v{V7BB--X)W4t`+22Y zvDjZG9ivQ$+;orBsY6xCgG}R~$`h~Gu}?d=qaloLlM``FVEoy1ui`U9gB_z!%krN% zuD|hH;Pq*Hc?6{$(U7*Mh*nosC1Gq9!ZiuSr}um7wpjL)P^1Ts$T1Yv zRvUgPpIU>ctv6}bT!_*n#t7>T?1x*9CTq2v<8uD^1at&W{`Ks*giIvcSO-)rhhL^< zFvVLki1I|KccJdn`YYa&ErpJ+N5V5(o=74+d|L;#*>K>tIvAmYp% zvjG9B1DW=$IdPMjwjA3VBP zP+BNPw)T=}mG?PQ66g~AliaIE=~LNSYMqj7VnmWf)2TWp9ig_Vj;#_!EfR2c?P;{_ zFbdsn+Zbz(xTtSY>^@lQdYn$!zxOm?Ly)YO^;1aq0 zIp!!;xOTabsGjR^adm?vc2SMi9@KDg(?Cl6qM2|r$?H_|Yw^0}7TNeVE@XI|IsuYs z@s~Y4!V7tIn%-FvUU(aKIeH>kdY=g7{fS-Mdxx0Gm!`vi#YAr13BfKZwFjyMh5PmM zS-gV%c0PM^z73N-=J%Dx6m!(CW3sio{diONM&A~zI%2FZv|hconlo0m&c$hy*4M!P z;0R>=#xI!n@Tu`FSR2j#J^9)vZwHrXMswpVV)ioLZ`x|Knh79$IEhJ=;zz6kXMPR; zr3jp7(e!m<`6>e7l@st}W9e-1R}uIhQh;|sR`LQ8k{=)i)?otb3aEnt1Nm5fA@*J! zLoC(ndTs|qAGL%Mzov^aKZx+NKo)Ybb6ZHZZ%CZ@@_FwF5sK5W5EU9k`mi>ZhH2T+ zv(_$6(&wSp8?ny}t4fFZwi4AvWJ-oqzIBElw*l zhhm_P@<54=9gk+k8AjA^vi(I!xaY|%5OFtUY}zR!t`-4?rVty;uxmS7g_z>yA}M>1 z+ec&-z76l?T<|Q=ICOy`&?m6t(#TkmX&~ zTHnFy1n@7!OHScjHn^qMfBalHr9ELD3m-P3C4Yn;Ut_|}Q(J?C{b{mv*uVxeYo}(T zR<+reEWyGsalPV0m~Izf7Qg^zfp+dbPc)FI!ICsE3y3hfQs1_8?H)s7(o6HXVYMR` z=5^!3#ET_1p83iu-LLTc|Kqb{R0U>4q>HcBt9TLN{FolUewX)nT6*bT`_DPZPeg zBGYiFy4mhmWeH3JSF`HFE`g_kC%*pGPZr@y?o`fQVRXP)lR&s5skwa|b(qgbu&mSN zBGkFe-_6|b*BR!*k!HttVcw-rJ1|(UjmkX*XH1|pUa!AKo1^45?_sm_K3$p*Y})*) zbJ}Z+lDFd;9BadkWj%6_!flQG8Qs1kDyMC6LQW-|@svk_G1cri zA5D24G9eAWvB+-G1}%RH!vWoV6OkXtkYueXs%v1Jf#$OUdj05Gl3n_Z}Iy3KYXO-X1dOu!3cvP}p>#dQXtoXX=LE7w0d7?{p z&?i=Pc(;u^PiIOilwVv$2dP_6ztpK#;>q=J8$)q4SQ*D-$&Tbhx7A1C4R5V$9czXY z%)V}xSwC;Q7hWm~Z;M90x>@O8P{=azybkY)n*;GoyLfJnIrb{(BGqm6h!0~=Z8znf z;;(9;-+nuN9i73Vv?$L6r_g3B4sCU66@Ii-*)I~Cbm0qpCC=u@rt|!x%C&$SPaGhiutc!LI?xfTR==y&U4g{Bhe z$EjFeyFeozG*Q9v=n>CT%~??b^(|T@A&gz2rna0}M|Pn=0wzCfnzvF8YZ7s6t+2|) z7R_elmSvZ72INrJCPEZE<1{4G#P~lk?`Fhjnkz_usaap!oJkdLBgF1@wMwQAnjnWa zuAxL?^Sx2AFcx*WRlHc^o}T~2jVAdAFBh;)Q&&RS-E}3&YCxO!5QfRc`WI39mE_o^ z9#R)yy5Bg0Q^dF$oaBX9{Fcu$dwIC6Ns3J@`jwc~qhNkL77#IN%L~)uVacLSf5lf> zyYR9WF@QIske(`dta&SvIJs!gCcN`--OM5bzCJ4K5~8k30cY5SIY-3u{o}%zI9ahht{xJ{L53nW;SS=! zwcbwJPGagQnJtsMxHXlAZ^iD~p|Elsm+ueKB-`xTY-29<&y^eA8Fj~%$3j@tg}sH; zq8t%Mkf}{8j=#n-$W3I#BsL`$9&xAiO4VoB*^QUn7>-`cKrBE4Z{z2=VQwZ8x}}KF zb*dRosX=lYVyik~S+lxeWj54E*0H30N1Tu+njeNGj6UFE+jdH>7zJ>POyfM2Gf59} z4|;F=`147=vl-WnhYi3iAqFu^oUMp_p8QSUMCP1nxPAEw)-Z!mw{sJsP`9{+ z-{2igYozTqCO}-wZkd(wOMcL>!o^lNi7iOA1&xa}2d8>1^z~LROgkU+ze#@%-Ajcp zPTUf+-4nMq5s30k_7zre+@_kkRubYQ3X0BTgAzzxsW^{1e)3UG@aWWw*L4np!5x@} zi$#-&mG8%&+SsmXc!+YiRHe(xvgL5~^>0t&KTRNtq+f4Wv6al zCS>ik*J;i->d9(3nu%?yd?K*ELM0Y1J@wv10ELYjSs_+}Lc%8RCZYH+{`*i`_x(h! zFfo++-hs5l@l11G^*QA7Y~c{HUG`lYq^>t3uYA^hOG45M#4p;I2YVXs-!qWVfTJkZ zk@{f8O#Nx_&Wh{H;wE|P=cwWtq3I=%hiaN%Qp-+q(nn}Z zcQ_mhZ*5-#&D&w$a)`f~ZIv@?kQ%8p$`w5*5i(`R732j-i~N{XGriMu9E{68Y1m07 zHy`2pqkW3Sj1!z!#)p0A@FRqS|RG2ifwFdJts!%~6{&N_LH<)!fz+*ZPPbU9?7pg$FfKzowo4g4Uo5ezjRC@@a_E`mH_#OM3!vBA=S9FuEunJ`=ag-i+aO% z#HwYMA6J5)EEDA=d~->vsRtPd%#-ukTsoW>Bq`SdKkyOY804cL3ANm~5+jfx(Yryy zzM3+}l@Rj9Ag?`HH0zDliXT(HInN?4KDBUM7JN7mDxuokA?Bdx*xIqWF z{_$+?;Z4SN|~CBCkEsU$)J)0!|x&eeV=G9!%P zD|`Cl@UEPlRxuT_#}_}{B(sGne3n5h`VcNPQj^NZ2jnKW{<*%kRD}EaTRR!Tdd{0M zQ>~Kapig1xRmc9ZC}c4UtmcaU31a zNpktp+L=fgE?exE0)C+YsMPl6(f6aTNd-)Z3i>)Hm#WSz2KBvw5eWteqdty zu;HF~o#XzMX@hXMViCv(N#M&`A~lPrsl`pVSu02}QAz4OmmN&gczf;TlJ zWWMcYtMn*pvtbINQ-Gr4G%WFf9OrI^7b?}HkzyHC)G$L9C#wlNCAi&6e6qjbG3Ky* zg7(HWT1N|X0~x&aaGy^}-1@M;4jf0-ei)EYcw37R-`;1#Me8ied(1AdgJX}~W@04O zhp<0ra+_}_LMP^qX4AacrorbqPN8)!WsUKK@#?G9uJQ9GJef@N!z@{1c?UHNqrB-h zMjKfnxbrE|OYU#<6An?x`%&WEWp%k1I$KiE(=k!J`X3N#b9d7V?A?~qfJY1!t6qLB zLf}L3f(%LT%4SXT3d)lnu07-APg`uemYdFG%Bwprareb$iTM=~QRLE}r!Wpje!hEC zv)Pl_+Jf=%!T4aL5nm2#Neg!A$WG#m{=lkTa+Vd#UiRw;5Bm4tIhpj{c!N)ojUNAb z>Nwc7nhX9&r`i`Nss3zKNJw-(_6fCIJ3CQU^1GrCz34KcLF|X!O_B}KQ3c)xA6L+( z^}>`}f;y#KtNj$B*Cb&oOLW`bs5|8uvFuF49)M+76;GkX4`4oc()nlRpQoPa-((of zd`Vje7Y|V$Q{M7Q}H>ig$#Yp)F1&-`iyCjVzCMAw- zmOZA%1LvPx_d>d$P?K;dc<{>Ed|FuV4b-Yp#oZKAcp1Wx@=8hS;2B2M%a&+ zd?ciJZR^8V4J^F!)jZRPd!*HS{!8@E#P<(r z97Qog+~%s^hhHUKx4=oO6r<0yeZY==dDS|*1=Kj)KL0?Z!P34UoPPLGeg=b*wWYXu zSB6}1wmTjuFz%k3cbkdIF@FMv;ER^j>s9_C8hvH)S8U%=@{Q8>O&*)_FJ&XGhWj7a z?#yGj!LArge>VJp%ytiEh0^QdD2)&YnduEmUAP`C#jak&+-G{M2fb40u5p1(n#}?| z%No#lB?<52*{f4r6<2QDxejLd;^zS?JAmPNzhwA-GVy~ME_G7S>Mv&ZD2f3R4-Y4S z3v4Dl;CD65)*fz+iXu?PVXa|_7nNmUt_=L3T`aEyP8{i2Wx&ct&BV9S$IG!ccF;k0 zM|Jgm6n0hVy4Iu2P*3Vw+!c+2;7WV&hDzkghDtOkDzKr#(-fy#>YYG%oo{!U4}H$5 z6Dju4>aoe=-m*IT19}vgf@1u9?l^Ik_VEnA%67Tyc8{rIT&=ZL%NR=DkR)axy4bc) zuDHo->=474hZ%TwyBIk+e^Kxxw7iz4ZB~oyOY6%+`?7SMGSss1C7I*84lyYU{7~?< zNSMT=H6>`v*icPz<&5EhpmiyKu4=?K8#o3u;(`y+9f=>x3}|;bU)Jh6U65N#PQ<_I zHb-fc&bI$0K1E(ne8vQ8^^NV=ZMH%lsQ#Yk0dLS5JD>KIK5OUeHy_Dvl$FP8bV^la z-vT|Dy=7BZ8ZDM+%7r{%+Vzx&Sp;5N<~Dyczs!QnYnIIu2T6jf>DU$kn^S(t=JRY) z|5UEQxkA4)Sr(QJSJ2Yh+S+I2gv)~&+LBRXnVPuei+rR{Y-N*%sZ~ESYxrFdZj8j< z2oI&i1tdDnt50V8B&#tJ|3zFlzCMhcq?4qC*c#Twt&jO z(ZnPkrY0NwRWBXg6NywsWejX{a%G835w{-+XHlczlKF|$@{>nA9hJOTQ6`G8t(qET z!+&e%Vj9w_ULMyno9n6?;%jb~FNeX6TTBU=PY;4VUpch)l&{EZWGw94ch8nfwCQ?^ z4cacKcYZnG-sO4{Z~+Q*1V6Yxl!=AvH&XGSrmk@p*Ke$?7@HH0?Zzt|Tyeq~z& zEx!~e(Y>|`tGTR?lt_ZYcsHCIb`tuZ9AH41k6!`IFY9c&f?NgypjNlib7{c}<8S$2 zCBgY$yM~F_(@2>l8Di@LH#3eFSa4ai@c*)ye!pb z3XzPH3CYZfZJaQHK(*HAxSeF_yYNn9ZqlYE%7s~ek3@=!&|bIQhnB4OXumOqz_7YQ z9n!!$|5@7E{D6_gpv}~I>V5IO>^nF4M0r0j=0}r=XKa!0ZkXyH&u}@yr6oQ`PDl5^ zO~BVGWWBPb?R=R7rwcowxJ)jWFG|>_rJeBt;cz0JiZODseBln1jUoTuMve=2QA+C? z^ojoh)*UuMFpGbk0#@a}VzHW~t*O1M%U2E;Da(QDH+>lzvntxqXu8k6XE0DmDV>>t z3(xGS_$)j5se)Au^B3mpeuyW@{9iM8mdrGXm^F0C&nI`B)Chv*q>6>(8+|QzRmD+k zJ3{5?@?IzUW7IkST{gn^<$LUvEzws^VE74mA9SzNRgF+AEmKS|N#r9jp$%(xsU>=O zOb{!Pz{%dy%Q(8mU>c6bU}0UiJJ-%fJ5jms2@?rdSLykMc_+#*>T%TW;->xZa>7hwg!Q>uN@L6_&OodlLR5>RRB0o;v)5a6>5eg1QB_m+jFi>Z;lp_9pPE%mkj3`zrx zDh5W?kWsKVu{5&;O8tJ%tzMyg;<*AoRLOlvkF1md6Cy6zor#C22%n=8phkaZSj21J z&I~8`p85N|+|PJ))ac$&9v_G6DGm&3 z-XHG0r+ANe<gM1k->BR9C4K9iUi{nzV$byjn?H^(w*iW z4_hip$z7*c9zUdOXhx{jh$SRPxq@R`TFU@Lrq4BZ>`un*OzYF`XOwFi9+W#Y^)0r( zu(fN;qFUflLoHo0NK}~TmLosjmd+8pdBb6(;WCaHN2%qdD^7>VJ3BKMCOgFM;$PMf zkNT{^tL^j>`$20(hrYvF*&U)uC$7S|ARB|7m`htV5~c7!3Bs45SE_|C@Txm3& z#(GU{;|Q6GKt6$`JHQ zoiJ%`FMC=~?^_7oH-i0?jafEz2~*|H1+Rnyv;BL5JKjfY+bB?ajoEm^xTq766n+9)c`&Tg$r?RQ=Cn1z?V}d2*ne& zl9vAgVYj!kO)D}yd^*Ch;jSRO^(uOOUUe7l?%@axNqdf}y_tL8mol=f^!sf%@`KrB zRT_4x2MG-B``10;S5~JD?7W%kY=+64-ZD2lbgHN8F`Hs0Rp0!O;}C83q3;EK6pzy) zNrx;&@hXdR+h?_Zu;0+pdgVk`wauVT-1(Zg+cQ`hfU1aZOw=Kd)i+kP2b$ zD$l^y@%VD_#+88K4CYd;iyDTyMhjAx+~t&-5NueI^lx|;98HfG5IwWI%|awM8aOrL zQ~#WN@Msq6YL)8JMzdg3aC0TxMvoJQUk% zF8^m{25OYsP{Jr|w;XXz=y~8ZdVBloxXCweAAQ-vX(S^XRmS3}w7aBU97E9+%YLN3 z{3_yPB11lz$Vz8l5wVM=VYp_DGmOQjhiN0}b zv5?GSrR_x(Tf~U?V2N<=SNgh;hnqnW0Me9XBB~iGxf0kzlcnkJNjb^)kIFGK`Y>k8_pRYC9#J zd0hnfzPg?XJ_NO0A*NA}DzQ1N` z2>6X&`PIwB5HD-}{bfrBdnXvC$&|&=&dwejk7{rC z_x33d^*Ta;cH@Ct1fqQepwrJ#dHO^Dp?wE?TNa1!={8Px3pK#d*oOJC4uFrHSWr;l zoIwjv7W_0GQd^Lv%BEYx`Zf@5^A||K|ZW+SeDq{jUG* zjqj=b|93D7l&@aMzk1^W1ep4_Hw+yNjV(+ezVa+xKo6d}q99*1GqtgF|K;oWr(TAF z8vNPoC*1yJBP0-w5CF9N%IW%7-9QV`lF7fcU|M%exZssq}LyAky|J>$3 zi3@m~)LUl9Py?rU8mLfEauDB40{qLbsQ>ZJr`s1bH+M1x>J|O19Lwp>0s~L-Rwf+- zl+6G^Cg7R%$5joCgmVD@&{;X-i~#$30GSJjbd>l33p}x3JQuQ) zF?dyB?BWWjCSw~zXXmqsMfYyG_5l9OCL~;t;sZeCNSERcZO>JcPS7^a5}?hav)|2k?6S$CV5Wq2DJI@D%$wkP(w~A_>r= zc>wz$dlcr{d4RsxBo;Tcu`x0bpXDSDx)kXU3=|YTAoh@&E)LK?zfa%~+%viR z{{|cnjcEvgUInBdlHj+%#`f<6|5Hhrv$!ru0iE-JoLmMJx%3Zq0#7wJ&V&2&oY!Yj z%~I(U?g2Xe5YVNNx(83^T&Uk|ub&U668b6R5MVg<0agwql{lv7!TWi%`dKQG*^F*+ z0~(eb(BF`#*w*Jk{j2D*6R;=cW@%^sb6V?QT+MF-N`VRJTgW-{x$AjQ|8jl#u8h9t z@;png>ZSIF(m*d`0b>c0tIvGSgZyJL{C7&v8is(rJ9XLnp9jy`)XB}#7}5X*TOoxP zRxrmqrAWs0dI&lBE^uqoeT?w)W{{9JPg_-pSKJerp{=a_0j{v;0s>yoGjTgM- zs}4+cG7zoLo}=~udHu5KmY4=E`q~8CkQ$00^7o1QQKR}SdE$&VLbL$J25>{lOh(l2 z4%y4twN*aFFl zYytR_&71Gj&NnZcv!76S>0YG_V6hzo#*+vHXC-3K^9c^%h#foQe?Y72^^0T!2nO$= zLBw7|9mf4W+AkLsJnRo9m;o4Y{bs=CJ$1z=oEr-0O(#>}G|SZF?@|b!a=3b~ImiHj z20)LBpMnH7u9D6Ts$lA3VgC<+RQX>%ssn)FAVjcR-j8c1`40jAjaFPg>1}cVwi_^6 zAkDLu)N??eI0yavn$6NGw1X5tZ2(XqHx@KA&VlM=Z~Jc&LeGh;OAd7L3*d%a3NK{+ zKH{0u-)F@U#YY4dToxVyAQ5uZI_I1N%+A@x(9XpY7_g_kX3v6_;#Cjx0-)duDUjOz zLhc`dp7@Ix+Wv#3@;*+e!~uYX0kj`v$JXZkKJ53U;?E_MBrbfc2B41-@odK?6#PCI zWFDjMMJ>*DtWaoTKQ}-jB>*h;Lo|V>j>qQ!^#IQ-hE9eq_D(-1vT#-l7d(18fLj0p z&#w6Q@f7X! z-A(5J{ij-)XJJoQeS@?+##;Up*dJvL&qANBdNPnBDYW;G;7(UyI@_Kry3FwZ|eMrzp@`sXW)h0 z?kaly2Z%q-hJBXW(P`-AMt# z=D#H5JWKHD>}imPI)_Vt1pX`8IlHID1wpmN+V2B@%cyh8&j-9>Kb^!1(lqHiKgOv< zZD%|4bjBcg2$~u;&rQ<_-oLHaPv>cY979bze})WR=AFq;bein5tc3L8Y1=;s_+R;2 zPQ!q?c{=$AY!RZW6BY?>|ojd`Otg3S&{3OT7 zSwmCxrR3jqD6Y2<7_LXHtqDCpl_kbI9#I!o8-P-W#GyaJwr{siW)bH1}7 z?q}gohuA_|&fPG7K;>WX|J1?YVRSmc6B0Ta?mvJAtAW2Fde2gQI@Azyr#k}SKY~6R zPkQzfPKUuk^4%BdKl+5z5sqi!Plstis$Vmd{|Np^EH-02tpnI4Cu#c z{?DRn&VI&eZ+pnksKovwdQW}EPvSDpe#U7(ZAfcp756{-jPIUE@Ce}Uwg!G7umI;R J_|U-L{twk0JAMEF diff --git a/ipojo/manipulator/maven-ipojo-plugin/changelog.txt b/ipojo/manipulator/maven-ipojo-plugin/changelog.txt deleted file mode 100644 index 614f1788b1..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/changelog.txt +++ /dev/null @@ -1,203 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - -** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - -** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3461] - Re-manipulation with annotated component produces corrupted MANIFEST - * [FELIX-3466] - Pojoization.directoryManipulation() does not take MANIFEST file location into account. - * [FELIX-3508] - IPojo Manipulator left out 'array of enums' in generated metadata - * [FELIX-3539] - iPOJO Manipulator failed on classes containing expanded frames - * [FELIX-3573] - IPojo bytecode manipulation generates a duplicate local variable - * [FELIX-3574] - IPojo bytecode manipulation looses method argument names - * [FELIX-3621] - Two dimensional array as argument to a method in a component - -Changes from the 1.8.2 to 1.8.4 -------------------------------- - -** Bug - * [FELIX-3297] - iPOJO Manipulator throws ClassNotFoundException - * [FELIX-3359] - Turn around to avoid to use the split verifier on Java 7 - -** Improvement - * [FELIX-3384] - Ensure maven-ipojo-plugin is thread-safe for parallel maven builds - -Changes from the 1.8.0 to 1.8.2 -------------------------------- - -** Bug - * [FELIX-2825] - The maven-ipojo-plugin does not replace component classes in WAR files - * [FELIX-2829] - The maven-ipojo-plugin archetype descriptor is not conform - * [FELIX-2833] - The maven-ipojo-plugin does not support manipulating artifact with a classifier - * [FELIX-3012] - "Duplicate name&signature" problem - * [FELIX-3098] - iPOJO new manipulator crashes when using a custom reporter - * [FELIX-3145] - VerifyError on Java 7 - * [FELIX-3249] - iPOJO Bnd Plugin do not write all the metadatas in the manifest - -** Improvement - * [FELIX-3017] - The manipulator should return the original class if it's already manipulated - * [FELIX-3078] - Introduce resource abstraction in the iPOJO manipulator - * [FELIX-3079] - Adapt the Ant task and the maven plugin to use the new manipulator capabilities - * [FELIX-3080] - Implement a BND plugin for iPOJO - * [FELIX-3131] - Elements and attributes should conserve the insertion order - * [FELIX-3204] - @Temporal should handle instantiation-time properties - * [FELIX-3244] - Manipulator : DefaultManifestBuilder should be more extensible - - -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Improvement - * [FELIX-2733] - The maven-ipojo-plugin should support JAR and WAR as packaging type - * [FELIX-2744] - Add annotations to the maven-ipojo-plugin archetype - * [FELIX-2755] - Allow the manipulator and the different front end to use several metadata files - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Bug - * [FELIX-1411] - Issue on windows to find components inside bundle - -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from the 1.4.0 to 1.4.2 -------------------------------- -** Bug - * [FELIX-1411] - Issue on windows to find components inside bundle - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-1302] - Manipulator never ignore annotations - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-813] - Resolve XML-Schemas locally rather than from Internet - * [FELIX-846] - Enhance the iPojo maven plugin to take metadata from pom. - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * Embed the latest manipulator - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/manipulator/maven-ipojo-plugin/pom.xml b/ipojo/manipulator/maven-ipojo-plugin/pom.xml deleted file mode 100644 index e75ca59d31..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/pom.xml +++ /dev/null @@ -1,195 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - maven-ipojo-plugin - 1.13.1-SNAPSHOT - Apache Felix iPOJO Maven Plugin - maven-plugin - - - Maven Plugin to package iPOJO-powered bundles. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/ipojo-maven-plug-in.html - - - - - org.apache.maven - maven-plugin-api - 2.0.4 - compile - - - org.apache.maven - maven-archiver - 3.6.0 - - - org.codehaus.plexus - plexus-utils - 4.0.3 - - - org.apache.maven - maven-project - 2.0.4 - - - org.apache.maven - maven-artifact - 2.0.4 - - - org.apache.felix - org.apache.felix.ipojo.metadata - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - - - - - org.apache.felix - ipojo-manipulator-bom - ${project.version} - pom - import - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - -Xdoclint:none - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - - src/main/resources/archetype-resources/** - - - - - org.apache.maven.plugins - maven-dependency-plugin - - - - - - - release - - - - org.apache.maven.plugins - maven-javadoc-plugin - - - - goal - a - Goal: - - - phase - a - Phase: - - - threadSafe - a - Thread Safe: - - - requiresDependencyResolution - a - Requires Dependency Resolution: - - - description - a - Description: - - - - - - attach-javadocs - - jar - - - - - - - - - diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 810483901e..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,10 +0,0 @@ -I. Included Third-Party Software - -II. Used Third-Party Software - -This product uses software developed at -The Codehaus (http://www.codehaus.org) -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 8b13789179..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1 +0,0 @@ - diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java b/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java deleted file mode 100644 index 265077da57..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/ManipulatorMojo.java +++ /dev/null @@ -1,310 +0,0 @@ -/* - * 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.ipojo.plugin; - -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.util.Classpath; -import org.apache.maven.artifact.Artifact; -import org.apache.maven.plugin.AbstractMojo; -import org.apache.maven.plugin.MojoExecutionException; -import org.apache.maven.project.MavenProject; -import org.apache.maven.project.MavenProjectHelper; - -import java.io.ByteArrayInputStream; -import java.io.File; -import java.io.InputStream; -import java.util.Arrays; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.Set; - -/** - * Packages an OSGi jar "bundle" as an "iPOJO bundle". - * - * @author Felix Project Team - * @version $Rev$, $Date$ - * @goal ipojo-bundle - * @phase package - * @requiresDependencyResolution test - * @description manipulate an OSGi bundle jar to build an iPOJO bundle - * @threadSafe - */ -public class ManipulatorMojo extends AbstractMojo { - - /** - * The directory for the generated JAR. - * - * @parameter expression="${project.build.directory}" - * @required - */ - private String m_buildDirectory; - - /** - * The directory containing generated classes. - * - * @parameter expression="${project.build.outputDirectory}" - * @required - * @readonly - */ - private File m_outputDirectory; - - /** - * Location of the metadata file or iPOJO metadata configuration. - * - * @parameter alias="metadata" - */ - private String m_metadata; - - /** - * If set, the manipulated jar will be attached to the project as a separate artifact. - * - * @parameter alias="classifier" expression="${ipojo.classifier}" - */ - private String m_classifier; - - /** - * If set, select the manipulated artifact using this classifier. - * - * @parameter alias="input-classifier" - */ - private String m_inputClassifier; - - /** - * The Maven project. - * - * @parameter expression="${project}" - * @required - * @readonly - */ - private MavenProject m_project; - - /** - * Used for attaching new artifacts. - * - * @component - * @required - */ - private MavenProjectHelper m_helper; - - /** - * Project types which this plugin supports. - * - * @parameter - */ - private List m_supportedProjectTypes = Arrays.asList(new String[]{"bundle", "jar", "war"}); - - /** - * Ignore annotations parameter. - * - * @parameter alias="ignoreAnnotations" default-value="false" - */ - private boolean m_ignoreAnnotations; - - /** - * Ignore embedded XSD parameter. - * - * @parameter alias="IgnoreEmbeddedSchemas" default-value="false" - */ - private boolean m_ignoreEmbeddedXSD; - - private boolean isXML() { - return m_metadata != null && (m_metadata.indexOf('<') > -1); - } - - /** - * Execute method : this method launches the pojoization. - * - * @throws MojoExecutionException : an exception occurs during the manipulation. - * @see org.apache.maven.plugin.AbstractMojo#execute() - */ - public void execute() throws MojoExecutionException { - // ignore project types not supported, useful when the plugin is configured in the parent pom - if (!this.m_supportedProjectTypes.contains(m_project.getArtifact().getType())) { - this.getLog().debug("Ignoring project " - + m_project.getArtifact() + " : type " + m_project.getArtifact().getType() - + " is not supported by iPOJO plugin, supported types are " + this.m_supportedProjectTypes); - return; - } - - initializeSaxDriver(); - - getLog().info("Start bundle manipulation"); - - // Get metadata - // Check if metadata are contained in the configuration - File metadata = null; // Metadata File or directory containing the metadata files. - InputStream is = null; //Use if contained in the configuration - - // Create the ClassPath and classloader. - Set artifacts = m_project.getArtifacts(); - Set urls = new LinkedHashSet(); - File classes = new File(m_project.getBasedir(), "target/classes"); - if (classes.isDirectory()) { - urls.add(classes.getAbsolutePath()); - } - for (Artifact artifact : artifacts) { - File file = artifact.getFile(); - if (file != null && file.isFile()) { - urls.add(file.getAbsolutePath()); - } - } - getLog().debug("Compute classpath: " + urls); - Classpath classpath = new Classpath(urls); - - if (isXML()) { - is = new ByteArrayInputStream(m_metadata.getBytes()); - } else { - // If the metadata is not set, - // first check if ./src/main/ipojo exists, if so look into it. - if (m_metadata == null) { - File m = new File(m_project.getBasedir(), "src/main/ipojo"); - if (m.isDirectory()) { - metadata = m; - getLog().info("Metadata directory : " + metadata.getAbsolutePath()); - } else { - // Else check target/classes/metadata.xml - File meta = new File(m_outputDirectory + File.separator + "metadata.xml"); - if (!meta.exists()) { - // If it still does not exist, try ./metadata.xml - meta = new File(m_project.getBasedir() + File.separator + "metadata.xml"); - } - - if (meta.exists()) { - metadata = meta; - getLog().info("Metadata file : " + metadata.getAbsolutePath()); - } - - // No metadata. - } - } else { - // metadata path set. - File m = new File(m_project.getBasedir(), m_metadata); - if (!m.exists()) { - throw new MojoExecutionException("The metadata file does not exist : " + m.getAbsolutePath()); - } - metadata = m; - if (m.isDirectory()) { - getLog().info("Metadata directory : " + metadata.getAbsolutePath()); - } else { - getLog().info("Metadata file : " + metadata.getAbsolutePath()); - } - } - - if (metadata == null) { - // Verify if annotations are ignored - if (m_ignoreAnnotations) { - getLog().info("No metadata file found - ignoring annotations"); - return; - } else { - getLog().info("No metadata file found - trying to use only annotations"); - } - } - } - - // Get input bundle, we use the already create artifact. - File in = null; - if (m_inputClassifier == null) { - in = m_project.getArtifact().getFile(); - getLog().info("Input Bundle File : " + in.getAbsolutePath()); - if (!in.exists()) { - throw new MojoExecutionException("The specified bundle file does not exist : " + in.getAbsolutePath()); - } - } else { - // Look from attached artifacts. - @SuppressWarnings("unchecked") - List attached = m_project.getAttachedArtifacts(); - for (int i = 0; in == null && attached != null && i < attached.size(); i++) { - Artifact artifact = attached.get(i); - if (artifact.hasClassifier() && m_inputClassifier.equals(artifact.getClassifier())) { - in = artifact.getFile(); - } - } - - if (in == null) { - throw new MojoExecutionException("Cannot find the file to manipulate, " + - "no attached artifact with classifier " + m_inputClassifier); - } - - getLog().info("Input Bundle File : " + in.getAbsolutePath()); - if (!in.exists()) { - throw new MojoExecutionException("The specified bundle file does not exist : " + in.getAbsolutePath()); - } - } - - File out = new File(m_buildDirectory + File.separator + "_out.jar"); - - Reporter reporter = new MavenReporter(getLog()); - Pojoization pojo = new Pojoization(reporter); - if (m_ignoreAnnotations) { - pojo.disableAnnotationProcessing(); - } - if (!m_ignoreEmbeddedXSD) { - pojo.setUseLocalXSD(); - } - - // Executes the pojoization. - if (is == null) { - if (metadata == null) { // No metadata. - pojo.pojoization(in, out, (File) null, classpath.createClassLoader()); // Only annotations - } else { - pojo.pojoization(in, out, metadata, classpath.createClassLoader()); // Metadata set - } - } else { // In-Pom metadata. - pojo.pojoization(in, out, is, classpath.createClassLoader()); - } - - for (int i = 0; i < reporter.getWarnings().size(); i++) { - getLog().warn((String) reporter.getWarnings().get(i)); - } - if (reporter.getErrors().size() > 0) { - throw new MojoExecutionException((String) reporter.getErrors().get(0)); - } - - if (m_classifier != null) { - // The user want to attach the resulting jar - // Do not delete in File - m_helper.attachArtifact(m_project, "jar", m_classifier, out); - } else { - // Usual behavior - if (in.delete()) { - if (!out.renameTo(in)) { - getLog().warn("Cannot rename the manipulated jar file"); - } - } else { - getLog().warn("Cannot delete the input jar file"); - } - } - getLog().info("Bundle manipulation - SUCCESS"); - } - - /** - * If Maven runs with Java 1.4, we should use the Maven Xerces. - * To achieve that, we set the org.xml.sax.driver property. - * Otherwise, the JVM sets the org.xml.sax.driver property. - */ - private void initializeSaxDriver() { - String version = (String) System.getProperty("java.vm.version"); - if (version.startsWith("1.4")) { - getLog().info("Set the Sax driver to org.apache.xerces.parsers.SAXParser"); - System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser"); - } - } - -} diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/MavenReporter.java b/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/MavenReporter.java deleted file mode 100644 index 6afdf97b40..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/java/org/apache/felix/ipojo/plugin/MavenReporter.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.ipojo.plugin; - -import org.apache.felix.ipojo.manipulator.reporter.EmptyReporter; -import org.apache.maven.plugin.logging.Log; - -/** - * A {@code MavenReporter} wraps a maven logging system into an iPOJO Reporter. - * - * @author Felix Project Team - */ -public class MavenReporter extends EmptyReporter { - - /** - * Maven logger. - */ - private Log log; - - public MavenReporter(Log log) { - this.log = log; - } - - @Override - public void trace(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable t = getThrowable(args); - if (t != null) { - log.debug(formatted, t); - } else { - log.debug(formatted); - } - } - - @Override - public void info(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable t = getThrowable(args); - if (t != null) { - log.info(formatted, t); - } else { - log.info(formatted); - } - } - - @Override - public void warn(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable t = getThrowable(args); - if (t != null) { - log.warn(formatted, t); - } else { - log.warn(formatted); - } - getWarnings().add(formatted); - } - - @Override - public void error(String message, Object... args) { - String formatted = String.format(message, getMessageArguments(args)); - Throwable t = getThrowable(args); - if (t != null) { - log.error(formatted, t); - } else { - log.error(formatted); - } - getErrors().add(formatted); - } -} diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml deleted file mode 100644 index 513ca70bf5..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/META-INF/maven/archetype-metadata.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - src/main/java - - **/*.java - **/*.txt - - - - src/main/resources - - **/*.xml - - - - - - *.properties - - - - - diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/bundle.properties b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/bundle.properties deleted file mode 100644 index 9a167ce17a..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/bundle.properties +++ /dev/null @@ -1,4 +0,0 @@ -# Configure the created bundle -private.packages=${package} -import.packages=* -export.package=* \ No newline at end of file diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/pom.xml b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/pom.xml deleted file mode 100644 index c66de92d67..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/pom.xml +++ /dev/null @@ -1,75 +0,0 @@ - - 4.0.0 - bundle - ${groupId} - ${artifactId} - ${version} - - ${artifactId} - - - - org.apache.felix - org.apache.felix.ipojo.annotations - 1.6.0 - - - - - - - org.apache.felix - maven-bundle-plugin - 2.1.0 - true - - - ${project.artifactId} - ${private.packages} - ${import.packages} - ${export.packages} - - - - - org.apache.felix - maven-ipojo-plugin - - - - ipojo-bundle - - - - - - maven-compiler-plugin - 2.3.2 - - 1.5 - 1.5 - - - - - org.codehaus.mojo - properties-maven-plugin - 1.0-alpha-2 - - - initialize - - read-project-properties - - - - bundle.properties - - - - - - - - diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java deleted file mode 100644 index 9ee85e0ebd..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/HelloComponent.java +++ /dev/null @@ -1,14 +0,0 @@ -package ${package}; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; - -@Component -@Instantiate -public class HelloComponent { - - public HelloComponent() { - System.out.println("Hello ${artifactId}"); - } - -} diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/source.txt b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/source.txt deleted file mode 100644 index 019875636e..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/java/source.txt +++ /dev/null @@ -1 +0,0 @@ -PUT YOUR SOURCE FILES HERE \ No newline at end of file diff --git a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml b/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml deleted file mode 100644 index 456c9e68d0..0000000000 --- a/ipojo/manipulator/maven-ipojo-plugin/src/main/resources/archetype-resources/src/main/resources/metadata.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - \ No newline at end of file diff --git a/ipojo/manipulator/online-manipulator/changelog.txt b/ipojo/manipulator/online-manipulator/changelog.txt deleted file mode 100644 index 54a513f756..0000000000 --- a/ipojo/manipulator/online-manipulator/changelog.txt +++ /dev/null @@ -1,133 +0,0 @@ -Changes from the 1.12.0 to 1.12.1 ---------------------------------- - -** Bug - * [FELIX-4612] - @PostRegistration is not being called - * [FELIX-4620] - Warning should be removed when @Configuration is used - * [FELIX-4668] - Can not use @Stereotype annotated annotation from another bundle (unless its package is included or re-exported) - * [FELIX-4725] - Inner Class Manipulation uses the wrong 'access level' - -Changes from the 1.11.2 to 1.12.0 ---------------------------------- - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - -Changes from the 1.11.1 to 1.11.2 ---------------------------------- - - ** Bug - * [FELIX-4453] - Introduce manipulator BOM (Bill of Material) - - ** Improvement - * [FELIX-4454] - Online manipulator should be able to take advantage of Stereotypes - -Changes from the 1.11.0 to 1.11.1 ---------------------------------- - -** Bug - * [FELIX-4340] - Flex iPOJO online manipulator error if metadata.xml file not supplied - * [FELIX-4347] - should ignore inner classes that are assigned to static fields - -Changes from the 1.10.1 to 1.11.0 ---------------------------------- - -** Bug - * [FELIX-4021] - maven-ipojo-plugin fails on WAR packaging - * [FELIX-4219] - Variables named not stored in bytecode for constructors during manipulation - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - -** Improvement - * [FELIX-4112] - Add meta annotations for handler description - * [FELIX-4269] - Introduce an enumeration to configure binding policy from the annotation - -** Task - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4155] - Update bnd-ipojo-plugin for bndlib 2.x - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4253] - Add methods from inner classes in the metadata collected during the manipulation - * [FELIX-4254] - Specify the method id of methods from inner class - * [FELIX-4255] - Extend the inner class manipulation to allow method interception - * [FELIX-4256] - Avoid manipulation native and static methods from inner classes - -Changes from the 1.10.0 to 1.10.1 ---------------------------------- - -** Bug - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4091] - Bnd iPOJO Plugin only browse classes annotated with some iPOJO annotations - * [FELIX-4093] - Dependency is ignored if @Bind does not respect naming pattern - * [FELIX-4110] - @ServiceProperty and @StaticServiceProperty are missing the immutable attribute - -** Improvement - * [FELIX-4094] - Recognize add/remove method naming pattern - -** New Feature - * [FELIX-4095] - Add CDI-like @Stereotype - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - -Changes from the 1.8.6 to 1.10.0 --------------------------------- - -** Bug - * [FELIX-3827] - Error in bbd-ipojo-plugin of manipulating jar with embedded dependencies with maven bundle plugin + bnd-ipojo-plugin - * [FELIX-3900] - @HandlerDeclaration do not convert DOM Attributes to iPOJO Attributes correctly - * [FELIX-3938] - maven-ipojo-plugin does not behave as bnd-ipojo-plugin - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4027] - The iPOJO Ant task requires org.objectweb.asm.tree - * [FELIX-4046] - Inner class manipulation fails with expanded frames - * [FELIX-4052] - Instance declaration not created correctly when using @Instantiate if the @Component specifies a name - -** Improvement - * [FELIX-3286] - Update POM to use the new parent - * [FELIX-3452] - Extending maven-ipojo-plugin with directoryManipulation support. - * [FELIX-3749] - Refactor the manipulator for better (and extensible) annotation support - * [FELIX-3837] - PojoizationPlugin should be more extensible - * [FELIX-3901] - Avoid converting Xml namespace declaration with @HandlerDeclaration - * [FELIX-3927] - Exclude iPOJO 2.0 packages during manipulation - -** New Feature - * [FELIX-3699] - Allow annotations to handle custom component definitions. - * [FELIX-4059] - Provide a CLI tool to manipulate iPOJO bundles - -** Task - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3976] - Move the online manipulator out of the core bundle - -Changes from the 1.4.2 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from the 1.4.0 to 1.4.2 -------------------------------- -** Bug - * [FELIX-1518] - iPOJO manipulator is really slow even when annotation are ignored - - -Version 1.4.0 -------------- -** Improvement - * Update parent pom - * Initial commit - - diff --git a/ipojo/manipulator/online-manipulator/pom.xml b/ipojo/manipulator/online-manipulator/pom.xml deleted file mode 100644 index d768236b51..0000000000 --- a/ipojo/manipulator/online-manipulator/pom.xml +++ /dev/null @@ -1,203 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - bundle - Apache Felix iPOJO - Online Manipulator - org.apache.felix.ipojo.manipulator.online - 1.13.1-SNAPSHOT - - - iPOJO online manipulator allowing install time manipulation of iPOJO bundle. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/apache-felix-ipojo-online-manipulator.html - - - - [1.12.1,2.0.0) - ${project.version} - 9.6 - - - - - org.osgi - org.osgi.core - 4.3.1 - provided - - - org.osgi - org.osgi.compendium - 4.0.0 - provided - - - org.apache.felix - org.apache.felix.ipojo.metadata - - - org.apache.felix - org.apache.felix.ipojo.manipulator - - - org.apache.felix - org.apache.felix.ipojo.annotations - - - org.ow2.asm - asm - ${asm.version} - - - org.ow2.asm - asm-tree - ${asm.version} - - - org.ow2.asm - asm-commons - ${asm.version} - - - org.ow2.asm - asm-util - ${asm.version} - - - org.mockito - mockito-all - 1.9.5 - test - - - - - - - org.apache.felix - ipojo-manipulator-bom - ${project.version} - pom - import - - - - - - - - src/main/resources - true - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - 8 - 8 - - - - org.apache.felix - maven-bundle-plugin - 5.1.9 - true - - - ${project.artifactId} - org.apache.felix.ipojo.online.manipulator - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-tools/apache-felix-ipojo-online-manipulator.html - - - org.apache.felix.ipojo.manipulation*; version="${ipojo.manipulator.version}", - org.apache.felix.ipojo.xml.parser; version="${ipojo.manipulator.version}", - org.apache.felix.ipojo.manipulator*; version="${ipojo.manipulator.version}", - org.apache.felix.ipojo.annotations*; version="${ipojo.manipulator.version}", - - - org.objectweb.asm, - org.objectweb.asm.commons, - org.objectweb.asm.signature, - org.objectweb.asm.tree*, - org.objectweb.asm.util, - org.apache.felix.ipojo.online.manipulator - - !sun.io, org.osgi.framework;version=1.3, * - - - - - - org.apache.felix - maven-ipojo-plugin - ${project.version} - - - - ipojo-bundle - - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - src/main/resources/META-INF/** - - - - - - diff --git a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 844c77ecee..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,21 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -This product includes software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2007). -Licensed under the Apache License 2.0. - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 -- BSD License diff --git a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/LICENSE b/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index 194131d987..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Online Manipulator: - -The Apache Felix iPOJO Online Manipulator includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 016e60dffa..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,3 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. diff --git a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BridgeClassLoader.java b/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BridgeClassLoader.java deleted file mode 100644 index 28987a80fb..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BridgeClassLoader.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.online.manipulator; - -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; - -import java.io.File; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLClassLoader; - -/** - * A classloader trying to load classes from a given jar files and then from bundles. - * This classloader must only be used for the iPOJO manipulator (in order to compute bytecode frames). - */ -public class BridgeClassLoader extends ClassLoader { - - private final URLClassLoader m_loader; - private final BundleContext m_context; - - public BridgeClassLoader(File original, BundleContext context) throws MalformedURLException { - m_loader = new URLClassLoader(new URL[]{original.toURI().toURL()}, null); - m_context = context; - } - - @Override - public Class loadClass(String name) throws ClassNotFoundException { - // Try to load it using the url classloader - try { - return m_loader.loadClass(name); - } catch (ClassNotFoundException e) { - // Not there, try somewhere else. - } - - for (Bundle bundle : m_context.getBundles()) { - if (bundle.getState() >= Bundle.RESOLVED) { - try { - return bundle.loadClass(name); - } catch (ClassNotFoundException e) { - // Try next one. - } - } - } - - // Still nothing, delegate to parent - return super.loadClass(name); - } -} diff --git a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BundleAwareJarFileResourceStore.java b/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BundleAwareJarFileResourceStore.java deleted file mode 100644 index 0b8f612ae4..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/BundleAwareJarFileResourceStore.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.online.manipulator; - -import static java.lang.String.format; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.List; -import java.util.jar.JarFile; - -import org.apache.felix.ipojo.manipulator.render.MetadataRenderer; -import org.apache.felix.ipojo.manipulator.store.JarFileResourceStore; -import org.apache.felix.ipojo.manipulator.store.builder.DefaultManifestBuilder; -import org.apache.felix.ipojo.manipulator.util.Streams; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.wiring.BundleWiring; - -/** - * User: guillaume - * Date: 28/02/2014 - * Time: 19:16 - */ -public class BundleAwareJarFileResourceStore extends JarFileResourceStore { - - private final BundleContext bundleContext; - - /** - * @param source original Bundle - * @param target File where the updated Bundle will be outputted - * @throws java.io.IOException if there is an error retrieving the Manifest from the original JarFile - */ - public BundleAwareJarFileResourceStore(final JarFile source, - final File target, - final BundleContext bundleContext) throws IOException { - super(source, target); - this.bundleContext = bundleContext; - DefaultManifestBuilder manifestBuilder = new DefaultManifestBuilder(); - manifestBuilder.setMetadataRenderer(new MetadataRenderer()); - setManifestBuilder(manifestBuilder); - } - - @Override - public byte[] read(final String path) throws IOException { - try { - return super.read(path); - } catch (IOException e) { - // An IOException is thrown when no resource can be found - // We swallow this exception and try to load the resource from the installed bundles - } - - String directory = path.substring(0, path.lastIndexOf('/')); - String filename = path.substring(path.lastIndexOf('/') + 1); - - for (Bundle bundle : bundleContext.getBundles()) { - - BundleWiring wiring = bundle.adapt(BundleWiring.class); - List entries = wiring.findEntries(directory, filename, 0); - for (URL url : entries) { - try { - return Streams.readBytes(url.openStream()); - } catch (IOException e) { - // Ignore and move to the next source - e.printStackTrace(); - } - } - - } - - throw new IOException(format("Could not find %s in currently available bundles", path)); - } -} diff --git a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/Files.java b/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/Files.java deleted file mode 100644 index f64565136a..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/Files.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.online.manipulator; - -import static org.apache.felix.ipojo.manipulator.util.Streams.close; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; - -/** - * User: guillaume - * Date: 04/03/2014 - * Time: 15:33 - */ -public class Files { - - public static void dump(URL url, File target) throws IOException { - dump(url.openStream(), target); - } - - public static void dump(InputStream stream, File target) throws IOException { - BufferedInputStream in = new BufferedInputStream(stream); - FileOutputStream file = new FileOutputStream(target); - BufferedOutputStream out = new BufferedOutputStream(file); - int i; - while ((i = in.read()) != -1) { - out.write(i); - } - out.flush(); - close(in, out); - } -} diff --git a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/IPOJOURLHandler.java b/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/IPOJOURLHandler.java deleted file mode 100644 index dc0e838a00..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/IPOJOURLHandler.java +++ /dev/null @@ -1,313 +0,0 @@ -/* - * 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.ipojo.online.manipulator; - -import static java.lang.String.format; -import static org.apache.felix.ipojo.online.manipulator.Files.dump; -import static org.osgi.service.log.LogService.LOG_DEBUG; -import static org.osgi.service.log.LogService.LOG_WARNING; -import static org.osgi.service.url.URLConstants.URL_HANDLER_PROTOCOL; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Invalidate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.StaticServiceProperty; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.manipulator.ManipulationVisitor; -import org.apache.felix.ipojo.manipulator.Reporter; -import org.apache.felix.ipojo.manipulator.ResourceStore; -import org.apache.felix.ipojo.manipulator.metadata.CompositeMetadataProvider; -import org.apache.felix.ipojo.manipulator.metadata.FileMetadataProvider; -import org.apache.felix.ipojo.manipulator.reporter.SystemReporter; -import org.apache.felix.ipojo.manipulator.spi.ModuleProvider; -import org.apache.felix.ipojo.manipulator.Pojoization; -import org.apache.felix.ipojo.manipulator.spi.Module; -import org.apache.felix.ipojo.manipulator.spi.provider.CompositeModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.provider.CoreModuleProvider; -import org.apache.felix.ipojo.manipulator.spi.provider.DefaultModuleProvider; -import org.apache.felix.ipojo.manipulator.visitor.check.CheckFieldConsistencyVisitor; -import org.apache.felix.ipojo.manipulator.visitor.writer.ManipulatedResourcesWriter; -import org.osgi.framework.BundleContext; -import org.osgi.service.log.LogService; -import org.osgi.service.url.AbstractURLStreamHandlerService; -import org.osgi.service.url.URLStreamHandlerService; - -import java.io.File; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.URLConnection; -import java.util.ArrayList; -import java.util.List; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -/** - * iPOJO URL Handler allowing installation time manipulation. - * - * When a bundle is installed with the {@literal ipojo} URL prefix, the referred bundle is - * manipulated by this handler. - - * The {@literal metadata.xml} file can either be provided: - *
    - *
  • Inside the bundle, this handler will look for {@literal /metadata.xml} (at the root of the bundle) - * or in {@literal /META-INF/metadata.xml}
  • - *
  • Through the URL using the following URL format: {@literal ipojo:URL_BUNDLE!URL_METADATA}, notice - * the {@literal !} used as separator
  • - *
- * - * Examples of valid iPojo's URLs: - *
- *     ipojo:file:///tmp/bundle.jar
- *     ipojo:/http://www.example.org/bundle.jar
- *     ipojo://mvn://com.acme/bundle/1.0.0  (with Maven Pax Url support installed)
- *     ipojo:file:///tmp/bundle.jar!file:///tmp2/metadata.xml
- * 
- * - * Notice that trailing {@literal '/'} (or {@literal '//'}) after {@literal ipojo:} are optional. - * - * @author Felix Project Team - */ -@Component(publicFactory = false, - immediate = true) -@Provides(specifications = URLStreamHandlerService.class, - properties = @StaticServiceProperty(name = URL_HANDLER_PROTOCOL, - value = "ipojo", - type = "java.lang.String")) -@Instantiate -public class IPOJOURLHandler extends AbstractURLStreamHandlerService { - - public static final String IPOJO_SCHEME = "ipojo:"; - - private final BundleContext m_context; - - /** - * The directory storing manipulated bundles. - */ - private final File m_temp; - - private List m_modules = new ArrayList(); - - //@Requires(optional = true, defaultimplementation = SystemLogService.class) - // TODO Change this once NPE is fixed - private LogService logger = new SystemLogService(); - - @Bind(optional = true, aggregate = true) - public void bindModule(Module module) { - m_modules.add(module); - } - - @Unbind - public void unbindModule(Module module) { - m_modules.remove(module); - } - - /** - * Creates a IPOJOURLHandler. - * Gets the bundle context and create the working - * directory. - * - * @param bundleContext the bundle context - */ - public IPOJOURLHandler(BundleContext bundleContext) { - this(bundleContext, bundleContext.getDataFile("temp")); - } - - public IPOJOURLHandler(BundleContext context, File work) { - m_context = context; - m_temp = work; - if (!m_temp.exists()) { - m_temp.mkdir(); - } - } - - /** - * Stops the URL handler: - * Deletes the working directory. - */ - @Invalidate - public void stop() { - File[] files = m_temp.listFiles(); - if (files != null) { - for (int i = 0; i < files.length; i++) { - files[i].delete(); - } - } - m_temp.delete(); - } - - /** - * Opens a connection using the ipojo url handler. - * This methods parses the URL and manipulate the given bundle. - * - * @param url the url. - * @return the URL connection on the manipulated bundle - * @throws java.io.IOException occurs when the bundle cannot be either downloaded, or manipulated or - * installed correctly. - * @see org.osgi.service.url.AbstractURLStreamHandlerService#openConnection(java.net.URL) - */ - public URLConnection openConnection(URL url) throws IOException { - logger.log(LOG_DEBUG, format("Processing URL %s", url)); - String full = removeScheme(url); - - // Now full is like : URL!URL or URL - String[] urls = full.split("!"); - URL bundleURL = null; - URL metadataURL = null; - if (urls.length == 1) { - // URL form - bundleURL = new URL(urls[0]); - } else if (urls.length == 2) { - // URL!URL form - bundleURL = new URL(urls[0]); - metadataURL = new URL(urls[1]); - } else { - throw new MalformedURLException("The iPOJO url is not formatted correctly, ipojo:bundle_url[!metadata_url] expected"); - } - - logger.log(LOG_DEBUG, format("Extracted URL %s", url)); - - // Dump the referenced bundle on disk - File original = File.createTempFile("original-", ".jar", m_temp); - dump(bundleURL.openStream(), original); - - JarFile jf = new JarFile(original); - - File metadata = null; - if (metadataURL != null) { - metadata = File.createTempFile("ipojo-", ".xml", m_temp); - dump(metadataURL, metadata); - } else { - // Check that the metadata are in the jar file - metadata = findMetadata(jf); - } - - Reporter reporter = new SystemReporter(); - File out = File.createTempFile("ipojo-", ".jar", m_temp); - - ResourceStore store = new BundleAwareJarFileResourceStore(jf, out, m_context); - - CompositeMetadataProvider composite = new CompositeMetadataProvider(reporter); - if (metadata != null) { - FileMetadataProvider provider = new FileMetadataProvider(metadata, reporter); - composite.addMetadataProvider(provider); - } - - ClassLoader classloader = new BridgeClassLoader(original, m_context); - // Pojoization - Pojoization pojoizator = new Pojoization(createModuleProvider()); - try { - pojoizator.pojoization(store, composite, createVisitor(store, reporter), classloader); - } catch (Exception e) { - if (!pojoizator.getErrors().isEmpty()) { - throw new IOException("Errors occurred during the manipulation : " + pojoizator.getErrors(), e); - } - e.printStackTrace(); - throw new IOException("Cannot manipulate the Url: " + url, e); - } - - if (!pojoizator.getErrors().isEmpty()) { - throw new IOException("Errors occurred during the manipulation : " + pojoizator.getErrors()); - } - if (!pojoizator.getWarnings().isEmpty()) { - logger.log(LOG_WARNING, format("Warnings occurred during the manipulation %s", pojoizator.getWarnings())); - } - - logger.log(LOG_DEBUG, format("Manipulation done %s", out.exists())); - - // Cleanup - if (metadata != null) { - metadata.delete(); - } - original.delete(); - out.deleteOnExit(); - - // Returns the URL Connection - return out.toURI().toURL().openConnection(); - - - } - - private String removeScheme(final URL url) { - String full = url.toExternalForm(); - // Remove ipojo: - if (full.startsWith(IPOJO_SCHEME)) { - full = full.substring(IPOJO_SCHEME.length()); - } - // Remove '/' or '//' - while (full.startsWith("/")) { - full = full.substring(1); - } - - return full.trim(); - } - - private ManipulationVisitor createVisitor(ResourceStore store, Reporter reporter) { - ManipulatedResourcesWriter writer = new ManipulatedResourcesWriter(); - writer.setReporter(reporter); - writer.setResourceStore(store); - - CheckFieldConsistencyVisitor checkFieldConsistencyVisitor = new CheckFieldConsistencyVisitor(writer); - checkFieldConsistencyVisitor.setReporter(reporter); - return checkFieldConsistencyVisitor; - } - - - private ModuleProvider createModuleProvider() { - return new CompositeModuleProvider( - new CoreModuleProvider(), - new DefaultModuleProvider(m_modules) - ); - } - - /** - * Looks for the metadata.xml file in the jar file. - * Two locations are checked: - *
    - *
  1. the root of the jar file
  2. - *
  3. the META-INF directory
  4. - *
- * - * @param jar the jar file - * @return the found file or null if not found. - * @throws java.io.IOException occurs when the Jar file cannot be read. - */ - private File findMetadata(JarFile jar) throws IOException { - JarEntry je = jar.getJarEntry("metadata.xml"); - if (je == null) { - je = jar.getJarEntry("META-INF/metadata.xml"); - } - - if (je == null) { - logger.log(LOG_DEBUG, "Metadata file not found, use annotations only."); - return null; // Not Found, use annotation only - } else { - logger.log(LOG_DEBUG, format("Metadata file found at %s", je.getName())); - File metadata = File.createTempFile("ipojo-", ".xml", m_temp); - dump(jar.getInputStream(je), metadata); - logger.log(LOG_DEBUG, format("Metadata file saved at %s", metadata)); - return metadata; - } - - } - -} diff --git a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/SystemLogService.java b/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/SystemLogService.java deleted file mode 100644 index f147d84c76..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/java/org/apache/felix/ipojo/online/manipulator/SystemLogService.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.online.manipulator; - -import static java.lang.String.format; - -import java.io.PrintStream; - -import org.osgi.framework.ServiceReference; -import org.osgi.service.log.LogService; - -/** -* Default implementation based on System.out -*/ -public class SystemLogService implements LogService { - - public void log(final int level, final String message) { - log(null, level, message, null); - } - - public void log(final int level, final String message, final Throwable throwable) { - log(null, level, message, throwable); - } - - public void log(final ServiceReference reference, final int level, final String message) { - log(null, level, message, null); - } - - public void log(final ServiceReference reference, final int level, final String message, final Throwable throwable) { - PrintStream stream = System.out; - if (level >= LogService.LOG_WARNING) { - stream = System.err; - } - - String formatted = format("%s %s", asString(level), message); - - if (reference != null) { - formatted = format("[%s] %s", reference.getBundle().getSymbolicName(), formatted); - } - - // Print the message - stream.println(formatted); - if (throwable != null) { - throwable.printStackTrace(stream); - } - } - - private static String asString(final int level) { - String levelStr = "?"; - switch (level) { - case LOG_DEBUG: - levelStr = "D"; - break; - case LOG_INFO: - levelStr = "I"; - break; - case LOG_WARNING: - levelStr = "W"; - break; - case LOG_ERROR: - levelStr = "E"; - break; - } - return levelStr; - } -} diff --git a/ipojo/manipulator/online-manipulator/src/main/resources/META-INF/constants.properties b/ipojo/manipulator/online-manipulator/src/main/resources/META-INF/constants.properties deleted file mode 100644 index d070319aec..0000000000 --- a/ipojo/manipulator/online-manipulator/src/main/resources/META-INF/constants.properties +++ /dev/null @@ -1,22 +0,0 @@ -# -# 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. -# - -# This file define the different constant we use in the manipulator. This file is filtered by Maven. -manipulator.version=${project.version} -ipojo.import.packages=${ipojo.import.packages} \ No newline at end of file diff --git a/ipojo/manipulator/pom.xml b/ipojo/manipulator/pom.xml deleted file mode 100644 index e696c695e0..0000000000 --- a/ipojo/manipulator/pom.xml +++ /dev/null @@ -1,68 +0,0 @@ - - - - org.apache.felix - felix-parent - 8 - - 4.0.0 - org.apache.felix.ipojo.manipulator-project - 1.13.1-SNAPSHOT - Apache Felix iPOJO Manipulator Project - pom - - - The iPOJO Manipulator project contains the iPOJO packaging process and - several front-ends for Ant, Maven and BND. - - - - manipulator-bom - annotations - manipulator - manipulator-it - ipojo-ant-task - maven-ipojo-plugin - bnd-ipojo-plugin - online-manipulator - - - - scm:git:https://github.com/apache/felix-dev.git - scm:git:https://github.com/apache/felix-dev.git - https://gitbox.apache.org/repos/asf?p=felix-dev.git - HEAD - - - - - - maven-release-plugin - - https://svn.apache.org/repos/asf/felix/releases - false - deploy - -Papache-release - - - - - - diff --git a/ipojo/manipulator/src/main/appended-resources/META-INF/NOTICE b/ipojo/manipulator/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/metadata/changelog.txt b/ipojo/metadata/changelog.txt deleted file mode 100644 index 3c6dc740a4..0000000000 --- a/ipojo/metadata/changelog.txt +++ /dev/null @@ -1,29 +0,0 @@ -Changes from 1.6.0 to 1.6.1 ---------------------------- -** Improvement - * [FELIX-3131] - Elements and attributes should conserve the insertion order - - -Changes from 1.4.0 to 1.6.0 ---------------------------- -** Improvement - * [FELIX-3131] - Elements and attributes should conserve the insertion order - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Improvement - * Update parent pom - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Improvement - * [FELIX-795] - Improve metadata and manipulator performance - -Changes from 0.8.0 to 1.0.0 ---------------------------- -** Improvement - * Update to latest version - -Version 0.8.0 -------------- - * Initial release diff --git a/ipojo/metadata/pom.xml b/ipojo/metadata/pom.xml deleted file mode 100644 index e538d36c1e..0000000000 --- a/ipojo/metadata/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.metadata - - 1.6.1-SNAPSHOT - bundle - Apache Felix iPOJO Metadata - - - iPOJO internal metadata model. - - - - - - org.apache.felix - maven-bundle-plugin - 5.1.1 - true - - - ${project.artifactId} - iPOJO Metadata - The Apache Software Foundation - iPOJO Metadata - org.apache.felix.ipojo.metadata - - NONE - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 8 - 8 - - - - - diff --git a/ipojo/metadata/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/metadata/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index 05c68c0f3a..0000000000 --- a/ipojo/metadata/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,10 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -The Apache Software Foundation (http://www.apache.org/). -Licensed under the Apache License 2.0. - -II. Used Third-Party Software - -III. Overall License Summary -- Apache License 2.0 diff --git a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java deleted file mode 100644 index 69100688bd..0000000000 --- a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Attribute.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.metadata; - -/** - * An attribute is a key-value pair. It represents the attribute - * of XML elements. - * @author Felix Project Team - */ -public class Attribute { - - /** - * The name of the attribute. - */ - private String m_name; - - /** - * The value of the attribute. - */ - private String m_value; - - /** - * The namespace of the attribute. - */ - private String m_nameSpace; - - /** - * Creates an attribute. - * @param name the name of the attribute. - * @param value the value of the attribute. - */ - public Attribute(String name, String value) { - m_name = name.toLowerCase(); - m_value = value; - } - - /** - * Creates an attribute. - * @param name the name of the attribute. - * @param value the value of the attribute. - * @param ns the namespace of the attribute. - */ - public Attribute(String name, String ns, String value) { - m_name = name.toLowerCase(); - m_value = value; - if (ns != null && ns.length() > 0) { - m_nameSpace = ns; - } - } - - /** - * Gets the attribute name. - * @return the name - */ - public String getName() { - return m_name; - } - - /** - * Gets attribute value. - * @return the value - */ - public String getValue() { - return m_value; - } - - /** - * Gets attribute namespace. - * @return the namespace - */ - public String getNameSpace() { - return m_nameSpace; - } - -} diff --git a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java b/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java deleted file mode 100644 index 85e5a47190..0000000000 --- a/ipojo/metadata/src/main/java/org/apache/felix/ipojo/metadata/Element.java +++ /dev/null @@ -1,400 +0,0 @@ -/* - * 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.ipojo.metadata; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.Iterator; -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; -import java.util.Set; - -/** - * An element represents an XML Element. - * It contains a name, a namepace, {@link Attribute} objects - * and sub-elements. This class is used to parse iPOJO metadata. - * @author Felix Project Team - */ -public class Element { - - /** - * The name of the element. - */ - private String m_name; - - /** - * The namespace of the element. - */ - private String m_nameSpace; - - /** - * The map of attributes of the element (attribute name -> {@link Attribute}). - * The map key is the qualified name of the attribute (ns:name) - * The value is the attribute object. - */ - private Map m_attributes = new LinkedHashMap(); - - /** - * The map of the sub-element of the element (element name -> {@link Element}. - * The map key is the element qualified name (ns:name). - * The value is the array of element of this name. - */ - private Map m_elements = new LinkedHashMap(); - - /** - * Creates an Element. - * @param name the name of the element - * @param ns the namespace of the element - */ - public Element(String name, String ns) { - m_name = name.toLowerCase(); - if (ns != null && ns.length() > 0) { - m_nameSpace = ns.toLowerCase(); - } - } - - /** - * Gets sub-elements. - * If no sub-elements, an empty array is returned. - * @return the sub elements - */ - public Element[] getElements() { - Collection col = m_elements.values(); - Iterator it = col.iterator(); - List list = new ArrayList(); - while (it.hasNext()) { - Element[] v = (Element[]) it.next(); - for (int i = 0; i < v.length; i++) { - list.add(v[i]); - } - } - return (Element[]) list.toArray(new Element[list.size()]); - } - - /** - * Gets element attributes. - * If no attributes, an empty array is returned. - * @return the attributes - */ - public Attribute[] getAttributes() { - return (Attribute[]) m_attributes.values().toArray(new Attribute[0]); - } - - /** - * Gets element name. - * @return the name of the element - */ - public String getName() { - return m_name; - } - - /** - * Gets element namespace. - * @return the namespace of the element - */ - public String getNameSpace() { - return m_nameSpace; - } - - /** - * Returns the value of the attribute given in parameter. - * @param name the name of the searched attribute - * @return the value of the attribute given in parameter, - * null if the attribute does not exist - */ - public String getAttribute(String name) { - name = name.toLowerCase(); - Attribute att = (Attribute) m_attributes.get(name); - if (att == null) { - return null; - } else { - return att.getValue(); - } - } - - /** - * Returns the value of the attribute "name" of the namespace "ns". - * @param name the name of the attribute to find - * @param ns the namespace of the attribute to find - * @return the String value of the attribute, or - * null if the attribute is not found. - */ - public String getAttribute(String name, String ns) { - name = ns.toLowerCase() + ":" + name.toLowerCase(); - return getAttribute(name); - } - - /** - * Gets the qualified name of the current element. - * @return the qualified name of the current element. - */ - private String getQualifiedName() { - if (m_nameSpace == null) { - return m_name; - } else { - return m_nameSpace + ":" + m_name; - } - } - - /** - * Adds a sub-element. - * @param elem the element to add - */ - public void addElement(Element elem) { - Element[] array = (Element[]) m_elements.get(elem.getQualifiedName()); - if (array == null) { - m_elements.put(elem.getQualifiedName(), new Element[] {elem}); - } else { - Element[] newElementsList = new Element[array.length + 1]; - System.arraycopy(array, 0, newElementsList, 0, array.length); - newElementsList[array.length] = elem; - m_elements.put(elem.getQualifiedName(), newElementsList); - } - } - - /** - * Removes a sub-element. - * @param elem the element to remove - */ - public void removeElement(Element elem) { - Element[] array = (Element[]) m_elements.get(elem.getQualifiedName()); - if (array == null) { - return; - } else { - int idx = -1; - for (int i = 0; i < array.length; i++) { - if (array[i] == elem) { - idx = i; - break; - } - } - - if (idx >= 0) { - if ((array.length - 1) == 0) { - m_elements.remove(elem.getQualifiedName()); - } else { - Element[] newElementsList = new Element[array.length - 1]; - System.arraycopy(array, 0, newElementsList, 0, idx); - if (idx < newElementsList.length) { - System.arraycopy(array, idx + 1, newElementsList, idx, newElementsList.length - idx); - } - m_elements.put(elem.getQualifiedName(), newElementsList); // Update the stored list. - } - } - } - } - - /** - * Adds a attribute. - * @param att the attribute to add - */ - public void addAttribute(Attribute att) { - String name = att.getName().toLowerCase(); - if (att.getNameSpace() != null) { - name = att.getNameSpace().toLowerCase() + ":" + name; - } - m_attributes.put(name, att); - } - - /** - * Removes an attribute. - * @param att the attribute to remove - */ - public void removeAttribute(Attribute att) { - String name = att.getName(); - if (att.getNameSpace() != null) { - name = att.getNameSpace() + ":" + name; - } - m_attributes.remove(name); - } - - /** - * Gets the elements array of the element type given in parameter. - * This method looks for an empty namespace. - * @param name the type of the element to find (element name) - * @return the resulting element array (null if the search failed) - */ - public Element[] getElements(String name) { - Element[] elems = (Element[]) m_elements.get(name.toLowerCase()); - return elems; - } - - /** - * Gets the elements array of the element type given in parameter. - * @param name the type of the element to find (element name) - * @param ns the namespace of the element - * @return the resulting element array (null if the search failed) - */ - public Element[] getElements(String name, String ns) { - if (ns == null || ns.length() == 0) { - return getElements(name); - } - name = ns + ":" + name; - return getElements(name); - } - - /** - * Does the element contain a sub-element of the type given in parameter. - * @param name the type of the element to check. - * @return true if the element contains an element of the type "name" - */ - public boolean containsElement(String name) { - return m_elements.containsKey(name.toLowerCase()); - } - - /** - * Does the element contain a sub-element of the type given in parameter. - * @param name the type of the element to check. - * @param ns the namespace of the element to check. - * @return true if the element contains an element of the type "name" - */ - public boolean containsElement(String name, String ns) { - if (ns != null && ns.length() != 0) { - name = ns + ":" + name; - } - return containsElement(name); - } - - /** - * Does the element contain an attribute of the name given in parameter. - * @param name the name of the element - * @return true if the element contains an attribute of the type "name" - */ - public boolean containsAttribute(String name) { - return m_attributes.containsKey(name.toLowerCase()); - } - - /** - * Gets the XML form of this element. - * @return the XML snippet representing this element. - */ - public String toXMLString() { - return toXMLString(0); - } - - /** - * Internal method to get XML form of an element. - * @param indent the indentation to used. - * @return the XML snippet representing this element. - */ - private String toXMLString(int indent) { - StringBuffer xml = new StringBuffer(); - - StringBuffer tabs = new StringBuffer(); - for (int j = 0; j < indent; j++) { - tabs.append("\t"); - } - - xml.append(tabs); - if (m_nameSpace == null) { - xml.append("<" + m_name); - } else { - xml.append("<" + m_nameSpace + ":" + m_name); - } - - Set keys = m_attributes.keySet(); - Iterator it = keys.iterator(); - while (it.hasNext()) { - Attribute current = (Attribute) m_attributes.get(it.next()); - if (current.getNameSpace() == null) { - xml.append(" " + current.getName() + "=\"" + current.getValue() + "\""); - } else { - xml.append(" " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\""); - } - } - - - if (m_elements.size() == 0) { - xml.append("/>"); - return xml.toString(); - } else { - xml.append(">"); - keys = m_elements.keySet(); - it = keys.iterator(); - while (it.hasNext()) { - Element[] e = (Element[]) m_elements.get(it.next()); - for (int i = 0; i < e.length; i++) { - xml.append("\n"); - xml.append(e[i].toXMLString(indent + 1)); - } - } - xml.append("\n" + tabs + ""); - return xml.toString(); - } - } - - /** - * To String method. - * @return the String form of this element. - * @see java.lang.Object#toString() - */ - public String toString() { - return toString(0); - } - - /** - * Internal method to compute the toString method. - * @param indent the indentation to use. - * @return the String form of this element. - */ - private String toString(int indent) { - StringBuffer xml = new StringBuffer(); - - StringBuffer tabs = new StringBuffer(); - for (int j = 0; j < indent; j++) { - tabs.append("\t"); - } - - xml.append(tabs); - if (m_nameSpace == null) { - xml.append(m_name); - } else { - xml.append(m_nameSpace + ":" + m_name); - } - - Set keys = m_attributes.keySet(); - Iterator it = keys.iterator(); - while (it.hasNext()) { - Attribute current = (Attribute) m_attributes.get(it.next()); - if (current.getNameSpace() == null) { - xml.append(" " + current.getName() + "=\"" + current.getValue() + "\""); - } else { - xml.append(" " + current.getNameSpace() + ":" + current.getName() + "=\"" + current.getValue() + "\""); - } - } - - if (m_elements.size() == 0) { - return xml.toString(); - } else { - keys = m_elements.keySet(); - it = keys.iterator(); - while (it.hasNext()) { - Element[] e = (Element[]) m_elements.get(it.next()); - for (int i = 0; i < e.length; i++) { - xml.append("\n"); - xml.append(e[i].toString(indent + 1)); - } - } - return xml.toString(); - } - } - -} diff --git a/ipojo/pom.xml b/ipojo/pom.xml deleted file mode 100644 index 4778d3b5ab..0000000000 --- a/ipojo/pom.xml +++ /dev/null @@ -1,85 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../pom/pom.xml - - - 4.0.0 - iPOJO - Apache Felix iPOJO ~ Reactor - 1.5.0-SNAPSHOT - pom - - - - metadata - manipulator - runtime - - - handler/extender - handler/temporal - handler/eventadmin - handler/whiteboard - handler/jmx - handler/transaction - - - arch - webconsole-plugin - - - distributions - - - - - - org.codehaus.mojo - rat-maven-plugin - 1.0-alpha-3 - - true - - **/* - - - - - - - - - - - org.apache.maven.plugins - maven-javadoc-plugin - - true - private - - - - - - diff --git a/ipojo/runtime/api/changelog.txt b/ipojo/runtime/api/changelog.txt deleted file mode 100644 index 6a130a6a65..0000000000 --- a/ipojo/runtime/api/changelog.txt +++ /dev/null @@ -1,219 +0,0 @@ -Changes from 1.12.0 to 1.12.1 ------------------------------ - -** Bug - * [FELIX-3836] - NPE when calling InstanceDescription.getDescription() - * [FELIX-4565] - Occasional ArrayIndexOutOfBoundException in iPOJO's ProvidedServiceHandler - * [FELIX-4646] - @Context(Context.Source.INSTANCE) does not inject bundle context - * [FELIX-4713] - Error in ProvidedServiceHandler.checkProvidedService : only the first service is checked - * [FELIX-4715] - instance bundle context injection does not works - * [FELIX-4716] - Bundle org.apache.felix.ipojo physically contains OSGi API classes - * [FELIX-4717] - Cannot use the stream API on injected collections - * [FELIX-4728] - InstanceManager concurrency issue - -Changes from 1.11.2 to 1.12.0 ------------------------------ - -** Bug - * [FELIX-4464] - Wrong configuration admin package import / export clause - * [FELIX-4488] - Attempt to create nullable object for non-interface service - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - * [FELIX-4490] - IPOJO allows "instance.name" property to be an empty String - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - * [FELIX-4510] - Support lambda expression - -Changes from 1.11.1 to 1.11.2 ------------------------------ - -** Bug - * [FELIX-4229] - Provide a way to obtain the component's BundleContext (other than constructor injection) - * [FELIX-4419] - Open access to InstanceDeclaration and TypeDeclaration - * [FELIX-4432] - DefaultServiceRankingInterceptor holds duplicate dependencies - * [FELIX-4448] - Invalid dynamism management when an interceptor implements both Tracking and Ranking interceptors - * [FELIX-4449] - The ConfigurationListener list contains duplicates and fires update on unchanged configurations - -** Improvement - * [FELIX-3931] - Provide a handler to inject the bundle context - * [FELIX-4160] - Create an Maven Parent POM for iPOJO - -Changes from 1.11.0 to 1.11.1 ------------------------------ - -** Bug - * [FELIX-4335] - PropertyDescription does not allow retrieving the current value of the represented property - * [FELIX-4374] - iPOJO: ConcurrentModificationException in ProvidedService - * [FELIX-4386] - Deadlock while creating composite instances programmatically - -** Improvement - * [FELIX-4292] - @Component 'propagation' attribute has wrong default value - -Changes from 1.10.1 to 1.11.0 ------------------------------ - -** Bug - * [FELIX-4115] - NPE in DependencyModel.getService() when @Bind method throws an exception - * [FELIX-4132] - @Modified not working on Equinox - * [FELIX-4138] - TypeDeclaration calls factory.dispose() even if it already has been disposed (externally) - * [FELIX-4139] - package conflict with ipojo-annotations and ipojo-runtime - * [FELIX-4164] - Instance / Component matching regression - * [FELIX-4172] - Updated method called twice at the bundle start - * [FELIX-4183] - Wrong Javadoc of TrackerCustomizer addingService method - * [FELIX-4199] - The filter based service tracking interceptor should always be created - * [FELIX-4200] - Only the last iPOJO Tracking interceptor is modifying the reference - * [FELIX-4204] - Service Dependencies with a callback without a type attribute must be rejected - * [FELIX-4207] - ipojo @Component with propagation set to true doesn't propagate properties - * [FELIX-4218] - NPE with field annotated with both @Property and @ServiceProperty - * [FELIX-4236] - Unvalued properties should be part of the instance's architecture - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - * [FELIX-4248] - ServiceUsage ThreadLocal removal - * [FELIX-4250] - Specification deduction broken when the method does not start with the 'bind' prefix - * [FELIX-4251] - The @Bind annotation should use Class instead of String - * [FELIX-4261] - NPE when an instance is declared without a configuration using the @ConfigurationTracker - * [FELIX-4268] - Duplicated name errors always happen when there are 2 factories with the same name - -** Improvement - * [FELIX-4143] - Improve @Configuration management performances - * [FELIX-4216] - Allow @Property without name in constructors - * [FELIX-4228] - Improve dependency identification in log messages and exceptions - * [FELIX-4232] - Service Dependency Interceptors should be part of the instance architecture - * [FELIX-4252] - Make Extender's ThreadPool size configurable - * [FELIX-4262] - QueueServices should be observable - * [FELIX-4263] - iPOJO Core should use ranged imports - * [FELIX-4264] - JobInfo should provide a way to identify the kind of task - -** New Feature - * [FELIX-4146] - Add getInstances and getInstanceNames in the Factory interface - * [FELIX-4147] - Add getProvidedService in ProvidedServiceDescription and allow external service management - * [FELIX-4215] - Extend manipulation metadata with argument names - * [FELIX-4231] - Provide service binding interceptors - * [FELIX-4265] - Provides a recorder for startup events - * [FELIX-4267] - Define Apache Karaf features for iPOJO - -** Task - * [FELIX-3925] - Merge the temporal dependency handler within the service dependency handler - * [FELIX-4133] - Add distribution creation in the iPOJO runtime build - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4136] - Document service dependency interceptors - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4217] - Ensure compatibility between Aries Blueprint and iPOJO - * [FELIX-4245] - Deadlock in Dependency - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4239] - Extend service dependency documentation with the 'exception' attribute. - * [FELIX-4240] - Support the 'exception' attribute in service dependencies - * [FELIX-4242] - Support the 'timeout' attribute in service dependencies - * [FELIX-4243] - Define the dependency configuration matrix and improve error detection - * [FELIX-4244] - Extend the service dependency documentation with the timeout attribute - * [FELIX-4257] - Allow the dependency handler to track the entry and exit of inner class methods - -Changes from 1.10.0 to 1.10.1 ------------------------------ - -** Bug - * [FELIX-4072] - onGet and onSet methods do not provide the reference on the pojo object - * [FELIX-4076] - Useless locking on getRequiredHandler - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4089] - Extender do not deactivate managed components when stopped - * [FELIX-4096] - NPE when retrieve required and missing handler on a disposed factory - * [FELIX-4105] - Factories not disposed when their bundle is leaving - * [FELIX-4106] - Defensive service registration and update - * [FELIX-4108] - Deadlock in the new extender - * [FELIX-4109] - ComponentTypeDescription.addProperty() ignore immutable parameter - * [FELIX-4113] - Factories not disposed when the extension provider is leaving - * [FELIX-4114] - iPOJO ProvidedServiceDescription does not expose policy & CreationStrategy - * [FELIX-4123] - Deadlock in new extender because of factory lock used in removedService - * [FELIX-4127] - Configuration tracker bug when starting and stopping iPOJO successively - * [FELIX-4129] - Cannot change the optionality of a dependency - -** Improvement - * [FELIX-1430] - Notification mechanism on bind/unbind events - * [FELIX-4073] - PrimitiveHandler.attach(ComponentInstance) is final - * [FELIX-4119] - Allow customization of DependencyHandler created Callbacks - -** New Feature - * [FELIX-4116] - Ability to listen for component service dependencies, providings, configuration properties, ... - * [FELIX-4120] - Allow external entity to interact during the service resolution - * [FELIX-4125] - Provide 'components' and 'component' commands - * [FELIX-4130] - Allow retrieving the component instance from the instance description - * [FELIX-4131] - Explicitly set configuration's location when the configuration is null - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - * [FELIX-4124] - Move arch-gogo to runtime - -Changes from 1.8.6 to 1.10.0 ----------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3843] - ClassCastException when listing service properties of a non-ComponentFactory Factory service - * [FELIX-3895] - iPOJO instance is not shown (with the "arch" commands) if constructor is failing - * [FELIX-3896] - Null reference are injected with @Bind(optional=false) method on iPOJO components - * [FELIX-3918] - iPOJO Logger cannot be dynamically configured on Equinox and KF - * [FELIX-3919] - iPOJO Proxies strategy cannot be configured dynamically on Equinox and KF - * [FELIX-3920] - Creation Strategy does not work on KF3 - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4041] - Properties starting with . should not be propagated - * [FELIX-4048] - @Requires handler does not fail when no specification can be found - * [FELIX-4053] - Avoid @StaticServiceProperty to be used on classes - * [FELIX-4054] - Use current factory version to generate instance name if required - -** Improvement - * [FELIX-3860] - factories and instances iPOJO gogo commands should show the "public=false" instances/factories - * [FELIX-3932] - Allow dependency filter's to get context-source variables - * [FELIX-4040] - Implement config admin support to handle binding location properly - * [FELIX-4045] - Chain Exceptions when possible - -** New Feature - * [FELIX-4034] - Instance configuration DSL - -** Task - * [FELIX-3892] - Upgrade runtime codebase to Java 5 - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3948] - Define a new extender model - * [FELIX-3978] - Check that we don't use java 6+ API - -** Wish - * [FELIX-3926] - Provide metadata for the Extender namespace - -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Improvement - * [FELIX-2758] - Add post-registration and post-unregistration callbacks to the iPOJO API - * [FELIX-2759] - The iPOJO API do not support constructor injection - -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - * [FELIX-2268] - Simplify setting of properties. - -** New Feature - * [FELIX-2132] - Provides a way to control service exposition from the implementation class - -Version 1.4.0 -------------- - -** Bug - * [FELIX-965] - Avoid classloading issue if an already manipulated class is used by the API - -** Improvement - * Update parent pom - * Initial commit - - diff --git a/ipojo/runtime/api/pom.xml b/ipojo/runtime/api/pom.xml deleted file mode 100644 index 1ffe610253..0000000000 --- a/ipojo/runtime/api/pom.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - bundle - - 5.0.2 - - org.apache.felix.ipojo.api - 1.12.2-SNAPSHOT - Apache Felix iPOJO API - - - iPOJO API used to define component types and instances using Java. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/apache-felix-ipojo-api.html - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - ${project.artifactId} - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/apache-felix-ipojo-api.html - - - org.apache.felix.ipojo.composite;resolution:=optional, - org.osgi.framework;version=1.3, - !org.apache.felix.ipojo.xml.parser, - !org.apache.felix.ipojo.annotations, - * - - - org.apache.felix.ipojo.api, - org.apache.felix.ipojo.api.composite, - org.objectweb.asm.commons;version=${asm.version};-split-package:=merge-last, - org.objectweb.asm;version=${asm.version};-split-package:=merge-last, - org.objectweb.asm.signature;version=${asm.version};-split-package:=merge-last - - - org.objectweb.asm.commons, - org.objectweb.asm.signature, - org.objectweb.asm, - org.objectweb.asm.tree*, - org.objectweb.asm.util, - org.apache.felix.ipojo.manipulation*, - org.apache.felix.ipojo.manipulator* - - - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.7 - - - org.codehaus.mojo.signature - java15 - 1.0 - - - - - test - - check - - - - - - - - - org.apache.felix - org.apache.felix.ipojo - 1.12.2-SNAPSHOT - provided - - - org.apache.felix - org.apache.felix.ipojo.composite - 1.12.2-SNAPSHOT - provided - - - org.apache.felix - org.apache.felix.ipojo.manipulator - 1.12.1 - - - org.osgi - org.osgi.core - 4.3.1 - provided - - - diff --git a/ipojo/runtime/api/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/runtime/api/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index e23daafe1f..0000000000 --- a/ipojo/runtime/api/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,16 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 -- BSD License diff --git a/ipojo/runtime/api/src/main/appended-resources/META-INF/LICENSE b/ipojo/runtime/api/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index 9e46ee9d78..0000000000 --- a/ipojo/runtime/api/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO API: - -The Apache Felix iPOJO API includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/runtime/api/src/main/appended-resources/META-INF/NOTICE b/ipojo/runtime/api/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 016e60dffa..0000000000 --- a/ipojo/runtime/api/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,3 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java deleted file mode 100644 index ef4cd068e1..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ComponentType.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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.ipojo.api; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; - - -/** - * The component type class allows specifying a new component type - * and its attached factory. It also allows creating instances form - * the specified component type. - * @author Felix Project Team - */ -public abstract class ComponentType { - - /** - * The list of instances created from the - * current component type. - */ - private List m_instances = new ArrayList(); - - - /** - * Gets the factory attached to the current - * component type. - * @return the factory - */ - public abstract Factory getFactory(); - - /** - * Starts the factory attached to this - * component type. Once started a factory - * and its attached component type - * cannot be modified. - */ - public abstract void start(); - - /** - * Stops the factory attached to this - * component type. - */ - public abstract void stop(); - - - /** - * Creates a component instance from the current type - * with an empty configuration. - * @return the component instance object. - * @throws UnacceptableConfiguration the configuration is not acceptable - * @throws MissingHandlerException the factory in invalid - * @throws ConfigurationException the instance configuration failed - */ - public ComponentInstance createInstance() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = ensureAndGetFactory().createComponentInstance(null); - m_instances.add(ci); - return ci; - } - - /** - * Creates a component instance from the current type - * with the given name. - * @param name the instance name - * @return the component instance object. - * @throws UnacceptableConfiguration the configuration is not acceptable - * @throws MissingHandlerException the factory in invalid - * @throws ConfigurationException the instance configuration failed - */ - public ComponentInstance createInstance(String name) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - Dictionary dict = null; - if (name != null) { - dict = new Properties(); - dict.put("instance.name", name); - } - ComponentInstance ci = ensureAndGetFactory().createComponentInstance(dict); - m_instances.add(ci); - return ci; - } - - /** - * Creates a component instance from the current type - * with the given configuration. - * @param conf the configuration - * @return the component instance object. - * @throws UnacceptableConfiguration the configuration is not acceptable - * @throws MissingHandlerException the factory in invalid - * @throws ConfigurationException the instance configuration failed - */ - public ComponentInstance createInstance(Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - ComponentInstance ci = ensureAndGetFactory().createComponentInstance(conf); - m_instances.add(ci); - return ci; - } - - /** - * Disposes the given name. The instance must be created from this - * component type. - * @param ci the component instance to delete - * @return true if the instance was - * successfully disposed. - */ - public boolean disposeInstance(ComponentInstance ci) { - if (m_instances.remove(ci)) { - ci.dispose(); - return true; - } else { - System.err.println("The instance was not created from this component type"); - return false; - } - } - - /** - * Gets the component instance created from this component type. - * with the given name. - * @param name the instance name. - * @return the component instance with the given name and created - * from the current component type factory. null if - * the instance cannot be found. - */ - public ComponentInstance getInstanceByName(String name) { - for (int i = 0; i < m_instances.size(); i++) { - ComponentInstance ci = (ComponentInstance) m_instances.get(i); - if (ci.getInstanceName().equals(name)) { - return ci; - } - } - return null; - } - - /** - * Disposes the instance created with this component type which - * has the given name. - * @param name the name of the instance to delete. - * @return true is the instance is successfully disposed. - */ - public boolean disposeInstance(String name) { - ComponentInstance ci = getInstanceByName(name); - if (ci == null) { - System.err.println("The instance was not found in this component type"); - return false; - } else { - return disposeInstance(ci); - } - } - - /** - * Returns the attached factory. - * Before returning the factory, the consistency of the - * factory is checked. - * @return the attached factory to the current component type - */ - private Factory ensureAndGetFactory() { - ensureFactory(); - return getFactory(); - } - - /** - * Checks if the factory is already created. - */ - private void ensureFactory() { - if (getFactory() == null) { - throw new IllegalStateException("The factory associated with the component type is not created"); - } else { - if (getFactory().getState() == Factory.INVALID) { - throw new IllegalStateException("The factory associated with the component type is invalid (not started or missing handlers)"); - } - } - } - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java deleted file mode 100644 index 86366ba522..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Dependency.java +++ /dev/null @@ -1,412 +0,0 @@ -/* - * 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.ipojo.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.handlers.dependency.DependencyDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows configuring a service dependencies. - * @author Felix Project Team - */ -public class Dependency implements HandlerConfiguration { - - /** - * The dynamic binding policy. - */ - public static final int DYNAMIC = org.apache.felix.ipojo.handlers.dependency.Dependency.DYNAMIC_BINDING_POLICY; - - /** - * The static binding policy. - */ - public static final int STATIC = org.apache.felix.ipojo.handlers.dependency.Dependency.STATIC_BINDING_POLICY; - - /** - * The dynamic-priority binding policy. - */ - public static final int DYNAMIC_PRIORITY = org.apache.felix.ipojo.handlers.dependency.Dependency.DYNAMIC_PRIORITY_BINDING_POLICY; - - /** - * The required specification. - */ - private String m_specification; - - /** - * The LDAP filter of the dependency. - */ - private String m_filter; - - /** - * The field of the implementation class attached to - * this dependency. - */ - private String m_field; - - /** - * The constructor parameter index. - */ - private int m_parameterIndex = -1; - - /** - * Is the dependency optional? - */ - private boolean m_optional; - - /** - * Is the dependency aggregate? - */ - private boolean m_aggregate; - - /** - * Bind method attached to the dependency. - */ - private String m_bind; - - /** - * Unbind method attached to the dependency. - */ - private String m_unbind; - - /** - * Modified method attached to the dependency. - */ - private String m_modified; - - /** - * The dependency binding policy. - */ - private int m_policy; - - /** - * The dependency comparator. - * (used to compare service providers) - */ - private String m_comparator; - - /** - * The dependency default-implementation. - */ - private String m_di; - - /** - * The dependency specific provider. - */ - private String m_from; - - /** - * The dependency id. - */ - private String m_id; - - /** - * Does the dependency supports nullable? - */ - private boolean m_nullable = true; - - /** - * Does the dependency enables proxy. - */ - private boolean m_proxy = true; - - /** - * Gets the dependency metadata. - * @return the 'requires' element describing - * the current dependency. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("requires", ""); - if (m_specification != null) { - dep.addAttribute(new Attribute("specification", m_specification)); - } - if (m_filter != null) { - dep.addAttribute(new Attribute("filter", m_filter)); - } - if (m_field != null) { - dep.addAttribute(new Attribute("field", m_field)); - } - if (m_parameterIndex != -1) { - dep.addAttribute(new Attribute("constructor-parameter", - Integer.toString(m_parameterIndex))); - } - if (m_bind != null) { - Element cb = new Element("callback", ""); - cb.addAttribute(new Attribute("type", "bind")); - cb.addAttribute(new Attribute("method", m_bind)); - dep.addElement(cb); - } - if (m_unbind != null) { - Element cb = new Element("callback", ""); - cb.addAttribute(new Attribute("type", "unbind")); - cb.addAttribute(new Attribute("method", m_unbind)); - dep.addElement(cb); - } - if (m_modified != null) { - Element cb = new Element("callback", ""); - cb.addAttribute(new Attribute("type", "modified")); - cb.addAttribute(new Attribute("method", m_modified)); - dep.addElement(cb); - } - if (m_comparator != null) { - dep.addAttribute(new Attribute("comparator", m_comparator)); - } - if (m_di != null) { - dep.addAttribute(new Attribute("default-implementation", m_di)); - } - if (m_from != null) { - dep.addAttribute(new Attribute("from", m_from)); - } - if (m_id != null) { - dep.addAttribute(new Attribute("id", m_id)); - } - if (! m_nullable) { - dep.addAttribute(new Attribute("nullable", "false")); - } - if (m_optional) { - dep.addAttribute(new Attribute("optional", "true")); - } - if (m_aggregate) { - dep.addAttribute(new Attribute("aggregate", "true")); - } - if (! m_proxy) { - dep.addAttribute(new Attribute("proxy", "false")); - } - if (m_policy != -1) { - if (m_policy == DYNAMIC) { - dep.addAttribute(new Attribute("policy", "dynamic")); - } else if (m_policy == STATIC) { - dep.addAttribute(new Attribute("policy", "static")); - } else if (m_policy == DYNAMIC_PRIORITY) { - dep.addAttribute(new Attribute("policy", "dynamic-priority")); - } - // No other possibilities. - } - return dep; - } - - /** - * Sets the required service specification. - * @param spec the specification - * @return the current dependency object. - */ - public Dependency setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the dependency filter. - * @param filter the LDAP filter - * @return the current dependency object - */ - public Dependency setFilter(String filter) { - m_filter = filter; - return this; - } - - /** - * Sets the field attached to the dependency. - * @param field the implementation class field name. - * @return the current dependency object - */ - public Dependency setField(String field) { - m_field = field; - return this; - } - - /** - * Sets the constructor parameter index of the dependency. - * @param index the parameter index - * @return the current dependency object - */ - public Dependency setConstructorParameter(int index) { - m_parameterIndex = index; - return this; - } - - /** - * Sets the dependency optionality. - * @param opt true to set the - * dependency to optional. - * @return the current dependency object. - */ - public Dependency setOptional(boolean opt) { - m_optional = opt; - return this; - } - - /** - * Sets the dependency cardinality. - * @param agg true to set the - * dependency to aggregate. - * @return the current dependency object. - */ - public Dependency setAggregate(boolean agg) { - m_aggregate = agg; - return this; - } - - /** - * Sets if the dependency supports nullable objects. - * @param nullable false if the dependency does not - * support the nullable object injection - * @return the current dependency object. - */ - public Dependency setNullable(boolean nullable) { - m_nullable = nullable; - return this; - } - - /** - * Sets if the dependency injects proxies. - * @param proxy false if the dependency does not - * inject proxies but uses direct references. - * @return the current dependency object. - */ - public Dependency setProxy(boolean proxy) { - m_proxy = proxy; - return this; - } - - /** - * Sets the dependency bind method. - * @param bind the bind method name - * @return the current dependency object. - */ - public Dependency setBindMethod(String bind) { - m_bind = bind; - return this; - } - - /** - * Sets the dependency unbind method. - * @param unbind the unbind method - * @return the current dependency object. - */ - public Dependency setUnbindMethod(String unbind) { - m_unbind = unbind; - return this; - } - - /** - * Sets the dependency modified method. - * @param modified the modified method - * @return the current dependency object. - */ - public Dependency setModifiedMethod(String modified) { - m_modified = modified; - return this; - } - - /** - * Sets the dependency binding policy. - * @param policy the binding policy - * @return the current dependency object - */ - public Dependency setBindingPolicy(int policy) { - m_policy = policy; - return this; - } - - /** - * Sets the dependency comparator. - * @param cmp the comparator class name - * @return the current dependency object - */ - public Dependency setComparator(String cmp) { - m_comparator = cmp; - return this; - } - - /** - * Sets the dependency default-implementation. - * @param di the default-implementation class name - * @return the current dependency object - */ - public Dependency setDefaultImplementation(String di) { - m_di = di; - return this; - } - - /** - * Sets the dependency 'from' attribute. - * @param from the name of the service provider. - * @return the current dependency object - */ - public Dependency setFrom(String from) { - m_from = from; - return this; - } - - /** - * Sets the dependency id. - * @param id the dependency id. - * @return the current dependency object. - */ - public Dependency setId(String id) { - m_id = id; - return this; - } - - /** - * Checks dependency configuration validity. - */ - private void ensureValidity() { - // At least a field or methods. - if (m_field == null && m_bind == null && m_unbind == null && m_parameterIndex == -1) { - throw new IllegalStateException("A dependency must have a field or bind/unbind methods " + - "or a parameter index"); - } - // Check binding policy. - if (m_policy != -1) { - if (!(m_policy == DYNAMIC || m_policy == STATIC || m_policy == DYNAMIC_PRIORITY)) { - throw new IllegalStateException("Unknow binding policy : " + m_policy); - } - } - } - - /** - * Gets the dependency description object attached to - * this dependency. - * @param instance the instance on which searching the dependency - * @return the dependency description attached to this dependency or - * null if the dependency cannot be found. - */ - public DependencyDescription getDependencyDescription(ComponentInstance instance) { - PrimitiveInstanceDescription desc = (PrimitiveInstanceDescription) instance.getInstanceDescription(); - if (m_id != null) { - return desc.getDependency(m_id); - } - if (m_specification != null) { - return desc.getDependency(m_specification); - } - DependencyDescription[] deps = desc.getDependencies(); - if (deps.length == 1) { - return deps[0]; - } - // Cannot determine the dependency. - return null; - } - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java deleted file mode 100644 index 84f52b7725..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/HandlerConfiguration.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.api; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Common interfaces for all contributions. - * @author Felix Project Team - */ -public interface HandlerConfiguration { - - /** - * Gets the Handler description. - * @return the Element-Attribute structure containing the handler - * configuration. - */ - Element getElement(); - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java deleted file mode 100644 index 53a0931630..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/PrimitiveComponentType.java +++ /dev/null @@ -1,560 +0,0 @@ -/* - * 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.ipojo.api; - -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.manipulation.Manipulator; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.BundleContext; - -/** - * Allows defining primitive component types. - * @author Felix Project Team - */ -public class PrimitiveComponentType extends ComponentType { - - /** - * The bundle context. - */ - private BundleContext m_context; - - /** - * The implementation class name. - */ - private String m_classname; - - /** - * The component type name. - */ - private String m_name; - - /** - * The component type version. - */ - private String m_version; - - /** - * Is the component type immediate. - */ - private boolean m_immediate; - - /** - * Manipulation metadata of the component type. - */ - private Element m_manipulation; - - /** - * Component factory attached to the component - * type. - */ - private ComponentFactory m_factory; - - /** - * List of provided services. - */ - private List m_services = new ArrayList(1); - - /** - * List of service dependencies. - */ - private List m_dependencies = new ArrayList(); - - /** - * List of configuration properties. - */ - private List m_properties = new ArrayList(); - - /** - * The validate callback. - */ - private String m_validate; - - /** - * The invalidate callback. - */ - private String m_invalidate; - - /** - * The updated callback. - */ - private String m_updated; - - /** - * Are the properties propagated to provided services? - */ - private boolean m_propagation; - - /** - * The factory method. - */ - private String m_factoryMethod; - - /** - * Is the factory public? - */ - private boolean m_public = true; - - /** - * The Managed Service PID. - */ - private String m_msPID; - - /** - * The temporal dependencies. - */ - private ArrayList m_temporals = new ArrayList(); - - /** - * List of Handler representing external - * handler configuration. - */ - private List m_handlers = new ArrayList(); - - - /** - * During the manipulation, we detect is the class is already manipulated. - * If set to false, the factory is configured to use the factory classloader. - */ - private boolean m_alreadyManipulated = false; - - /** - * Checks that the component type is not already - * started. - */ - private void ensureNotInitialized() { - if (m_factory != null) { - throw new IllegalStateException("The component type was already initialized, cannot modify metadata"); - } - } - - /** - * Checks that the component type description is valid. - */ - private void ensureValidity() { - if (m_classname == null) { - throw new IllegalStateException("The primitive component type has no implementation class"); - } - if (m_context == null) { - throw new IllegalStateException("The primitive component type has no bundle context"); - } - } - - /** - * Gets the component factory. - * @return the factory attached to this component type. - * @see org.apache.felix.ipojo.api.ComponentType#getFactory() - */ - public Factory getFactory() { - initializeFactory(); - return m_factory; - } - - /** - * Starts the component type. - * @see org.apache.felix.ipojo.api.ComponentType#start() - */ - public void start() { - initializeFactory(); - m_factory.start(); - } - - /** - * Stops the component type. - * @see org.apache.felix.ipojo.api.ComponentType#stop() - */ - public void stop() { - initializeFactory(); - m_factory.stop(); - } - - /** - * Initializes the factory. - */ - private void initializeFactory() { - if (m_factory == null) { - createFactory(); - } - } - - /** - * Sets the bundle context. - * @param bc the bundle context - * @return the current component type - */ - public PrimitiveComponentType setBundleContext(BundleContext bc) { - ensureNotInitialized(); - m_context = bc; - return this; - } - - /** - * Sets the implementation class. - * @param classname the class name - * @return the current component type - */ - public PrimitiveComponentType setClassName(String classname) { - ensureNotInitialized(); - m_classname = classname; - return this; - } - - /** - * Sets the component type name. - * @param name the factory name - * @return the current component type - */ - public PrimitiveComponentType setComponentTypeName(String name) { - ensureNotInitialized(); - m_name = name; - return this; - } - - /** - * Sets the component type version. - * @param version the factory version or "bundle" to use the - * bundle version. - * @return the current component type - */ - public PrimitiveComponentType setComponentTypeVersion(String version) { - ensureNotInitialized(); - m_version = version; - return this; - } - - /** - * Sets if the component type is immediate or not. - * @param immediate true to set the component - * type to immediate - * @return the current component type - */ - public PrimitiveComponentType setImmediate(boolean immediate) { - ensureNotInitialized(); - m_immediate = immediate; - return this; - } - - /** - * Sets the dependency factory method. - * @param method the method used to create pojo object. - * @return the current component type - */ - public PrimitiveComponentType setFactoryMethod(String method) { - ensureNotInitialized(); - m_factoryMethod = method; - return this; - } - - /** - * Sets if the component type propagates properties to service properties. - * @param propagation true to enable propagation - * @return the current component type - */ - public PrimitiveComponentType setPropagation(boolean propagation) { - ensureNotInitialized(); - m_propagation = propagation; - return this; - } - - /** - * Sets the factory public aspect. - * @param visible false to create a private factory. - * @return the current component type - */ - public PrimitiveComponentType setPublic(boolean visible) { - ensureNotInitialized(); - m_public = visible; - return this; - } - - /** - * Sets the managed service pid. - * @param pid the managed service pid - * @return the current component type - */ - public PrimitiveComponentType setManagedServicePID(String pid) { - ensureNotInitialized(); - m_msPID = pid; - return this; - } - - /** - * Sets the validate method. - * @param method the validate method - * @return the current component type - */ - public PrimitiveComponentType setValidateMethod(String method) { - ensureNotInitialized(); - m_validate = method; - return this; - } - - /** - * Sets the invalidate method. - * @param method the invalidate method - * @return the current component type - */ - public PrimitiveComponentType setInvalidateMethod(String method) { - ensureNotInitialized(); - m_invalidate = method; - return this; - } - - /** - * Sets the updated method. - * @param method the updated method - * @return the current component type - */ - public PrimitiveComponentType setUpdatedMethod(String method) { - ensureNotInitialized(); - m_updated = method; - return this; - } - - /** - * Generates the component description. - * @return the component type description of - * the current component type - */ - private Element generateComponentMetadata() { - Element element = new Element("component", ""); - element.addAttribute(new Attribute("classname", m_classname)); - if (m_name != null) { - element.addAttribute(new Attribute("name", m_name)); - } - if (m_version != null) { - element.addAttribute(new Attribute("version", m_version)); - } - if (m_factoryMethod != null) { - element.addAttribute(new Attribute("factory-method", m_factoryMethod)); - } - if (! m_public) { - element.addAttribute(new Attribute("public", "false")); - } - if (m_immediate) { - element.addAttribute(new Attribute("immediate", "true")); - } - for (Service svc : m_services) { - element.addElement(svc.getElement()); - } - for (Dependency dep : m_dependencies) { - element.addElement(dep.getElement()); - } - for (TemporalDependency dep : m_temporals) { - element.addElement(dep.getElement()); - } - if (m_validate != null) { - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("transition", "validate")); - callback.addAttribute(new Attribute("method", m_validate)); - element.addElement(callback); - } - if (m_invalidate != null) { - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("transition", "invalidate")); - callback.addAttribute(new Attribute("method", m_invalidate)); - element.addElement(callback); - } - - // Properties - // First determine if we need the properties element - if (m_propagation || m_msPID != null || ! m_properties.isEmpty()) { - Element properties = new Element("properties", ""); - if (m_propagation) { - properties.addAttribute(new Attribute("propagation", "true")); - } - if (m_msPID != null) { - properties.addAttribute(new Attribute("pid", m_msPID)); - } - if (m_updated != null) { - properties.addAttribute(new Attribute("updated", m_updated)); - } - for (Property prop : m_properties) { - properties.addElement(prop.getElement()); - } - element.addElement(properties); - } - - // External handlers - for (HandlerConfiguration hc : m_handlers) { - element.addElement(hc.getElement()); - } - - return element; - } - - - /** - * Adds an HandlerConfiguration to the component type. Each component type - * implementation must uses the populated list (m_handlers) when generating - * the component metadata. - * @param handler the handler configuration to add - * @return the current component type - */ - public PrimitiveComponentType addHandler(HandlerConfiguration handler) { - m_handlers.add(handler); - return this; - } - - /** - * Creates the component factory. - */ - private void createFactory() { - ensureValidity(); - byte[] clazz = manipulate(); - - Element meta = generateComponentMetadata(); - meta.addElement(m_manipulation); - try { - if (m_alreadyManipulated) { // Already manipulated - m_factory = new ComponentFactory(m_context, meta); - } else { - m_factory = new ComponentFactory(m_context, clazz, meta); - m_factory.setUseFactoryClassloader(true); - } - m_factory.start(); - } catch (ConfigurationException e) { - throw new IllegalStateException("An exception occurs during factory initialization", e); - } - - } - - /** - * Manipulates the implementation class. - * @return the manipulated class - */ - private byte[] manipulate() { - Manipulator manipulator = new Manipulator(new ClassLoader() { - @Override - public Class loadClass(String name) throws ClassNotFoundException { - try { - return m_context.getBundle().loadClass(name); - } catch (ClassNotFoundException e) { - return this.getClass().getClassLoader().loadClass(name); - } - } - }); - try { - byte[] array = getClassByteArray(); - - // Step 1 - preparation - manipulator.prepare(array); - - byte[] newclazz = new byte[0]; - if (!manipulator.isAlreadyManipulated()) { - // Step 2 - manipulation - newclazz = manipulator.manipulate(array); - } - m_manipulation = manipulator.getManipulationMetadata(); - m_alreadyManipulated = manipulator.isAlreadyManipulated(); - return newclazz; - } catch (IOException e) { - throw new IllegalStateException("An exception occurs during implementation class manipulation", e); - } - } - - /** - * Gets a class file as a byte array. - * @return the byte array. - * @throws IOException the class file cannot be read. - */ - private byte[] getClassByteArray() throws IOException { - String filename = m_classname.replace('.', '/') + ".class"; - URL url = m_context.getBundle().getResource(filename); - if (url == null) { - throw new IllegalStateException("An exception occurs during implementation class manipulation : cannot found the class file " + filename); - } - InputStream is = url.openStream(); - if (is == null) { - throw new IllegalStateException("An exception occurs during implementation class manipulation : cannot read the class file " + url); - } - byte[] b = new byte[is.available()]; - is.read(b); - return b; - } - - /** - * Adds a provided service. - * @param svc the service to add - * @return the current component type - */ - public PrimitiveComponentType addService(Service svc) { - ensureNotInitialized(); - m_services.add(svc); - return this; - } - - /** - * Adds a service dependency. - * @param dep the dependency to add - * @return the current component type - */ - public PrimitiveComponentType addDependency(Dependency dep) { - ensureNotInitialized(); - m_dependencies.add(dep); - return this; - } - - /** - * Adds a temporal service dependency. - * @param dep the temporal dependency to add - * @return the current component type - */ - public PrimitiveComponentType addDependency(TemporalDependency dep) { - ensureNotInitialized(); - m_temporals.add(dep); - return this; - } - - /** - * Adds a configuration property. - * @param prop the property to add - * @return the current component type - */ - public PrimitiveComponentType addProperty(Property prop) { - ensureNotInitialized(); - m_properties.add(prop); - return this; - } - - /** - * Adds a configuration property. - * @param key the key - * @param obj the value (can be null) - * @return the current component type - */ - public PrimitiveComponentType addProperty(String key, Object obj) { - String value = null; - if (obj != null) { - value = obj.toString(); - } - - addProperty(new Property().setName(key).setValue(value)); - return this; - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Property.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Property.java deleted file mode 100644 index 93879410b3..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Property.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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.ipojo.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows configuring a configuration property. - * @author Felix Project Team - */ -public class Property { - - /** - * The property name. - */ - private String m_name; - - /** - * The property field. - */ - private String m_field; - - /** - * The constructor parameter index. - */ - private int m_parameterIndex = -1; - - /** - * The property value. - */ - private String m_value; - - /** - * The property method. - */ - private String m_method; - - /** - * Is the property mandatory. - */ - private boolean m_mandatory; - - /** - * Is the property immutable. - */ - private boolean m_immutable; - - /** - * Sets the property name. - * @param name the property name - * @return the current property object - */ - public Property setName(String name) { - m_name = name; - return this; - } - - /** - * Sets the property field. - * @param name the property field - * @return the current property object - */ - public Property setField(String name) { - m_field = name; - return this; - } - - /** - * Sets the constructor parameter index of the property. - * @param index the parameter index - * @return the current property object - */ - public Property setConstructorParameter(int index) { - m_parameterIndex = index; - return this; - } - - /** - * Sets the property method. - * @param name the property method - * @return the current property object - */ - public Property setMethod(String name) { - m_method = name; - return this; - } - - /** - * Sets the property value. - * @param name the property value - * @return the current property object - */ - public Property setValue(String name) { - m_value = name; - return this; - } - - /** - * Sets if the property is mandatory. - * @param mandatory true if the dependency is mandatory. - * @return the current property object - */ - public Property setMandatory(boolean mandatory) { - m_mandatory = mandatory; - return this; - } - - /** - * Sets if the property is immutable. - * @param immutable true if the dependency is immutable. - * @return the current property object - */ - public Property setImmutable(boolean immutable) { - m_immutable = immutable; - return this; - } - - /** - * Gets the property element. - * @return the property element. - */ - public Element getElement() { - ensureValidity(); - Element element = new Element("property", ""); - if (m_name != null) { - element.addAttribute(new Attribute("name", m_name)); - } - if (m_method != null) { - element.addAttribute(new Attribute("method", m_method)); - } - if (m_parameterIndex != -1) { - element.addAttribute(new Attribute("constructor-parameter", - Integer.toString(m_parameterIndex))); - } - if (m_value != null) { - element.addAttribute(new Attribute("value", m_value)); - } - if (m_field != null) { - element.addAttribute(new Attribute("field", m_field)); - } - if (m_mandatory) { - element.addAttribute(new Attribute("mandatory", new Boolean(m_mandatory).toString())); - } - if (m_immutable) { - element.addAttribute(new Attribute("immutable", new Boolean(m_immutable).toString())); - } - return element; - } - - /** - * Checks the configuration validity. - */ - private void ensureValidity() { - // Two cases - // Field or Method - if (m_field == null && m_method == null && m_parameterIndex == -1) { - throw new IllegalStateException("A property must have either a field or a method " + - "or a constructor parameter"); - } - if (m_immutable && m_value == null) { - throw new IllegalStateException("A immutable service property must have a value"); - } - } - - /** - * Gets the property description for the current property. - * @param instance the component instance on which looking for the property. - * @return the property description associated with the current property - * or null if not found. - */ - public PropertyDescription getPropertyDescription(ComponentInstance instance) { - PrimitiveInstanceDescription desc = (PrimitiveInstanceDescription) instance.getInstanceDescription(); - PropertyDescription[] props = desc.getProperties(); - - for (int i = 0; i < props.length; i++) { - if ((m_name != null && m_name.equals(props[i].getName())) - || (m_field != null && m_field.equals(props[i].getName()))) { - return props[i]; - } - } - - return null; - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Service.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Service.java deleted file mode 100644 index 99499ef379..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/Service.java +++ /dev/null @@ -1,320 +0,0 @@ -/* - * 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.ipojo.api; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.handlers.providedservice.ProvidedService; -import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows configuring a provided service. - * @author Felix Project Team - */ -public class Service implements HandlerConfiguration { - - /** - * Creation strategy : singleton (default). - */ - public static final int SINGLETON_STRATEGY = ProvidedService.SINGLETON_STRATEGY; - - /** - * Creation strategy : delegate on the static factory method. - */ - public static final int STATIC_STRATEGY = ProvidedService.STATIC_STRATEGY; - - /** - * Creation strategy : one service object per instance. - */ - public static final int INSTANCE_STRATEGY = ProvidedService.INSTANCE_STRATEGY; - - /** - * Creation strategy : one service object per bundle (OSGi service factory). - */ - public static final int SERVICE_STRATEGY = ProvidedService.SERVICE_STRATEGY; - - /** - * The provided service specification. - */ - private List m_specifications; // null be default computed. - - /** - * The provided service strategy. - */ - private int m_strategy = ProvidedService.SINGLETON_STRATEGY; - - /** - * The provided service custom strategy. - */ - private String m_customStrategy; - - /** - * The service properties. - */ - private List m_properties = new ArrayList(); - - /** - * Service controller. - */ - private String m_controller; - - /** - * Service Controller value. - */ - private boolean m_controllerValue; - - /** - * Post-Registration callback. - */ - private String m_postRegistrationCallback; - - /** - * Post-Unregistration callback. - */ - private String m_postUnregistrationCallback; - - /** - * Gets the provided service element. - * @return the 'provides' element. - */ - public Element getElement() { - ensureValidity(); - Element element = new Element("provides", ""); - if (m_specifications != null) { - element.addAttribute(new Attribute("specifications", getSpecificationsArray())); - } - element.addAttribute(new Attribute("strategy", getStringStrategy())); - for (int i = 0; i < m_properties.size(); i++) { - element.addElement(((ServiceProperty) m_properties.get(i)).getElement()); - } - - if (m_controller != null) { - Element ctrl = new Element("controller", ""); - ctrl.addAttribute(new Attribute("field", m_controller)); - ctrl.addAttribute(new Attribute("value", String.valueOf(m_controllerValue))); - element.addElement(ctrl); - } - - if (m_postRegistrationCallback != null) { - element.addAttribute(new Attribute("post-registration", m_postRegistrationCallback)); - } - if (m_postUnregistrationCallback != null) { - element.addAttribute(new Attribute("post-unregistration", m_postUnregistrationCallback)); - } - - return element; - } - - /** - * Gets the provided service description associated with the current service. - * @param instance the instance on which looking for the provided service description - * @return the provided service description or null if not found. - */ - public ProvidedServiceDescription getProvidedServiceDescription(ComponentInstance instance) { - PrimitiveInstanceDescription desc = (PrimitiveInstanceDescription) instance.getInstanceDescription(); - ProvidedServiceDescription[] pss = desc.getProvidedServices(); - if (pss.length == 0) { - return null; - } - - if (pss.length == 1) { - return pss[0]; - } - - if (m_specifications == null) { - return null; - } else { - for (int j = 0; j < pss.length; j++) { - ProvidedServiceDescription psd = pss[j]; - List specs = Arrays.asList(psd.getServiceSpecifications()); - if (specs.containsAll(m_specifications)) { - return psd; - } - } - } - - return null; - } - - - - /** - * Checks the validity of the configuration. - */ - private void ensureValidity() { - // No check required. - } - - - /** - * The the service specification array as a String. - * @return the string-from of the service specifications. - */ - private String getSpecificationsArray() { - if (m_specifications.size() == 1) { - return (String) m_specifications.get(0); - } else { - StringBuffer buffer = new StringBuffer("{"); - for (int i = 0; i < m_specifications.size(); i++) { - if (i != 0) { - buffer.append(','); - } - buffer.append(m_specifications.get(i)); - } - buffer.append('}'); - return buffer.toString(); - } - } - - /** - * Adds a service property. - * @param ps the service property to add - * @return the current service object. - */ - public Service addProperty(ServiceProperty ps) { - m_properties.add(ps); - return this; - } - - /** - * Adds a service property. - * @param key the property key - * @param obj the initial value (can be null) - * @return the current service object. - */ - public Service addProperty(String key, Object obj) { - Class clazz = String.class; - String value = null; - if (obj != null) { - clazz = obj.getClass(); - value = obj.toString(); - } - - addProperty(new ServiceProperty().setName(key).setType(clazz.getName()) - .setValue(value)); - - return this; - } - - /** - * Sets the provided service specification. - * @param spec the service specification - * @return the current service object. - */ - public Service setSpecification(String spec) { - m_specifications = new ArrayList(1); - m_specifications.add(spec); - return this; - } - - /** - * Sets the provided service specifications. - * @param specs the service specifications - * @return the current service object. - */ - public Service setSpecifications(List specs) { - m_specifications = specs; - return this; - } - - /** - * Sets the creation strategy. - * @param strategy the service strategy. - * @return the current service object - */ - public Service setCreationStrategy(int strategy) { - m_strategy = strategy; - return this; - } - - /** - * Sets the creation strategy. - * This method allows using a customized - * service strategy. - * @param strategy the service strategy - * @return the current service object - */ - public Service setCreationStrategy(String strategy) { - m_strategy = -1; // Custom - m_customStrategy = strategy; - return this; - } - - /** - * Sets the service controller. - * @param field the controller field - * @param initialValue the initial value - * @return the current service object - */ - public Service setServiceController(String field, - boolean initialValue) { - m_controller = field; - m_controllerValue = initialValue; - return this; - } - - /** - * Sets the post-registration callback. - * @param callback the callback name (method name) - * @return the current service object - */ - public Service setPostRegistrationCallback(String callback) { - m_postRegistrationCallback = callback; - return this; - } - - /** - * Sets the post-unregistration callback. - * @param callback the callback name (method name) - * @return the current service object - */ - public Service setPostUnregistrationCallback(String callback) { - m_postUnregistrationCallback = callback; - return this; - } - - /** - * Gets the string-form of the creation strategy. - * @return the creation strategy string form - */ - private String getStringStrategy() { - switch (m_strategy) { - case -1: // Custom policies - return m_customStrategy; - case ProvidedService.SINGLETON_STRATEGY: - return "singleton"; - case ProvidedService.STATIC_STRATEGY: - return "method"; - case ProvidedService.SERVICE_STRATEGY: - return "service"; - case ProvidedService.INSTANCE_STRATEGY: - return "instance"; - default: - throw new IllegalStateException("Unknown creation strategy : " - + m_strategy); - } - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ServiceProperty.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ServiceProperty.java deleted file mode 100644 index eb2d93b8d2..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/ServiceProperty.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.ipojo.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.handlers.providedservice.ProvidedServiceDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows configuring a service property. - * @author Felix Project Team - */ -public class ServiceProperty { - - /** - * The property name. - */ - private String m_name; - - /** - * The property field. - */ - private String m_field; - - /** - * The property type. - */ - private String m_type; - - /** - * The property value. - */ - private String m_value; - - /** - * Is the property mandatory. - */ - private boolean m_mandatory; - - /** - * Is the property immutable. - */ - private boolean m_immutable; - - /** - * Sets the property name. - * @param name the property name - * @return the current property object - */ - public ServiceProperty setName(String name) { - m_name = name; - return this; - } - - /** - * Sets the property field. - * @param name the property field - * @return the current property object - */ - public ServiceProperty setField(String name) { - m_field = name; - return this; - } - - /** - * Sets the property type. - * @param name the property type - * @return the current property object - */ - public ServiceProperty setType(String name) { - m_type = name; - return this; - } - - /** - * Sets the property value. - * @param name the property value - * @return the current property object - */ - public ServiceProperty setValue(String name) { - m_value = name; - return this; - } - - /** - * Sets if the property is immutable. - * @param immutable true if the dependency is immutable. - * @return the current property object - */ - public ServiceProperty setImmutable(boolean immutable) { - m_immutable = immutable; - return this; - } - - /** - * Sets if the property is mandatory. - * @param mandatory true if the dependency is mandatory. - * @return the current property object - */ - public ServiceProperty setMandatory(boolean mandatory) { - m_mandatory = mandatory; - return this; - } - - - /** - * Gets the 'property' element. - * @return the element describing the current property. - */ - public Element getElement() { - ensureValidity(); - Element element = new Element("property", ""); - if (m_name != null) { - element.addAttribute(new Attribute("name", m_name)); - } - if (m_type != null) { - element.addAttribute(new Attribute("type", m_type)); - } - if (m_value != null) { - element.addAttribute(new Attribute("value", m_value)); - } - if (m_field != null) { - element.addAttribute(new Attribute("field", m_field)); - } - if (m_mandatory) { - element.addAttribute(new Attribute("mandatory", new Boolean(m_mandatory).toString())); - } - if (m_immutable) { - element.addAttribute(new Attribute("immutable", new Boolean(m_immutable).toString())); - } - return element; - } - - /** - * Checks the configuration validity. - */ - private void ensureValidity() { - // Two cases - // Field or type - if (m_field == null && m_type == null) { - throw new IllegalStateException("A service property must have either a field or a type"); - } - if (m_immutable && m_value == null) { - throw new IllegalStateException("A immutable service property must have a value"); - } - } - - /** - * Gets the property value of the current property - * on the given instance. - * @param instance the instance on which looking for - * the property value - * @return the property value or null - * if not found. - */ - public Object getPropertyValue(ComponentInstance instance) { - PrimitiveInstanceDescription desc = (PrimitiveInstanceDescription) instance.getInstanceDescription(); - ProvidedServiceDescription[] pss = desc.getProvidedServices(); - for (int i = 0; i < pss.length; i++) { - // Check with the name - if (m_name != null && pss[i].getProperties().containsKey(m_name)) { - return pss[i].getProperties().get(m_name); - } - // Check with the field - if (m_field != null && pss[i].getProperties().containsKey(m_field)) { - return pss[i].getProperties().get(m_field); - } - } - // Not found. - return null; - } - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java deleted file mode 100644 index 39f510d639..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/SingletonComponentType.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.ipojo.api; - -import java.util.Dictionary; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; - -/** - * Allows defining a primitive component type that create an unique - * instance when created. The factory is set to private by default. - * @author Felix Project Team - */ -public class SingletonComponentType extends PrimitiveComponentType { - - /** - * The POJO object to inject through the - * instance configuration. - */ - private Object m_pojo; - - /** - * Creates a SingletonComponentType. - * This type is set to private by default. - */ - public SingletonComponentType() { - setPublic(false); - } - - /** - * Sets the pojo object used by the instance. - * The object must be compatible with the - * implementation class. - * @param obj the object. - * @return the current singleton component type. - */ - public SingletonComponentType setObject(Object obj) { - m_pojo = obj; - return this; - } - - /** - * Starts the component type and creates the singleton - * instance. This method has to be called in place of the - * {@link PrimitiveComponentType#start()} and the - * {@link PrimitiveComponentType#createInstance()} methods. - * @return the created component instance. - * @throws ConfigurationException occurs if the type description is - * incorrect - * @throws MissingHandlerException occurs if a handler is not available - * @throws UnacceptableConfiguration occurs if the configuration is not - * acceptable by the instance - * @see org.apache.felix.ipojo.api.ComponentType#start() - * @see PrimitiveComponentType#createInstance() - */ - public ComponentInstance create() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - start(); - if (m_pojo != null) { - Dictionary dict = new Properties(); - dict.put("instance.object", m_pojo); - return createInstance(dict); - } else { - return createInstance(); - } - } - - /** - * Starts the component type and creates the singleton - * instance. This method has to be called in place of the - * {@link PrimitiveComponentType#start()} and the - * {@link PrimitiveComponentType#createInstance()} methods. - * @param conf the instance configuration - * @return the created component instance - * @throws ConfigurationException occurs if the type description is - * incorrect - * @throws MissingHandlerException occurs if a handler is not available - * @throws UnacceptableConfiguration occurs if the configuration is not - * acceptable by the instance - * @see org.apache.felix.ipojo.api.ComponentType#start() - * @see PrimitiveComponentType#createInstance() - */ - public ComponentInstance create(Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - start(); - if (m_pojo != null) { - conf.put("instance.object", m_pojo); - } - return createInstance(conf); - } - - /** - * Starts the component type and creates the singleton - * instance. This method has to be called in place of the - * {@link PrimitiveComponentType#start()} and the - * {@link PrimitiveComponentType#createInstance()} methods. - * @param name the name of the instance to create. This parameter will - * be used as the instance.name property. - * @return the created component instance. - * @throws ConfigurationException occurs if the type description is - * incorrect - * @throws MissingHandlerException occurs if a handler is not available - * @throws UnacceptableConfiguration occurs if the configuration is not - * acceptable by the instance - * @see org.apache.felix.ipojo.api.ComponentType#start() - * @see PrimitiveComponentType#createInstance() - */ - public ComponentInstance create(String name) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - start(); - if (m_pojo != null) { - Dictionary dict = new Properties(); - dict.put("instance.name", name); - dict.put("instance.object", m_pojo); - return createInstance(dict); - } else { - return createInstance(name); - } - } - - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java deleted file mode 100644 index 713bf0a1a6..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/TemporalDependency.java +++ /dev/null @@ -1,195 +0,0 @@ -/* - * 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.ipojo.api; - -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows configuring a service dependencies. - * @author Felix Project Team - */ -public class TemporalDependency implements HandlerConfiguration { - - /** - * OnTimeout policy: nullable object. - */ - public static final String NULLABLE = "nullable"; - - /** - * OnTimeout policy: empty array or collection. - */ - public static final String EMPTY = "empty"; - - /** - * OnTimeout policy: inject null. - */ - public static final String NULL = "null"; - - - /** - * The required specification. - */ - private String m_specification; - - /** - * The LDAP filter of the dependency. - */ - private String m_filter; - - /** - * The field of the implementation class attached to - * this dependency. - */ - private String m_field; - - /** - * OnTimeout policy. - */ - private String m_onTimeout; - - /** - * Timeout. - */ - private String m_timeout; - - /** - * Proxy. - */ - private boolean m_proxy = false; - - /** - * Gets the dependency metadata. - * @return the 'requires' element describing - * the current dependency. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("requires", "org.apache.felix.ipojo.handler.temporal"); - if (m_specification != null) { - dep.addAttribute(new Attribute("specification", m_specification)); - } - if (m_filter != null) { - dep.addAttribute(new Attribute("filter", m_filter)); - } - if (m_field != null) { - dep.addAttribute(new Attribute("field", m_field)); - } - if (m_onTimeout != null) { - dep.addAttribute(new Attribute("omTimeout", m_onTimeout)); - } - if (m_timeout != null) { - dep.addAttribute(new Attribute("timeout", m_timeout)); - } - if (m_proxy) { - dep.addAttribute(new Attribute("proxy", "true")); - } - - return dep; - } - - /** - * Sets the required service specification. - * @param spec the specification - * @return the current dependency object. - */ - public TemporalDependency setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the dependency filter. - * @param filter the LDAP filter - * @return the current dependency object - */ - public TemporalDependency setFilter(String filter) { - m_filter = filter; - return this; - } - - /** - * Sets the field attached to the dependency. - * @param field the implementation class field name. - * @return the current dependency object - */ - public TemporalDependency setField(String field) { - m_field = field; - return this; - } - - /** - * Sets if the dependency is injected as a proxy. - * @param proxy true to inject proxies. - * @return the current dependency object. - */ - public TemporalDependency setProxy(boolean proxy) { - m_proxy = proxy; - return this; - } - - /** - * Sets the dependency timeout. - * @param time the dependency timeout in ms - * 'infinite' for infinite. - * @return the current dependency object - */ - public TemporalDependency setTimeout(String time) { - m_timeout = time; - return this; - } - - /** - * Sets the dependency timeout. - * @param time the dependency timeout in ms - * @return the current dependency object - */ - public TemporalDependency setTimeout(long time) { - m_timeout = new Long(time).toString(); - return this; - } - - /** - * Sets the dependency ontimeout policy. - * Supports null, nullable, empty, and default-implementation. - * In this latter case, you must specify the qualified class name - * of the default-implementation (instead of default-implementation). - * Default: no action (i.e throws a runtime exception) - * @param tip the ontimeout policy - * @return the current dependency object - */ - public TemporalDependency setOnTimeoutPolicy(String tip) { - m_onTimeout = tip; - return this; - } - - - /** - * Checks dependency configuration validity. - */ - private void ensureValidity() { - // At least a field or methods. - if (m_field == null) { - throw new IllegalStateException("A temporal dependency must have a field"); - } - } - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java deleted file mode 100644 index 9fc3f2668d..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/CompositeComponentType.java +++ /dev/null @@ -1,329 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.api.ComponentType; -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.composite.CompositeFactory; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.BundleContext; - -/** - * Allows defining composite types. - * @author Felix Project Team - */ -public class CompositeComponentType extends ComponentType { - - /** - * The bundle context. - */ - private BundleContext m_context; - - /** - * Component factory attached to the component - * type. - */ - private ComponentFactory m_factory; - - /** - * Component type metadata. - */ - private Element m_metadata; - - /** - * List of provided services. - */ - private List m_provided = new ArrayList(1); - - /** - * List of exported services. - */ - private List m_exported = new ArrayList(1); - - /** - * List of imported services. - */ - private List m_imported = new ArrayList(1); - - /** - * List of instantiated services. - */ - private List m_instantiated = new ArrayList(); - - /** - * List of contained instance. - */ - private List m_contained = new ArrayList(); - - /** - * Is the factory public? - */ - private boolean m_public = true; - - /** - * Component type name. - */ - private String m_name; - - /** - * Component type version. - */ - private String m_version; - - /** - * List of Handler representing external. - * handler configuration - */ - private List m_handlers = new ArrayList(); - - /** - * Checks that the component type is not already - * started. - */ - private void ensureNotInitialized() { - if (m_factory != null) { - throw new IllegalStateException("The component type was already initialized, cannot modify metadata"); - } - } - - /** - * Checks that the component type description is valid. - */ - private void ensureValidity() { - if (m_context == null) { - throw new IllegalStateException("The composite component type has no bundle context"); - } - } - - /** - * Gets the component factory. - * @return the factory attached to this component type. - * @see org.apache.felix.ipojo.api.ComponentType#getFactory() - */ - public Factory getFactory() { - initializeFactory(); - return m_factory; - } - - /** - * Starts the component type. - * @see org.apache.felix.ipojo.api.ComponentType#start() - */ - public void start() { - initializeFactory(); - m_factory.start(); - } - - /** - * Stops the component type. - * @see org.apache.felix.ipojo.api.ComponentType#stop() - */ - public void stop() { - initializeFactory(); - m_factory.stop(); - } - - /** - * Initializes the factory. - */ - private void initializeFactory() { - if (m_factory == null) { - createFactory(); - } - } - - /** - * Sets the bundle context. - * @param bc the bundle context - * @return the current component type - */ - public CompositeComponentType setBundleContext(BundleContext bc) { - ensureNotInitialized(); - m_context = bc; - return this; - } - - /** - * Sets the factory public aspect. - * @param visible false to create a private factory. - * @return the current component type - */ - public CompositeComponentType setPublic(boolean visible) { - ensureNotInitialized(); - m_public = visible; - return this; - } - - /** - * Sets the component type name. - * @param name the factory name - * @return the current component type - */ - public CompositeComponentType setComponentTypeName(String name) { - ensureNotInitialized(); - m_name = name; - return this; - } - - /** - * Sets the component type version. - * @param version the factory version or "bundle" to use the - * bundle version. - * @return the current component type - */ - public CompositeComponentType setComponentTypeVersion(String version) { - ensureNotInitialized(); - m_version = version; - return this; - } - - /** - * Adds a contained instance. - * @param inst the instance to add - * @return the current composite component type - */ - public CompositeComponentType addInstance(Instance inst) { - m_contained.add(inst); - return this; - } - - /** - * Adds an imported (sub-)service. - * @param is the imported service to add - * @return the current composite component type - */ - public CompositeComponentType addSubService(ImportedService is) { - m_imported.add(is); - return this; - } - - /** - * Adds an instantiated sub-service. - * @param is the instantiated service to add - * @return the current composite component type - */ - public CompositeComponentType addSubService(InstantiatedService is) { - m_instantiated.add(is); - return this; - } - - /** - * Adds an exported service. - * @param es the exported service to add - * @return the current composite component type - */ - public CompositeComponentType addService(ExportedService es) { - m_exported.add(es); - return this; - } - - /** - * Adds a provided service. - * @param es the provided service to add - * @return the current composite component type - */ - public CompositeComponentType addService(ProvidedService es) { - m_provided.add(es); - return this; - } - - /** - * Adds an HandlerConfiguration to the component type. Each component type - * implementation must uses the populated list (m_handlers) when generating - * the component metadata. - * @param handler the handler configuration to add - * @return the current component type. - */ - public CompositeComponentType addHandler(HandlerConfiguration handler) { - m_handlers.add(handler); - return this; - } - - /** - * Generates the component description. - * @return the component type description of - * the current component type - */ - private Element generateComponentMetadata() { - Element element = new Element("composite", ""); - if (m_name != null) { - element.addAttribute(new Attribute("name", m_name)); - } - if (m_version != null) { - element.addAttribute(new Attribute("version", m_version)); - } - if (! m_public) { - element.addAttribute(new Attribute("public", "false")); - } - for (int i = 0; i < m_contained.size(); i++) { - Instance inst = (Instance) m_contained.get(i); - element.addElement(inst.getElement()); - } - for (int i = 0; i < m_imported.size(); i++) { - ImportedService inst = (ImportedService) m_imported.get(i); - element.addElement(inst.getElement()); - } - for (int i = 0; i < m_instantiated.size(); i++) { - InstantiatedService inst = (InstantiatedService) m_instantiated.get(i); - element.addElement(inst.getElement()); - } - for (int i = 0; i < m_exported.size(); i++) { - ExportedService inst = (ExportedService) m_exported.get(i); - element.addElement(inst.getElement()); - } - for (int i = 0; i < m_provided.size(); i++) { - ProvidedService inst = (ProvidedService) m_provided.get(i); - element.addElement(inst.getElement()); - } - - // External handlers - for (int i = 0; i < m_handlers.size(); i++) { - HandlerConfiguration hc = (HandlerConfiguration) m_handlers.get(i); - element.addElement(hc.getElement()); - } - - return element; - } - - /** - * Creates the component factory. - */ - private void createFactory() { - ensureValidity(); - m_metadata = generateComponentMetadata(); - try { - m_factory = new CompositeFactory(m_context, m_metadata); - m_factory.start(); - } catch (ConfigurationException e) { - throw new IllegalStateException("An exception occurs during factory initialization", e); - } - - } - - - - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java deleted file mode 100644 index 86fd25c2df..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ExportedService.java +++ /dev/null @@ -1,188 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyModel; - -/** - * Allows defining an exported service. A service export is the - * publication of service from the composite to the parent composite - * or global registry. The service export relies on a service dependency - * inside the composite. Matching services will be exported. - * @author Felix Project Team - */ -public class ExportedService implements HandlerConfiguration { - - /** - * The exported specification. - */ - private String m_specification; - - /** - * The LDAP filter of the service dependency - * used to select the adequate service provider from - * the composite. - */ - private String m_filter; - - /** - * Is the dependency optional? - */ - private boolean m_optional; - - /** - * Is the dependency aggregate? - */ - private boolean m_aggregate; - - /** - * The dependency binding policy. - * Default: Dynamic policy. - */ - private int m_policy = DependencyModel.DYNAMIC_BINDING_POLICY; - - /** - * The dependency comparator. - * (used to compare service providers) - */ - private String m_comparator; - - /** - * Gets the exported service metadata. - * @return the 'provides' element describing - * the current dependency. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("provides", ""); - dep.addAttribute(new Attribute("action", "export")); - - dep.addAttribute(new Attribute("specification", m_specification)); - - - if (m_filter != null) { - dep.addAttribute(new Attribute("filter", m_filter)); - } - if (m_comparator != null) { - dep.addAttribute(new Attribute("comparator", m_comparator)); - } - - if (m_optional) { - dep.addAttribute(new Attribute("optional", "true")); - } - if (m_aggregate) { - dep.addAttribute(new Attribute("aggregate", "true")); - } - - if (m_policy == DependencyModel.DYNAMIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic")); - } else if (m_policy == DependencyModel.STATIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "static")); - } else if (m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic-priority")); - } - - return dep; - } - - /** - * Sets the required service specification. - * @param spec the specification - * @return the current exported service. - */ - public ExportedService setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the dependency filter. - * @param filter the LDAP filter - * @return the current exported service - */ - public ExportedService setFilter(String filter) { - m_filter = filter; - return this; - } - - - /** - * Sets the dependency optionality. - * @param opt true to set the - * dependency to optional. - * @return the current exported service. - */ - public ExportedService setOptional(boolean opt) { - m_optional = opt; - return this; - } - - /** - * Sets the dependency cardinality. - * @param agg true to set the - * dependency to aggregate. - * @return the current exported service. - */ - public ExportedService setAggregate(boolean agg) { - m_aggregate = agg; - return this; - } - - - /** - * Sets the dependency binding policy. - * @param policy the binding policy - * @return the current exported service - */ - public ExportedService setBindingPolicy(int policy) { - m_policy = policy; - return this; - } - - /** - * Sets the dependency comparator. - * @param cmp the comparator class name - * @return the current exported service - */ - public ExportedService setComparator(String cmp) { - m_comparator = cmp; - return this; - } - - - /** - * Checks dependency configuration validity. - */ - private void ensureValidity() { - // Check specification - if (m_specification == null) { - throw new IllegalStateException("The specification of the exported service must be set"); - } - - // Check binding policy. - if (!(m_policy == DependencyModel.DYNAMIC_BINDING_POLICY || m_policy == DependencyModel.STATIC_BINDING_POLICY || m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY)) { - throw new IllegalStateException("Unknown binding policy : " + m_policy); - } - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java deleted file mode 100644 index fbb994fe9d..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ImportedService.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyModel; - -/** - * Allows defining an imported service. A service import is the - * publication of service from the parent composite - * or global registry inside the composite. - * @author Felix Project Team - */ -public class ImportedService implements HandlerConfiguration { - - /** - * Scoping policy: composite. - */ - public static final String COMPOSITE_SCOPE = "composite"; - - /** - * Scoping policy: global. - */ - public static final String GLOBAL_SCOPE = "global"; - - /** - * Scoping policy: composite+global. - */ - public static final String COMPOSITE_AND_GLOBAL_SCOPE = "composite+global"; - - - /** - * The required specification. - */ - private String m_specification; - - /** - * The LDAP filter of the dependency. - */ - private String m_filter; - - /** - * Is the dependency optional? - */ - private boolean m_optional; - - /** - * Is the dependency aggregate? - */ - private boolean m_aggregate; - - /** - * The dependency binding policy. - * Default: Dynamic policy. - */ - private int m_policy = DependencyModel.DYNAMIC_BINDING_POLICY; - - /** - * The dependency comparator. - * (used to compare service providers) - */ - private String m_comparator; - - /** - * The dependency id. - */ - private String m_id; - - /** - * Dependency scope. - */ - private String m_scope = COMPOSITE_SCOPE; - - /** - * Gets the dependency metadata. - * @return the 'requires' element describing - * the current dependency. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("subservice", ""); - dep.addAttribute(new Attribute("action", "import")); - - dep.addAttribute(new Attribute("specification", m_specification)); - dep.addAttribute(new Attribute("scope", m_scope)); - - - if (m_filter != null) { - dep.addAttribute(new Attribute("filter", m_filter)); - } - if (m_comparator != null) { - dep.addAttribute(new Attribute("comparator", m_comparator)); - } - - if (m_id != null) { - dep.addAttribute(new Attribute("id", m_id)); - } - - if (m_optional) { - dep.addAttribute(new Attribute("optional", "true")); - } - if (m_aggregate) { - dep.addAttribute(new Attribute("aggregate", "true")); - } - - if (m_policy == DependencyModel.DYNAMIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic")); - } else if (m_policy == DependencyModel.STATIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "static")); - } else if (m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic-priority")); - } - - return dep; - } - - /** - * Sets the required service specification. - * @param spec the specification - * @return the current imported sub-service. - */ - public ImportedService setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the dependency filter. - * @param filter the LDAP filter - * @return the current imported sub-service - */ - public ImportedService setFilter(String filter) { - m_filter = filter; - return this; - } - - - /** - * Sets the dependency optionality. - * @param opt true to set the - * dependency to optional. - * @return the current imported sub-service. - */ - public ImportedService setOptional(boolean opt) { - m_optional = opt; - return this; - } - - /** - * Sets the dependency cardinality. - * @param agg true to set the - * dependency to aggregate. - * @return the current imported sub-service. - */ - public ImportedService setAggregate(boolean agg) { - m_aggregate = agg; - return this; - } - - - /** - * Sets the dependency binding policy. - * @param policy the binding policy - * @return the current imported sub-service - */ - public ImportedService setBindingPolicy(int policy) { - m_policy = policy; - return this; - } - - /** - * Sets the dependency comparator. - * @param cmp the comparator class name - * @return the current imported sub-service - */ - public ImportedService setComparator(String cmp) { - m_comparator = cmp; - return this; - } - - - /** - * Sets the dependency id. - * @param id the dependency id. - * @return the current imported sub-service. - */ - public ImportedService setId(String id) { - m_id = id; - return this; - } - - /** - * Sets the dependency scope. - * @param scope the dependency scope (global, composite or - * composite+global). - * @return the current imported sub-service. - */ - public ImportedService setScope(String scope) { - m_scope = scope; - return this; - } - - /** - * Checks dependency configuration validity. - */ - private void ensureValidity() { - // Check specification - if (m_specification == null) { - throw new IllegalStateException("The specification of the imported service must be set"); - } - - // Check binding policy. - if (!(m_policy == DependencyModel.DYNAMIC_BINDING_POLICY || m_policy == DependencyModel.STATIC_BINDING_POLICY || m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY)) { - throw new IllegalStateException("Unknown binding policy : " + m_policy); - } - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java deleted file mode 100644 index 0d652b4abd..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/Instance.java +++ /dev/null @@ -1,246 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.Vector; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows defining a contained instance. A contained instance is like - * an instance declaration but the instance is created in the composite. - * @author Felix Project Team - */ -public class Instance implements HandlerConfiguration { - - /** - * Targeted component type. - */ - private String m_type; - - /** - * Configuration. - */ - private List m_conf = new ArrayList(); - - /** - * Creates a Instance. - * @param type the targeted type. - */ - public Instance(String type) { - m_type = type; - } - - /** - * Adds the string property. - * @param name property name - * @param value property value - * @return the current instance - */ - public Instance addProperty(String name, String value) { - Element elem = new Element("property", ""); - m_conf.add(elem); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("value", value)); - return this; - } - - /** - * Adds a list property. - * @param name property name - * @param values the list - * @return the current instance - */ - public Instance addProperty(String name, List values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "list")); - - m_conf.add(elem); - - for (int i = 0; i < values.size(); i++) { - Object obj = values.get(i); - Element e = new Element("property", ""); - elem.addElement(e); - if (obj instanceof String) { - e.addAttribute(new Attribute("value", obj.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds an array property. - * @param name the property name - * @param values the array - * @return the current instance - */ - public Instance addProperty(String name, String[] values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "array")); - - m_conf.add(elem); - - for (int i = 0; i < values.length; i++) { - Object obj = values[i]; - Element e = new Element("property", ""); - elem.addElement(e); - e.addAttribute(new Attribute("value", obj.toString())); - } - - return this; - } - - /** - * Adds a vector property. - * @param name the property name - * @param values the vector - * @return the current instance - */ - public Instance addProperty(String name, Vector values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "vector")); - - m_conf.add(elem); - - for (int i = 0; i < values.size(); i++) { - Object obj = values.get(i); - Element e = new Element("property", ""); - elem.addElement(e); - if (obj instanceof String) { - e.addAttribute(new Attribute("value", obj.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds a map property. - * @param name the property name - * @param values the map - * @return the current instance - */ - public Instance addProperty(String name, Map values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "map")); - - m_conf.add(elem); - Set entries = values.entrySet(); - Iterator it = entries.iterator(); - while (it.hasNext()) { - Map.Entry entry = (Entry) it.next(); - Element e = new Element("property", ""); - elem.addElement(e); - - String n = (String) entry.getKey(); - Object v = entry.getValue(); - if (v instanceof String) { - e.addAttribute(new Attribute("name", n)); - e.addAttribute(new Attribute("value", v.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds a dictionary property. - * @param name the property name - * @param values the dictionary - * @return the current instance - */ - public Instance addProperty(String name, Dictionary values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "dictionary")); - - m_conf.add(elem); - Enumeration e = values.keys(); - while (e.hasMoreElements()) { - Element el = new Element("property", ""); - elem.addElement(el); - - String n = (String) e.nextElement(); - Object v = values.get(n); - if (v instanceof String) { - el.addAttribute(new Attribute("name", n)); - el.addAttribute(new Attribute("value", v.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Ensures the validity of the instance description. - */ - private void ensureValidity() { - if (m_type == null) { - throw new IllegalStateException( - "Invalid containted instance configuration : the component type is not set"); - } - } - - /** - * Gets the instance description in the Element-Attribute form. - * @return the root Element of the instance description - * @see org.apache.felix.ipojo.api.HandlerConfiguration#getElement() - */ - public Element getElement() { - ensureValidity(); - Element instance = new Element("instance", ""); - instance.addAttribute(new Attribute("component", m_type)); - for (int i = 0; i < m_conf.size(); i++) { - Element elem = (Element) m_conf.get(i); - instance.addElement(elem); - } - return instance; - } -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java deleted file mode 100644 index fa67c023e0..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/InstantiatedService.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.Vector; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyModel; - -/** - * Allows defining an instantiated sub-service. An instantiated sub- - * service will be reified by instances publishing the required service. - * Those instances are created from public factories - * inside the composite. - * @author Felix Project Team - */ -public class InstantiatedService implements HandlerConfiguration { - - /** - * The required specification. - */ - private String m_specification; - - /** - * The LDAP filter of the dependency. - */ - private String m_filter; - - /** - * Is the dependency optional? - */ - private boolean m_optional; - - /** - * Is the dependency aggregate? - */ - private boolean m_aggregate; - - /** - * The dependency binding policy. Default: Dynamic policy. - */ - private int m_policy = DependencyModel.DYNAMIC_BINDING_POLICY; - - /** - * The dependency comparator. (used to compare service providers) - */ - private String m_comparator; - - /** - * Instance configuration List of Element (Property). - */ - private List m_conf = new ArrayList(); - - /** - * Gets the dependency metadata. - * @return the 'subservice' element describing the current - * instantiated service. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("subservice", ""); - dep.addAttribute(new Attribute("action", "instantiate")); - - dep.addAttribute(new Attribute("specification", m_specification)); - - if (m_filter != null) { - dep.addAttribute(new Attribute("filter", m_filter)); - } - if (m_comparator != null) { - dep.addAttribute(new Attribute("comparator", m_comparator)); - } - - if (m_optional) { - dep.addAttribute(new Attribute("optional", "true")); - } - if (m_aggregate) { - dep.addAttribute(new Attribute("aggregate", "true")); - } - - if (m_policy == DependencyModel.DYNAMIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic")); - } else if (m_policy == DependencyModel.STATIC_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "static")); - } else if (m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY) { - dep.addAttribute(new Attribute("policy", "dynamic-priority")); - } - - for (int i = 0; i < m_conf.size(); i++) { - Element elem = (Element) m_conf.get(i); - dep.addElement(elem); - } - - return dep; - } - - /** - * Adds a string property. - * @param name the property name - * @param value the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, String value) { - Element elem = new Element("property", ""); - m_conf.add(elem); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("value", value)); - return this; - } - - /** - * Adds a list property. - * @param name the property name - * @param values the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, List values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "list")); - - m_conf.add(elem); - - for (int i = 0; i < values.size(); i++) { - Object obj = values.get(i); - Element e = new Element("property", ""); - elem.addElement(e); - if (obj instanceof String) { - e.addAttribute(new Attribute("value", obj.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds an array property. - * @param name the property name - * @param values the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, String[] values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "array")); - - m_conf.add(elem); - - for (int i = 0; i < values.length; i++) { - Object obj = values[i]; - Element e = new Element("property", ""); - elem.addElement(e); - e.addAttribute(new Attribute("value", obj.toString())); - } - - return this; - } - - /** - * Adds a vector property. - * @param name the property name - * @param values the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, Vector values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "vector")); - - m_conf.add(elem); - - for (int i = 0; i < values.size(); i++) { - Object obj = values.get(i); - Element e = new Element("property", ""); - elem.addElement(e); - if (obj instanceof String) { - e.addAttribute(new Attribute("value", obj.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds a map property. - * @param name the property name - * @param values the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, Map values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "map")); - - m_conf.add(elem); - Set entries = values.entrySet(); - Iterator it = entries.iterator(); - while (it.hasNext()) { - Map.Entry entry = (Entry) it.next(); - Element e = new Element("property", ""); - elem.addElement(e); - - String n = (String) entry.getKey(); - Object v = entry.getValue(); - if (v instanceof String) { - e.addAttribute(new Attribute("name", n)); - e.addAttribute(new Attribute("value", v.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Adds a dictionary property. - * @param name the property name - * @param values the property value - * @return the current instantiated sub-service - */ - public InstantiatedService addProperty(String name, Dictionary values) { - Element elem = new Element("property", ""); - elem.addAttribute(new Attribute("name", name)); - elem.addAttribute(new Attribute("type", "dictionary")); - - m_conf.add(elem); - Enumeration e = values.keys(); - while (e.hasMoreElements()) { - Element el = new Element("property", ""); - elem.addElement(el); - - String n = (String) e.nextElement(); - Object v = values.get(n); - if (v instanceof String) { - el.addAttribute(new Attribute("name", n)); - el.addAttribute(new Attribute("value", v.toString())); - } else { - // TODO - throw new UnsupportedOperationException( - "Complex properties are not supported yet"); - } - } - - return this; - } - - /** - * Sets the required service specification. - * @param spec the specification - * @return the current instantiated sub-service - */ - public InstantiatedService setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the dependency filter. - * @param filter the LDAP filter - * @return the current instantiated sub-service - */ - public InstantiatedService setFilter(String filter) { - m_filter = filter; - return this; - } - - /** - * Sets the dependency optionality. - * @param opt true to set the dependency to optional. - * @return the current instantiated sub-service - */ - public InstantiatedService setOptional(boolean opt) { - m_optional = opt; - return this; - } - - /** - * Sets the dependency cardinality. - * @param agg true to set the dependency to aggregate. - * @return the current instantiated sub-service - */ - public InstantiatedService setAggregate(boolean agg) { - m_aggregate = agg; - return this; - } - - /** - * Sets the dependency binding policy. - * @param policy the binding policy - * @return the current instantiated sub-service - */ - public InstantiatedService setBindingPolicy(int policy) { - m_policy = policy; - return this; - } - - /** - * Sets the dependency comparator. - * @param cmp the comparator class name - * @return the current instantiated sub-service - */ - public InstantiatedService setComparator(String cmp) { - m_comparator = cmp; - return this; - } - - /** - * Checks dependency configuration validity. - */ - private void ensureValidity() { - // Check specification - if (m_specification == null) { - throw new IllegalStateException( - "The specification of the instantiated service must be set"); - } - - // Check binding policy. - if (!(m_policy == DependencyModel.DYNAMIC_BINDING_POLICY - || m_policy == DependencyModel.STATIC_BINDING_POLICY || m_policy == DependencyModel.DYNAMIC_PRIORITY_BINDING_POLICY)) { - throw new IllegalStateException("Unknown binding policy : " - + m_policy); - } - } - -} diff --git a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java b/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java deleted file mode 100644 index 922c992bb2..0000000000 --- a/ipojo/runtime/api/src/main/java/org/apache/felix/ipojo/api/composite/ProvidedService.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Allows defining a provided service. A provided service is a service - * 'implemented' by the composite. This implementations relies (by - * delegation) on contained instances and services. - * @author Felix Project Team - */ -public class ProvidedService implements HandlerConfiguration { - /** - * Delegation policy: all. - */ - public static final String ALL_POLICY = "all"; - - /** - * Delegation policy: one. - */ - public static final String ONE_POLICY = "one"; - - /** - * The provided specification. - */ - private String m_specification; - - /** - * List of delegation. - * List of Element ({delegation $method $policy}) - */ - private List m_delegation = new ArrayList(); - - - /** - * Gets the provided element. - * @return the 'provides' element describing - * the current provided service. - */ - public Element getElement() { - ensureValidity(); - - Element dep = new Element("provides", ""); - dep.addAttribute(new Attribute("action", "implement")); - - dep.addAttribute(new Attribute("specification", m_specification)); - - for (int i = 0; i < m_delegation.size(); i++) { - dep.addElement((Element) m_delegation.get(i)); - } - - return dep; - } - - /** - * Sets the provided service specification. - * @param spec the specification - * @return the current provided service. - */ - public ProvidedService setSpecification(String spec) { - m_specification = spec; - return this; - } - - /** - * Sets the delegation policy of the given method. - * @param method the method name - * @param policy the delegation policy - * @return the current exported service. - */ - public ProvidedService setDelegation(String method, String policy) { - Element element = new Element("delegation", ""); - element.addAttribute(new Attribute("method", method)); - element.addAttribute(new Attribute("policy", policy)); - m_delegation.add(element); - return this; - } - - - /** - * Checks provided service configuration validity. - */ - private void ensureValidity() { - // Check specification - if (m_specification == null) { - throw new IllegalStateException("The specification of the implemented service must be set"); - } - } - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/DependencyTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/DependencyTest.java deleted file mode 100644 index b6641f763f..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/DependencyTest.java +++ /dev/null @@ -1,149 +0,0 @@ -/* - * 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.ipojo.api; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Test the {@link Dependency} methods. - */ -public class DependencyTest extends TestCase { - - public void testConstructorParameter() { - Dependency dep = new Dependency().setConstructorParameter(1); - Element elem = dep.getElement(); - assertEquals("1", elem.getAttribute("constructor-parameter")); - } - - public void testField() { - Dependency dep = new Dependency().setField("field"); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - } - - public void testAggregate() { - Dependency dep = new Dependency().setField("field") - .setAggregate(true); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("true", elem.getAttribute("aggregate")); - } - - public void testOptional() { - Dependency dep = new Dependency().setField("field") - .setOptional(true); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("true", elem.getAttribute("optional")); - } - - public void testNullable() { - Dependency dep = new Dependency().setField("field").setOptional(true) - .setNullable(false); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("true", elem.getAttribute("optional")); - assertEquals("false", elem.getAttribute("nullable")); - - dep = new Dependency().setField("field").setOptional(true) - .setNullable(true); - elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("true", elem.getAttribute("optional")); - assertEquals(null, elem.getAttribute("nullable")); // Default value. - } - - public void testFilter() { - Dependency dep = new Dependency().setField("field") - .setFilter("(my.prop=1)"); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("(my.prop=1)", elem.getAttribute("filter")); - } - - public void testFrom() { - Dependency dep = new Dependency().setField("field") - .setFrom("foo"); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("foo", elem.getAttribute("from")); - } - - public void testId() { - Dependency dep = new Dependency().setField("field") - .setId("foo"); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("foo", elem.getAttribute("id")); - } - - public void testProxy() { - Dependency dep = new Dependency().setField("field").setOptional(true) - .setProxy(false); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("true", elem.getAttribute("optional")); - assertEquals("false", elem.getAttribute("proxy")); - } - - public void testComparator() { - Dependency dep = new Dependency().setField("field") - .setComparator("my.Comparator"); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("my.Comparator", elem.getAttribute("comparator")); - } - - public void testBindingPolicy() { - Dependency dep = new Dependency().setField("field") - .setBindingPolicy(Dependency.DYNAMIC_PRIORITY); - Element elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("dynamic-priority", elem.getAttribute("policy")); - - dep = new Dependency().setField("field") - .setBindingPolicy(Dependency.STATIC); - elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("static", elem.getAttribute("policy")); - - dep = new Dependency().setField("field") - .setBindingPolicy(Dependency.DYNAMIC); - elem = dep.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("dynamic", elem.getAttribute("policy")); - } - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/PropertyTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/PropertyTest.java deleted file mode 100644 index e1a35682dc..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/PropertyTest.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.api; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Test the {@link Property} methods. - */ -public class PropertyTest extends TestCase { - - public void testConstructorParameter() { - Property prop = new Property().setConstructorParameter(1); - Element elem = prop.getElement(); - assertEquals("1", elem.getAttribute("constructor-parameter")); - } - - public void testField() { - Property prop = new Property().setField("field"); - Element elem = prop.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - } - - public void testMandatoryPropertyWithValue() { - Property prop = new Property().setField("field") - .setMandatory(true) - .setName("prop") - .setValue("foo") - .setImmutable(true); - Element elem = prop.getElement(); - assertEquals(null, elem.getAttribute("constructor-parameter")); - assertEquals("field", elem.getAttribute("field")); - assertEquals("prop", elem.getAttribute("name")); - assertEquals("foo", elem.getAttribute("value")); - assertEquals("true", elem.getAttribute("mandatory")); - assertEquals("true", elem.getAttribute("immutable")); - } - - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/ServiceTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/ServiceTest.java deleted file mode 100644 index 02c0bb1c8e..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/ServiceTest.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.api; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.metadata.Element; - -import junit.framework.TestCase; - -/** - * Test the {@link Service} methods. - */ -public class ServiceTest extends TestCase { - - public void testServiceController() { - Service svc = new Service().setServiceController("m_controller", true); - - Element elem = svc.getElement(); - assertTrue(elem.getElements("controller").length == 1); - Element controller = elem.getElements("controller")[0]; - assertEquals("m_controller", controller.getAttribute("field")); - assertEquals("true", controller.getAttribute("value")); - - svc = new Service().setServiceController("m_controller", false); - elem = svc.getElement(); - assertTrue(elem.getElements("controller").length == 1); - controller = elem.getElements("controller")[0]; - assertEquals("m_controller", controller.getAttribute("field")); - assertEquals("false", controller.getAttribute("value")); - } - - public void testRegistrationCallbacks() { - Service svc = new Service() - .setPostRegistrationCallback("registration") - .setPostUnregistrationCallback("unregistration"); - - Element elem = svc.getElement(); - assertEquals("registration", elem.getAttribute("post-registration")); - assertEquals("unregistration", elem.getAttribute("post-unregistration")); - } - - public void testSpecificationWithOneService() { - Service svc = new Service() - .setSpecification("org.foo.acme.MyService"); - - Element elem = svc.getElement(); - assertEquals("org.foo.acme.MyService", elem.getAttribute("specifications")); - } - - public void testSpecificationWithTwoServices() { - List spec = new ArrayList(); - spec.add("org.foo.acme.MyService"); - spec.add("org.foo.acme.MyService2"); - Service svc = new Service() - .setSpecifications(spec); - - Element elem = svc.getElement(); - assertEquals("{org.foo.acme.MyService,org.foo.acme.MyService2}", elem.getAttribute("specifications")); - } - - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java deleted file mode 100644 index 3a7dd37b6f..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ExportedServiceTest.java +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Test about {@link ExportedService}. - * @author Felix Project Team - */ -public class ExportedServiceTest extends TestCase { - - // - // - // - // - // - - // - /** - * Tests simple export. - */ - public void testSimple() { - ExportedService svc = new ExportedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.BazService"); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.BazService", - spec); - } - - /** - * Tests a malformed export. - */ - public void testBad() { - ExportedService svc = new ExportedService() - // .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") - // NO SPEC - ; - try { - svc.getElement(); - fail("Invalid element accepted"); - } catch (IllegalStateException e) { - // OK - } - } - - // - /** - * Tests aggregate export. - */ - public void testAggregate() { - ExportedService svc = new ExportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.BazService") - .setAggregate(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String agg = elem.getAttribute("aggregate"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.BazService", - spec); - assertEquals("aggregate", "true", agg); - } - - // - /** - * Tests optional export. - */ - public void testOptional() { - ExportedService svc = new ExportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.BazService") - .setOptional(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String opt = elem.getAttribute("optional"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.BazService", - spec); - assertEquals("optional", "true", opt); - } - - // - /** - * Tests optional and aggregate export. - */ - public void testOptionalAndAggregate() { - ExportedService svc = new ExportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setOptional(true).setAggregate(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String opt = elem.getAttribute("optional"); - String agg = elem.getAttribute("aggregate"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("optional", "true", opt); - assertEquals("aggregate", "true", agg); - } - - // - /** - * Tests filtered export. - */ - public void testFilter() { - ExportedService svc = new ExportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setFilter("(&(int=2)(long=40))"); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String filter = elem.getAttribute("filter"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("filter", "(&(int=2)(long=40))", filter); - } - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java deleted file mode 100644 index 3c889bf9ea..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/ImportedServiceTest.java +++ /dev/null @@ -1,192 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Tests about {@link ImportedService}. - * @author Felix Project Team - */ -public class ImportedServiceTest extends TestCase { - - // - // - // - /** - * Simple test. - */ - public void testSimple() { - ImportedService svc = new ImportedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService"); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - } - - /** - * Malformed import. - */ - public void testBad() { - ImportedService svc = new ImportedService() - // .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") - // NO SPEC - ; - try { - svc.getElement(); - fail("Invalid element accepted"); - } catch (IllegalStateException e) { - // OK - } - } - - /** - * Tests scopes. - */ - public void testScope() { - ImportedService svc = new ImportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setScope(ImportedService.COMPOSITE_SCOPE); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String scope = elem.getAttribute("scope"); - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("scope", "composite", scope); - - } - - // - // - // - // - /** - * Tests aggregate. - */ - public void testAggregate() { - ImportedService svc = new ImportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setScope(ImportedService.COMPOSITE_SCOPE).setAggregate(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String scope = elem.getAttribute("scope"); - String agg = elem.getAttribute("aggregate"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("scope", "composite", scope); - assertEquals("aggregate", "true", agg); - } - - // - // - // - // - /** - * Tests optional. - */ - public void testOptional() { - ImportedService svc = new ImportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setScope(ImportedService.COMPOSITE_SCOPE).setOptional(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String scope = elem.getAttribute("scope"); - String opt = elem.getAttribute("optional"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("scope", "composite", scope); - assertEquals("optional", "true", opt); - } - - // - // - // - // - /** - * Tests optional and aggregate. - */ - public void testOptionalAndAggregate() { - ImportedService svc = new ImportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setScope(ImportedService.COMPOSITE_SCOPE).setOptional(true) - .setAggregate(true); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String scope = elem.getAttribute("scope"); - String opt = elem.getAttribute("optional"); - String agg = elem.getAttribute("aggregate"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("scope", "composite", scope); - assertEquals("optional", "true", opt); - assertEquals("aggregate", "true", agg); - } - - // - // - // - // - /** - * Tests filter. - */ - public void testFilter() { - ImportedService svc = new ImportedService().setSpecification( - "org.apache.felix.ipojo.test.composite.service.FooService") - .setScope(ImportedService.COMPOSITE_SCOPE).setFilter( - "(&(int=2)(long=40))"); - - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String scope = elem.getAttribute("scope"); - String filter = elem.getAttribute("filter"); - - assertEquals("spec", - "org.apache.felix.ipojo.test.composite.service.FooService", - spec); - assertEquals("scope", "composite", scope); - assertEquals("filter", "(&(int=2)(long=40))", filter); - } - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java deleted file mode 100644 index 02ab48420a..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstanceTest.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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.ipojo.api.composite; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Properties; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Tests about {@link Instance}. - * @author Felix Project Team - */ -public class InstanceTest extends TestCase { - - /** - * One simple instance. - */ - public void testJustComponent() { - Instance inst = new Instance("mycmp"); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - assertEquals("Check component attribute", "mycmp", cmp); - } - - /** - * Sting property. - */ - public void testStringProp() { - Instance inst = new Instance("mycmp"); - inst.addProperty("p1", "v1"); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - - assertEquals("Check property 0 - name", "p1", n); - assertEquals("Check property 0 - value", "v1", v); - assertNull("Check property 0 - type", t); - - } - - /** - * Several properties. - */ - public void testStringProps() { - Instance inst = new Instance("mycmp"); - inst.addProperty("p1", "v1"); - inst.addProperty("p2", "v2"); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 2, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - assertEquals("Check property 0 - name", "p1", n); - assertEquals("Check property 0 - value", "v1", v); - n = elems[1].getAttribute("name"); - v = elems[1].getAttribute("value"); - assertEquals("Check property 1 - name", "p2", n); - assertEquals("Check property 1 - value", "v2", v); - } - - /** - * List property. - */ - public void testListProp() { - Instance inst = new Instance("mycmp"); - List list = new ArrayList(); - list.add("a"); - list.add("a"); - list.add("a"); - - inst.addProperty("p1", list); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - assertEquals("Check property 0 - name", "p1", n); - assertNull("Check property 0 - value", v); - assertEquals("Check property 0 - type", "list", t); - - - Element[] subs = elems[0].getElements(); - assertEquals("Check the number of sub-elements", 3, subs.length); - for (int i = 0; i < subs.length; i++) { - Element a = subs[i]; - assertEquals("Check the value of " + i, "a", a.getAttribute("value")); - assertNull("Check the name of " + i, a.getAttribute("name")); - - } - } - - /** - * Array property. - */ - public void testArrayProp() { - Instance inst = new Instance("mycmp"); - String[] list = new String[] {"a", "a", "a"}; - - inst.addProperty("p1", list); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - assertEquals("Check property 0 - name", "p1", n); - assertNull("Check property 0 - value", v); - assertEquals("Check property 0 - type", "array", t); - - - Element[] subs = elems[0].getElements(); - assertEquals("Check the number of sub-elements", 3, subs.length); - for (int i = 0; i < subs.length; i++) { - Element a = subs[i]; - assertEquals("Check the value of " + i, "a", a.getAttribute("value")); - assertNull("Check the name of " + i, a.getAttribute("name")); - - } - } - - /** - * Vector property. - */ - public void testVectorProp() { - Instance inst = new Instance("mycmp"); - Vector list = new Vector(); - list.add("a"); - list.add("a"); - list.add("a"); - - inst.addProperty("p1", list); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - - assertEquals("Check property 0 - name", "p1", n); - assertNull("Check property 0 - value", v); - assertEquals("Check property 0 - type", "vector", t); - - - Element[] subs = elems[0].getElements(); - assertEquals("Check the number of sub-elements", 3, subs.length); - for (int i = 0; i < subs.length; i++) { - Element a = subs[i]; - assertEquals("Check the value of " + i, "a", a.getAttribute("value")); - assertNull("Check the name of " + i, a.getAttribute("name")); - - } - } - - /** - * Map property. - */ - public void testMapProp() { - Instance inst = new Instance("mycmp"); - Map map = new HashMap(); - map.put("p1", "b"); - map.put("p2", "b"); - map.put("p3", "b"); - - inst.addProperty("p1", map); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - - assertEquals("Check property 0 - name", "p1", n); - assertNull("Check property 0 - value", v); - assertEquals("Check property 0 - type", "map", t); - - Element[] subs = elems[0].getElements(); - assertEquals("Check the number of sub-elements", 3, subs.length); - for (int i = 0; i < subs.length; i++) { - Element a = subs[i]; - assertEquals("Check the value of " + i, "b", a.getAttribute("value")); - assertNotNull("Check the name of " + i, a.getAttribute("name")); - - } - } - - /** - * Dictionary property. - */ - public void testDictProp() { - Instance inst = new Instance("mycmp"); - Dictionary map = new Properties(); - map.put("p1", "b"); - map.put("p2", "b"); - map.put("p3", "b"); - - inst.addProperty("p1", map); - Element elem = inst.getElement(); - String cmp = elem.getAttribute("component"); - Element[] elems = elem.getElements(); - assertEquals("Check component attribute", "mycmp", cmp); - assertNotNull("Check properties", elems); - assertEquals("Check properties count", 1, elems.length); - String n = elems[0].getAttribute("name"); - String v = elems[0].getAttribute("value"); - String t = elems[0].getAttribute("type"); - - - assertEquals("Check property 0 - name", "p1", n); - assertNull("Check property 0 - value", v); - assertEquals("Check property 0 - type", "dictionary", t); - - - Element[] subs = elems[0].getElements(); - assertEquals("Check the number of sub-elements", 3, subs.length); - for (int i = 0; i < subs.length; i++) { - Element a = subs[i]; - assertEquals("Check the value of " + i, "b", a.getAttribute("value")); - assertNotNull("Check the name of " + i, a.getAttribute("name")); - - } - } - -} diff --git a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java b/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java deleted file mode 100644 index ec878bf1ef..0000000000 --- a/ipojo/runtime/api/src/test/java/org/apache/felix/ipojo/api/composite/InstantiatedServiceTest.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.ipojo.api.composite; - - -import junit.framework.TestCase; - -import org.apache.felix.ipojo.metadata.Element; - -/** - * Tests about {@link InstantiatedService}. - * @author Felix Project Team - */ -public class InstantiatedServiceTest extends TestCase { - -// -// -// - - /** - * Simple test. - */ - public void testSimple() { - InstantiatedService svc = new InstantiatedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService"); - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String action = elem.getAttribute("action"); - - assertEquals("spec" , "org.apache.felix.ipojo.test.composite.service.BarService", spec); - assertEquals("action" , "instantiate", action); - } - - /** - * Malformed instantiated service. - */ - public void testBad() { - InstantiatedService svc = new InstantiatedService() - //.setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") NO SPEC - ; - try { - svc.getElement(); - fail("Invalid element accepted"); - } catch (IllegalStateException e) { - // OK - } - } - - - - -// -// -// -// - - /** - * Aggregate. - */ - public void testAggregate() { - InstantiatedService svc = new InstantiatedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") - .setAggregate(true); - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String action = elem.getAttribute("action"); - String agg = elem.getAttribute("aggregate"); - - - assertEquals("spec" , "org.apache.felix.ipojo.test.composite.service.BarService", spec); - assertEquals("action" , "instantiate", action); - assertEquals("aggregate" , "true", agg); - - } - -// -// -// -// - /** - * Optional. - */ - public void testOptional() { - InstantiatedService svc = new InstantiatedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.BarService") - .setOptional(true); - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String action = elem.getAttribute("action"); - String agg = elem.getAttribute("aggregate"); - String opt = elem.getAttribute("optional"); - - assertEquals("spec" , "org.apache.felix.ipojo.test.composite.service.BarService", spec); - assertEquals("action" , "instantiate", action); - assertNull("aggregate" , agg); - assertEquals("optional" , "true", opt); - } - -// -// -// -// - /** - * Aggregate and optional. - */ - public void testOptionalAndAggregate() { - InstantiatedService svc = new InstantiatedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService") - .setOptional(true) - .setAggregate(true); - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String action = elem.getAttribute("action"); - String agg = elem.getAttribute("aggregate"); - String opt = elem.getAttribute("optional"); - - assertEquals("spec" , "org.apache.felix.ipojo.test.composite.service.FooService", spec); - assertEquals("action" , "instantiate", action); - assertEquals("aggregate" , "true", agg); - assertEquals("optional" , "true", opt); - } - -// -// -// -// -// -// -// -// -// - /** - * Instance configuration. - */ - public void testWithConfiguration() { - InstantiatedService svc = new InstantiatedService() - .setSpecification("org.apache.felix.ipojo.test.composite.service.FooService") - .addProperty("boolean", "true") - .addProperty("string", "foo") - .addProperty("stringAprop", new String[] {"foo", "bar", "baz" }) - .addProperty("int", "5"); - Element elem = svc.getElement(); - String spec = elem.getAttribute("specification"); - String action = elem.getAttribute("action"); - String agg = elem.getAttribute("aggregate"); - String opt = elem.getAttribute("optional"); - - assertEquals("spec" , "org.apache.felix.ipojo.test.composite.service.FooService", spec); - assertEquals("action" , "instantiate", action); - assertNull("aggregate" , agg); - assertNull("optional" , opt); - - Element[] props = elem.getElements("property"); - assertEquals("Number of properties", 4, props.length); - String n0 = props[0].getAttribute("name"); - String v0 = props[0].getAttribute("value"); - assertEquals("n0" , "boolean", n0); - assertEquals("v0" , "true", v0); - - String n1 = props[1].getAttribute("name"); - String v1 = props[1].getAttribute("value"); - assertEquals("n1" , "string", n1); - assertEquals("v1" , "foo", v1); - - String n2 = props[2].getAttribute("name"); - String v2 = props[2].getAttribute("value"); - String t2 = props[2].getAttribute("type"); - Element[] sub = props[2].getElements(); - assertEquals("Number of sub-properties", 3, sub.length); - assertEquals("n2", "stringAprop", n2); - assertNull("v2", v2); - assertEquals("t2", "array", t2); - - String n20 = sub[0].getAttribute("name"); - String v20 = sub[0].getAttribute("value"); - assertNull("n20" , n20); - assertEquals("v20" , "foo", v20); - String n21 = sub[1].getAttribute("name"); - String v21 = sub[1].getAttribute("value"); - assertNull("n21" , n21); - assertEquals("v21" , "bar", v21); - String n22 = sub[2].getAttribute("name"); - String v22 = sub[2].getAttribute("value"); - assertNull("n22" , n22); - assertEquals("v22" , "baz", v22); - - String n3 = props[3].getAttribute("name"); - String v3 = props[3].getAttribute("value"); - assertEquals("n3" , "int", n3); - assertEquals("v3" , "5", v3); - } - - -} diff --git a/ipojo/runtime/changelog.txt b/ipojo/runtime/changelog.txt deleted file mode 100644 index 96c9be5475..0000000000 --- a/ipojo/runtime/changelog.txt +++ /dev/null @@ -1,223 +0,0 @@ -Changes from 1.12.0 to 1.12.1 ------------------------------ - -** Bug - * [FELIX-3836] - NPE when calling InstanceDescription.getDescription() - * [FELIX-4565] - Occasional ArrayIndexOutOfBoundException in iPOJO's ProvidedServiceHandler - * [FELIX-4646] - @Context(Context.Source.INSTANCE) does not inject bundle context - * [FELIX-4713] - Error in ProvidedServiceHandler.checkProvidedService : only the first service is checked - * [FELIX-4715] - instance bundle context injection does not works - * [FELIX-4716] - Bundle org.apache.felix.ipojo physically contains OSGi API classes - * [FELIX-4717] - Cannot use the stream API on injected collections - * [FELIX-4728] - InstanceManager concurrency issue - -Changes from 1.11.2 to 1.12.0 ------------------------------ - -** Bug - * [FELIX-4464] - Wrong configuration admin package import / export clause - * [FELIX-4488] - Attempt to create nullable object for non-interface service - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - * [FELIX-4490] - IPOJO allows "instance.name" property to be an empty String - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - * [FELIX-4510] - Support lambda expression - -Changes from 1.11.1 to 1.11.2 ------------------------------ - -** Bug - * [FELIX-4229] - Provide a way to obtain the component's BundleContext (other than constructor injection) - * [FELIX-4419] - Open access to InstanceDeclaration and TypeDeclaration - * [FELIX-4432] - DefaultServiceRankingInterceptor holds duplicate dependencies - * [FELIX-4448] - Invalid dynamism management when an interceptor implements both Tracking and Ranking interceptors - * [FELIX-4449] - The ConfigurationListener list contains duplicates and fires update on unchanged configurations - -** Improvement - * [FELIX-3931] - Provide a handler to inject the bundle context - * [FELIX-4160] - Create an Maven Parent POM for iPOJO - -Changes from 1.11.0 to 1.11.1 ------------------------------ - -** Bug - * [FELIX-4335] - PropertyDescription does not allow retrieving the current value of the represented property - * [FELIX-4374] - iPOJO: ConcurrentModificationException in ProvidedService - * [FELIX-4386] - Deadlock while creating composite instances programmatically - -** Improvement - * [FELIX-4292] - @Component 'propagation' attribute has wrong default value - -Changes from 1.10.1 to 1.11.0 ------------------------------ - -** Bug - * [FELIX-4115] - NPE in DependencyModel.getService() when @Bind method throws an exception - * [FELIX-4132] - @Modified not working on Equinox - * [FELIX-4138] - TypeDeclaration calls factory.dispose() even if it already has been disposed (externally) - * [FELIX-4139] - package conflict with ipojo-annotations and ipojo-runtime - * [FELIX-4164] - Instance / Component matching regression - * [FELIX-4172] - Updated method called twice at the bundle start - * [FELIX-4183] - Wrong Javadoc of TrackerCustomizer addingService method - * [FELIX-4199] - The filter based service tracking interceptor should always be created - * [FELIX-4200] - Only the last iPOJO Tracking interceptor is modifying the reference - * [FELIX-4204] - Service Dependencies with a callback without a type attribute must be rejected - * [FELIX-4207] - ipojo @Component with propagation set to true doesn't propagate properties - * [FELIX-4218] - NPE with field annotated with both @Property and @ServiceProperty - * [FELIX-4236] - Unvalued properties should be part of the instance's architecture - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - * [FELIX-4248] - ServiceUsage ThreadLocal removal - * [FELIX-4250] - Specification deduction broken when the method does not start with the 'bind' prefix - * [FELIX-4251] - The @Bind annotation should use Class instead of String - * [FELIX-4261] - NPE when an instance is declared without a configuration using the @ConfigurationTracker - * [FELIX-4268] - Duplicated name errors always happen when there are 2 factories with the same name - -** Improvement - * [FELIX-4143] - Improve @Configuration management performances - * [FELIX-4216] - Allow @Property without name in constructors - * [FELIX-4228] - Improve dependency identification in log messages and exceptions - * [FELIX-4232] - Service Dependency Interceptors should be part of the instance architecture - * [FELIX-4252] - Make Extender's ThreadPool size configurable - * [FELIX-4262] - QueueServices should be observable - * [FELIX-4263] - iPOJO Core should use ranged imports - * [FELIX-4264] - JobInfo should provide a way to identify the kind of task - -** New Feature - * [FELIX-4146] - Add getInstances and getInstanceNames in the Factory interface - * [FELIX-4147] - Add getProvidedService in ProvidedServiceDescription and allow external service management - * [FELIX-4215] - Extend manipulation metadata with argument names - * [FELIX-4231] - Provide service binding interceptors - * [FELIX-4265] - Provides a recorder for startup events - * [FELIX-4267] - Define Apache Karaf features for iPOJO - -** Task - * [FELIX-3925] - Merge the temporal dependency handler within the service dependency handler - * [FELIX-4133] - Add distribution creation in the iPOJO runtime build - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4136] - Document service dependency interceptors - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4217] - Ensure compatibility between Aries Blueprint and iPOJO - * [FELIX-4245] - Deadlock in Dependency - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4239] - Extend service dependency documentation with the 'exception' attribute. - * [FELIX-4240] - Support the 'exception' attribute in service dependencies - * [FELIX-4242] - Support the 'timeout' attribute in service dependencies - * [FELIX-4243] - Define the dependency configuration matrix and improve error detection - * [FELIX-4244] - Extend the service dependency documentation with the timeout attribute - * [FELIX-4257] - Allow the dependency handler to track the entry and exit of inner class methods - -Changes from 1.10.0 to 1.10.1 ------------------------------ - -** Bug - * [FELIX-4072] - onGet and onSet methods do not provide the reference on the pojo object - * [FELIX-4076] - Useless locking on getRequiredHandler - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4089] - Extender do not deactivate managed components when stopped - * [FELIX-4096] - NPE when retrieve required and missing handler on a disposed factory - * [FELIX-4105] - Factories not disposed when their bundle is leaving - * [FELIX-4106] - Defensive service registration and update - * [FELIX-4108] - Deadlock in the new extender - * [FELIX-4109] - ComponentTypeDescription.addProperty() ignore immutable parameter - * [FELIX-4113] - Factories not disposed when the extension provider is leaving - * [FELIX-4114] - iPOJO ProvidedServiceDescription does not expose policy & CreationStrategy - * [FELIX-4123] - Deadlock in new extender because of factory lock used in removedService - * [FELIX-4127] - Configuration tracker bug when starting and stopping iPOJO successively - * [FELIX-4129] - Cannot change the optionality of a dependency - -** Improvement - * [FELIX-1430] - Notification mechanism on bind/unbind events - * [FELIX-4073] - PrimitiveHandler.attach(ComponentInstance) is final - * [FELIX-4119] - Allow customization of DependencyHandler created Callbacks - -** New Feature - * [FELIX-4116] - Ability to listen for component service dependencies, providings, configuration properties, ... - * [FELIX-4120] - Allow external entity to interact during the service resolution - * [FELIX-4125] - Provide 'components' and 'component' commands - * [FELIX-4130] - Allow retrieving the component instance from the instance description - * [FELIX-4131] - Explicitly set configuration's location when the configuration is null - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - * [FELIX-4124] - Move arch-gogo to runtime - - -Changes from 1.8.6 to 1.10.0 ----------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3843] - ClassCastException when listing service properties of a non-ComponentFactory Factory service - * [FELIX-3895] - iPOJO instance is not shown (with the "arch" commands) if constructor is failing - * [FELIX-3896] - Null reference are injected with @Bind(optional=false) method on iPOJO components - * [FELIX-3918] - iPOJO Logger cannot be dynamically configured on Equinox and KF - * [FELIX-3919] - iPOJO Proxies strategy cannot be configured dynamically on Equinox and KF - * [FELIX-3920] - Creation Strategy does not work on KF3 - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4041] - Properties starting with . should not be propagated - * [FELIX-4048] - @Requires handler does not fail when no specification can be found - * [FELIX-4053] - Avoid @StaticServiceProperty to be used on classes - * [FELIX-4054] - Use current factory version to generate instance name if required - -** Improvement - * [FELIX-3860] - factories and instances iPOJO gogo commands should show the "public=false" instances/factories - * [FELIX-3932] - Allow dependency filter's to get context-source variables - * [FELIX-4040] - Implement config admin support to handle binding location properly - * [FELIX-4045] - Chain Exceptions when possible - -** New Feature - * [FELIX-4034] - Instance configuration DSL - -** Task - * [FELIX-3892] - Upgrade runtime codebase to Java 5 - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3948] - Define a new extender model - * [FELIX-3978] - Check that we don't use java 6+ API - -** Wish - * [FELIX-3926] - Provide metadata for the Extender namespace - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3742] - Implementing class fails to load unless super interface's (interface extended by implemented interface) package is imported. - * [FELIX-3789] - Deadlock due to synchronization on INSTANCE_NAME - * [FELIX-3819] - The export directive of iPOJO is wrong - -Changes from the 1.8.2 to 1.8.4 --------------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3500] - InstanceManager concurrency issue: "A methodID cannot be associated with a method from the POJO class" - * [FELIX-3501] - IPojo FactoryStateListener doesn't get notified while stopping factory - * [FELIX-3545] - Memory leak when unregistering a component used by an aggregate dependency with an unbind callback - * [FELIX-3548] - Concurrent access during startup - * [FELIX-3567] - iPOJO Configuration Handler should not reuse the dictionary object from the configuration admin - * [FELIX-3576] - iPOJO fails when using constructor injection and expecting BundleContext in ctor - * [FELIX-3599] - Problem with 'subservice action="instantiate"' in ipojo composite - * [FELIX-3621] - Two dimensional array as argument to a method in a component - * [FELIX-3672] - Potential Concurrent Modification Exception when a bundle is stopped - -** Improvement - * [FELIX-3560] - Extensions to IPojo's Factory and ComponentInstance documentation for custom handlers - - -Version 1.8.2 -------------- - * Initial release diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/pom.xml b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/pom.xml deleted file mode 100644 index fc9bb16a4f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.composite-it - 1.12.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - - ipojo-composite-import-export-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java deleted file mode 100644 index 20e2773499..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class Baz2CheckProvider implements CheckService { - - BazService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int simpleU = 0; - int objectU = 0; - int refU = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("result", new Boolean(fs.foo())); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - - return props; - } - - private void voidBind() { - simpleB++; - } - private void voidUnbind() { - simpleU++; - } - - protected void objectBind(Object o) { - if(o != null && o instanceof FooService) { objectB++; } - } - protected void objectUnbind(Object o) { - if(o != null && o instanceof FooService) { objectU++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java deleted file mode 100644 index 5711222bb3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; - -import java.util.Properties; - -public class BazProviderType1 implements BazService { - - private int m_bar; - private String m_foo; - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - p.put("foo", m_foo); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index c53570bdc9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index a0e9e430dc..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 700d9fe49a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java deleted file mode 100644 index f1732ba9e3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn2 implements FooService { - - private int intProp = 2; - private boolean boolProp = true; - private String strProp = "foo"; - private String[] strAProp = new String[] {"foo", "bar"}; - private int[] intAProp = new int[] {1, 2, 3}; - - public boolean foo() { - intAProp = null; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java deleted file mode 100644 index 84f9e3628e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Tata; - -import java.util.Properties; - - -public class TataProvider implements Tata { - - int tata = 0; - int tataStr = 0; - int tataStrs = 0; - int tata_2 = 0; - int tata_3 = 0; - int tata1 = 0; - int tata1_1 = 0; - int tata5 = 0; - int tata5_1 = 0; - int tata5_2 = 0; - int tataBoolean = 0; - int tataBooleans = 0; - int tataByte = 0; - int tataBytes = 0; - private int add; - private int tataShorts; - private int tataShort; - private int tataLongs; - private int tataLong; - private int tataInts; - private int tataInt; - private int tataFloat; - private int tataFloats; - private int tataDoubles; - private int tataDouble; - private int tataChars; - private int tataChar; - - public Properties getPropsTata() { - Properties props = new Properties(); - props.put("tata", new Integer(tata)); - props.put("tataStr", new Integer(tataStr)); - props.put("tataStrs", new Integer(tataStrs)); - props.put("tata_2", new Integer(tata_2)); - props.put("tata_3", new Integer(tata_3)); - props.put("tata1", new Integer(tata1)); - props.put("tata1_1", new Integer(tata1_1)); - props.put("tata5", new Integer(tata5)); - props.put("tata5_1", new Integer(tata5_1)); - props.put("tata5_2", new Integer(tata5_2)); - props.put("add", new Integer(add)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataByte", new Integer(tataByte)); - props.put("tataBytes", new Integer(tataBytes)); - props.put("tataShort", new Integer(tataShort)); - props.put("tataShorts", new Integer(tataShorts)); - props.put("tataLongs", new Integer(tataLongs)); - props.put("tataLong", new Integer(tataLong)); - props.put("tataInt", new Integer(tataInt)); - props.put("tataInts", new Integer(tataInts)); - props.put("tataFloat", new Integer(tataFloat)); - props.put("tataFloats", new Integer(tataFloats)); - props.put("tataDouble", new Integer(tataDouble)); - props.put("tataDoubles", new Integer(tataDoubles)); - props.put("tataChar", new Integer(tataChar)); - props.put("tataChars", new Integer(tataChars)); - return props; - } - - public void tata() { - tata++; - } - - public String tataStr() { - tataStr++; - return "Tata"; - } - - public String[] tataStrs() { - tataStrs++; - return new String[] {"T", "A", "T", "A"}; - } - - public void tata(int i, int j) { - tata_2++; - } - - public void tata(String s) { - tata_3++; - } - - public String tata1(String a) { - tata1++; - return a; - } - - public String tata1(char[] a) { - tata1_1++; - String s = new String(a); - return s; - } - - public String tata5(String a, int i) { - tata5++; - return a+i; - } - - public String tata5(String[] a, int i) { - tata5_1++; - return ""+a.length + i; - } - - public String tata5(String a, int[] i) { - tata5_2++; - return a + i.length; - } - - public boolean tataBoolean(boolean b) { - tataBoolean++; - return b; - } - - public boolean[] tataBooleans(boolean[] b) { - tataBooleans++; - return b; - } - - public byte tataByte(byte b) { - tataByte++; - return b; - } - - public byte[] tataBytes(byte[] b) { - tataBytes++; - return b; - } - - public char tataChar(char c) { - tataChar++; - return c; - } - - public char[] tataChars(char[] c) { - tataChars++; - return c; - } - - public double tataDouble(double d) { - tataDouble++; - return d; - } - - public double[] tataDoubles(double[] d) { - tataDoubles++; - return d; - } - - public float tataFloat(float f) { - tataFloat++; - return f; - } - - public float[] tataFloats(float[] f) { - tataFloats++; - return f; - } - - public int tataInt(int i) { - tataInt++; - return i; - } - - public int[] tataInts(int[] its) { - tataInts++; - return its; - } - - public long tataLong(long l) { - tataLong++; - return l; - } - - public long[] tataLongs(long[] l) { - tataLongs++; - return l; - } - - public short tataShort(short s) { - tataShort++; - return s; - } - - public short[] tataShorts(short[] s) { - tataShorts++; - return s; - } - - public long add(int i, int j, int k) { - add++; - return i + j + k; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java deleted file mode 100644 index 5c2c03391c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProvider implements Toto { - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - } - - public void toto(int i, int j) { - toto_2++; - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("toto", new Integer(toto)); - props.put("toto_2", new Integer(toto_2)); - props.put("toto_3", new Integer(toto_3)); - props.put("toto_4", new Integer(toto_4)); - props.put("toto1", new Integer(toto1)); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java deleted file mode 100644 index dccebafe70..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProviderGlue implements Toto { - - Toto m_toto; - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - m_toto.toto(); - } - - public void toto(int i, int j) { - toto_2++; - m_toto.toto(i, j); - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - m_toto.toto1(j); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("gtoto", new Integer(toto)); - props.put("gtoto_2", new Integer(toto_2)); - props.put("gtoto_3", new Integer(toto_3)); - props.put("gtoto_4", new Integer(toto_4)); - props.put("gtoto1", new Integer(toto1)); - props.put("glue", "glue"); - Properties p2 = m_toto.getProps(); - props.putAll(p2); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index 5e2b59a0e4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 62eb08d3ae..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java deleted file mode 100644 index b9cec949b7..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BazService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java deleted file mode 100644 index a65e2ddb46..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tata { - - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java deleted file mode 100644 index 82d307c2b0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tota { - - public static final String specification="specification { " + - "requires { " + - "$specification=\"org.apache.felix.ipojo.test.composite.service.Toto\" " + - "$optional=\"true\" " + - "$aggregate=\"true\" " + - "$type=\"service\" " + - "} }"; - - public Properties getProps() throws UnsupportedOperationException;; - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - - public void toto() throws UnsupportedOperationException; - public void toto(int i, int j) throws UnsupportedOperationException; - public String toto(String a) throws UnsupportedOperationException; - - public void toto1(String j) throws UnsupportedOperationException; - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java deleted file mode 100644 index 037dad355f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Toto { - - public Properties getProps(); - - public void toto(); - public void toto(int i, int j); - public String toto(String a); - public String toto(String[] a); - - public void toto1(String j); - - public int count(); - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata-import-export.xml b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata-import-export.xml deleted file mode 100644 index 26a1407653..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata-import-export.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata.xml b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata.xml deleted file mode 100644 index d70c60b1d4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 13a950fd38..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.junit.runner.RunWith; -import org.ops4j.pax.exam.junit.PaxExam; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import static junit.framework.Assert.fail; - -/** - * Bootstrap the test from this project - */ -@ExamReactorStrategy(PerMethod.class) -public class Common extends BaseTest { - - @Override - public boolean deployiPOJOComposite() { - return true; - } - - - public static ServiceContext getServiceContext(ComponentInstance ci) { - if (ci instanceof CompositeManager) { - return ((CompositeManager) ci).getServiceContext(); - } else { - throw new RuntimeException("Cannot get the service context from a non composite instance"); - } - } - - public void assertContains(String s, String[] arrays, String object) { - for (String suspect : arrays) { - if (object.equals(suspect)) { - return; - } - } - fail("Assertion failed : " + s); - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestFilteredExport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestFilteredExport.java deleted file mode 100644 index bce5471705..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestFilteredExport.java +++ /dev/null @@ -1,237 +0,0 @@ -/* - * 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.ipojo.runtime.core.exporter; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestFilteredExport extends Common { - - ComponentInstance export1; - Factory fooProvider; - ComponentInstance foo1 = null, foo2 = null; - - @Before - public void setUp() { - fooProvider = ipojoHelper.getFactory("BazProviderType"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to create foos : " + e.getMessage()); - } - - foo1.stop(); - foo2.stop(); - - Factory factory = ipojoHelper.getFactory("composite.export.5"); - Properties props = new Properties(); - props.put("instance.name", "export"); - try { - export1 = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Fail to instantiate exporter " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - export1.dispose(); - foo1 = null; - foo2 = null; - export1 = null; - } - - @Test - public void test1() { - export1.start(); - - // Check that no foo service are available - assertEquals("Check no foo service", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 0); - - // Test invalidity - assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 3", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.stop(); - assertTrue("Check invalidity - 4", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check invalidity - 5", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 0); - } - - @Test - public void test2() { - export1.start(); - - // Test invalidity - assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo2.stop(); - assertTrue("Check validity - 3", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 4", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 5", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke()); - } - - @Test - public void test3() { - foo1.start(); - foo2.start(); - - export1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 2", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 0); - - foo2.stop(); - assertTrue("Check invalidity - 3", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 4", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke()); - } - - @Test - public void test4() { - foo1.start(); - foo2.start(); - - export1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.stop(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 3", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check invalidity - 4", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - } - - - private boolean isFooServiceProvided() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export1.getInstanceName()); - return ref != null; - } - - private int countFooServiceProvided() { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export1.getInstanceName() + ")"); - return refs.length; - } - - private boolean invoke() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export1.getInstanceName()); - if (ref == null) { - return false; - } - BazService fs = (BazService) getContext().getService(ref); - return fs.foo(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestMultipleExport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestMultipleExport.java deleted file mode 100644 index b9ca3a75cf..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestMultipleExport.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * 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.ipojo.runtime.core.exporter; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestMultipleExport extends Common { - - ComponentInstance export3; - Factory fooProvider; - ComponentInstance foo1 = null, foo2 = null; - - @Before - public void setUp() { - fooProvider = ipojoHelper.getFactory("BazProviderType"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to create foos : " + e.getMessage()); - } - - foo1.stop(); - foo2.stop(); - - Factory factory = ipojoHelper.getFactory("composite.export.3"); - Properties props = new Properties(); - props.put("instance.name", "export"); - try { - export3 = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Fail to instantiate exporter " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - export3.dispose(); - foo1 = null; - foo2 = null; - export3 = null; - } - - @Test - public void test1() { - export3.start(); - - // Check that no foo service are available - assertEquals("Check no foo service", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 0); - - // Test invalidity - assertTrue("Check invalidity - 0", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke(1)); - - foo2.start(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 2); - assertTrue("Check invocation - 2", invoke(2)); - - foo1.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3 (" + countFooServiceProvided() + ")", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke(1)); - - foo2.stop(); - assertTrue("Check invalidity - 4", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 5", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke(1)); - } - - @Test - public void test2() { - export3.start(); - - // Test invalidity - assertTrue("Check invalidity - 0", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 2); - assertTrue("Check invocation - 2", invoke(2)); - - foo2.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke(1)); - - foo1.stop(); - assertTrue("Check invalidity - 4", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 5", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke(1)); - } - - @Test - public void test3() { - foo1.start(); - foo2.start(); - - export3.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 2); - assertTrue("Check invocation - 1", invoke(2)); - - foo1.stop(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke(1)); - - foo2.stop(); - assertTrue("Check invalidity - 3", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke(1)); - } - - @Test - public void test4() { - foo1.start(); - foo2.start(); - - export3.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 2); - assertTrue("Check invocation - 1", invoke(2)); - - foo2.stop(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke(1)); - - foo1.stop(); - assertTrue("Check invalidity - 3", export3.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke(1)); - } - - - private boolean isFooServiceProvided() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export3.getInstanceName()); - return ref != null; - } - - private int countFooServiceProvided() { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export3.getInstanceName() + ")"); - return refs.length; - } - - private boolean invoke() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export3.getInstanceName()); - if (ref == null) { - return false; - } - BazService fs = (BazService) getContext().getService(ref); - getContext().ungetService(ref); - return fs.foo(); - } - - private boolean invoke(int nb) { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export3.getInstanceName() + ")"); - if (refs == null) { - return false; - } - if (nb > refs.length) { - return false; - } - for (int i = 0; i < nb; i++) { - BazService fs = (BazService) getContext().getService(refs[i]); - getContext().ungetService(refs[i]); - if (!fs.foo()) { - return false; - } - } - return true; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalExport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalExport.java deleted file mode 100644 index b1716a3957..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalExport.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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.ipojo.runtime.core.exporter; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalExport extends Common { - - ComponentInstance export2; - Factory fooProvider; - ComponentInstance foo1 = null, foo2 = null; - - @Before - public void setUp() { - fooProvider = ipojoHelper.getFactory("BazProviderType"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to create foos : " + e.getMessage()); - } - - foo1.stop(); - foo2.stop(); - - Factory factory = ipojoHelper.getFactory("composite.export.2"); - Properties props = new Properties(); - props.put("instance.name", "export"); - try { - export2 = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Fail to instantiate exporter " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - export2.dispose(); - foo1 = null; - foo2 = null; - export2 = null; - } - - @Test - public void test1() { - export2.start(); - - // Check that no foo service are available - assertEquals("Check no foo service", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 0); - - // Test validity - assertTrue("Check validity - 0", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check validity - 3", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3 (" + countFooServiceProvided() + ")", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke()); - - foo2.stop(); - assertTrue("Check validity - 4", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 5", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke()); - } - - @Test - public void test2() { - export2.start(); - - // Test invalidity - assertTrue("Check validity - 0", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo2.stop(); - assertTrue("Check validity - 3", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke()); - - foo1.stop(); - assertTrue("Check validity - 4", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 5", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke()); - } - - @Test - public void test3() { - foo1.start(); - foo2.start(); - - export2.start(); - assertTrue("Check validity - 1", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo1.stop(); - assertTrue("Check validity - 2", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo2.stop(); - assertTrue("Check validity - 3", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 4", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke()); - } - - @Test - public void test4() { - foo1.start(); - foo2.start(); - - export2.start(); - assertTrue("Check validity - 1", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.stop(); - assertTrue("Check validity - 2", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check validity - 3", export2.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 4", export2.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke()); - } - - - private boolean isFooServiceProvided() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export2.getInstanceName()); - return ref != null; - } - - private int countFooServiceProvided() { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export2.getInstanceName() + ")"); - return refs.length; - } - - private boolean invoke() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export2.getInstanceName()); - if (ref == null) { - return false; - } - BazService fs = (BazService) getContext().getService(ref); - return fs.foo(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalMultipleExport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalMultipleExport.java deleted file mode 100644 index 23afd48b90..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestOptionalMultipleExport.java +++ /dev/null @@ -1,260 +0,0 @@ -/* - * 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.ipojo.runtime.core.exporter; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalMultipleExport extends Common { - - ComponentInstance export3; - Factory fooProvider; - ComponentInstance foo1 = null, foo2 = null; - - @Before - public void setUp() { - fooProvider = ipojoHelper.getFactory("BazProviderType"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to create foos : " + e.getMessage()); - } - - foo1.stop(); - foo2.stop(); - - Factory factory = ipojoHelper.getFactory("composite.export.4"); - Properties props = new Properties(); - props.put("instance.name", "export"); - try { - export3 = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Fail to instantiate exporter " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - export3.dispose(); - foo1 = null; - foo2 = null; - export3 = null; - } - - @Test - public void test1() { - export3.start(); - - // Check that no foo service are available - assertEquals("Check no foo service", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 0); - - // Test invalidity - assertTrue("Check validity - 0", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke(1)); - - foo2.start(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 2); - assertTrue("Check invocation - 2", invoke(2)); - - foo1.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3 (" + countFooServiceProvided() + ")", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke(1)); - - foo2.stop(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 5", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke(1)); - } - - @Test - public void test2() { - export3.start(); - - // Test invalidity - assertTrue("Check validity - 0", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 2); - assertTrue("Check invocation - 2", invoke(2)); - - foo2.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke(1)); - - foo1.stop(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 5", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke(1)); - } - - @Test - public void test3() { - foo1.start(); - foo2.start(); - - export3.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 2); - assertTrue("Check invocation - 1", invoke(2)); - - foo1.stop(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke(1)); - - foo2.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke(1)); - } - - @Test - public void test4() { - foo1.start(); - foo2.start(); - - export3.start(); - assertTrue("Check validity - 1", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 2); - assertTrue("Check invocation - 1", invoke(2)); - - foo2.stop(); - assertTrue("Check validity - 2", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke(1)); - - foo1.stop(); - assertTrue("Check validity - 3", export3.getState() == ComponentInstance.VALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 4", export3.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke(1)); - } - - - private boolean isFooServiceProvided() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export3.getInstanceName()); - return ref != null; - } - - private int countFooServiceProvided() { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export3.getInstanceName() + ")"); - return refs.length; - } - - private boolean invoke() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export3.getInstanceName()); - if (ref == null) { - return false; - } - BazService fs = (BazService) getContext().getService(ref); - getContext().ungetService(ref); - return fs.foo(); - } - - private boolean invoke(int nb) { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export3.getInstanceName() + ")"); - if (refs == null) { - return false; - } - if (nb > refs.length) { - return false; - } - for (int i = 0; i < nb; i++) { - BazService fs = (BazService) getContext().getService(refs[i]); - getContext().ungetService(refs[i]); - if (!fs.foo()) { - return false; - } - } - return true; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestSimpleExport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestSimpleExport.java deleted file mode 100644 index 49cad50896..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/exporter/TestSimpleExport.java +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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.ipojo.runtime.core.exporter; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestSimpleExport extends Common { - - ComponentInstance export1; - Factory fooProvider; - ComponentInstance foo1 = null, foo2 = null; - - @Before - public void setUp() { - fooProvider = ipojoHelper.getFactory("BazProviderType"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to create foos : " + e.getMessage()); - } - - foo1.stop(); - foo2.stop(); - - Factory factory = ipojoHelper.getFactory("composite.export.1"); - Properties props = new Properties(); - props.put("instance.name", "export"); - try { - export1 = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Fail to instantiate exporter " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - export1.dispose(); - foo1 = null; - foo2 = null; - export1 = null; - } - - @Test - public void test1() { - export1.start(); - - // Check that no foo service are available - assertEquals("Check no foo service", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 0); - - // Test invalidity - assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check validity - 3", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3 (" + countFooServiceProvided() + ")", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke()); - - foo2.stop(); - assertTrue("Check invalidity - 4", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 5", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke()); - } - - @Test - public void test2() { - export1.start(); - - // Test invalidity - assertTrue("Check invalidity - 0", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 0", isFooServiceProvided()); - assertEquals("Check number of provides - 0", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.start(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo2.stop(); - assertTrue("Check validity - 3", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 1); - assertTrue("Check invocation - 3", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 4", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 5", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 5", isFooServiceProvided()); - assertEquals("Check number of provides - 5", countFooServiceProvided(), 1); - assertTrue("Check invocation - 5", invoke()); - } - - @Test - public void test3() { - foo1.start(); - foo2.start(); - - export1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo1.stop(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo2.stop(); - assertTrue("Check invalidity - 3", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo1.start(); - assertTrue("Check validity - 4", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke()); - } - - @Test - public void test4() { - foo1.start(); - foo2.start(); - - export1.start(); - assertTrue("Check validity - 1", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 1", isFooServiceProvided()); - assertEquals("Check number of provides - 1", countFooServiceProvided(), 1); - assertTrue("Check invocation - 1", invoke()); - - foo2.stop(); - assertTrue("Check validity - 2", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 2", isFooServiceProvided()); - assertEquals("Check number of provides - 2", countFooServiceProvided(), 1); - assertTrue("Check invocation - 2", invoke()); - - foo1.stop(); - assertTrue("Check invalidity - 3", export1.getState() == ComponentInstance.INVALID); - assertFalse("Check providing - 3", isFooServiceProvided()); - assertEquals("Check number of provides - 3", countFooServiceProvided(), 0); - - foo2.start(); - assertTrue("Check validity - 4", export1.getState() == ComponentInstance.VALID); - assertTrue("Check providing - 4", isFooServiceProvided()); - assertEquals("Check number of provides - 4", countFooServiceProvided(), 1); - assertTrue("Check invocation - 4", invoke()); - } - - - private boolean isFooServiceProvided() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export1.getInstanceName()); - return ref != null; - } - - private int countFooServiceProvided() { - ServiceReference[] refs = osgiHelper.getServiceReferences(BazService.class.getName(), "(instance.name=" + export1.getInstanceName() + ")"); - return refs.length; - } - - private boolean invoke() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), export1.getInstanceName()); - if (ref == null) { - return false; - } - BazService fs = (BazService) getContext().getService(ref); - return fs.foo(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedFilteredImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedFilteredImport.java deleted file mode 100644 index 2b4bdf74c0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedFilteredImport.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestDelayedFilteredImport extends Common { - - ComponentInstance import1; - Factory fooProvider; - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.1"); - try { - import1 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - - import1.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import1.dispose(); - foo1 = null; - foo2 = null; - import1 = null; - } - - @Test - public void testSimple() { - import1.start(); - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo2.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - public void testSimple2() { - import1.start(); - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo2.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedMultipleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedMultipleImport.java deleted file mode 100644 index 566c26aee5..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedMultipleImport.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestDelayedMultipleImport extends Common { - - ComponentInstance import2; - Factory fooProvider; - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.2"); - try { - import2 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - - import2.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import2.dispose(); - foo1 = null; - foo2 = null; - import2 = null; - } - - @Test - public void testSimple() { - import2.start(); - //Two providers - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - fs = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation (2)", fs.foo()); - sc.ungetService(refs[1]); - - foo1.stop(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component invalidity - 2", import2.getState() == ComponentInstance.INVALID); - - foo2.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - public void testSimple2() { - import2.start(); - //Two providers - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - fs = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[1]); - - foo2.stop(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component invalidity - 2", import2.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalImport.java deleted file mode 100644 index 0b3ba04920..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalImport.java +++ /dev/null @@ -1,163 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestDelayedOptionalImport extends Common { - - ComponentInstance import3; - Factory fooProvider; - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.3"); - try { - import3 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - - import3.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import3.dispose(); - foo1 = null; - foo2 = null; - import3 = null; - } - - @Test - public void testSimple() { - import3.start(); - //Two providers - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import3); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.stop(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component validity - 2", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo non-availability inside the composite - 3.1", refs.length, 0); - - foo2.start(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - public void testSimple2() { - import3.start(); - //Two providers - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import3); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo2.stop(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component validity - 2", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 0); - - foo1.start(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalMultipleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalMultipleImport.java deleted file mode 100644 index 13c953b3b0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedOptionalMultipleImport.java +++ /dev/null @@ -1,169 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestDelayedOptionalMultipleImport extends Common { - - ComponentInstance import4; - Factory fooProvider; - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.4"); - try { - import4 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - - import4.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import4.dispose(); - foo1 = null; - foo2 = null; - import4 = null; - } - - @Test - public void testSimple() { - import4.start(); - //Two providers - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import4); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - fs = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation (2)", fs.foo()); - sc.ungetService(refs[1]); - - foo1.stop(); - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component validity - 2", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo availability inside the composite - 1", refs.length, 0); - - foo2.start(); - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - public void testSimple2() { - import4.start(); - //Two providers - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import4); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - fs = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[1]); - - foo2.stop(); - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component validity - 2", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo availability inside the composite - 1", refs.length, 0); - - foo1.start(); - assertTrue("Test component validity", import4.getState() == ComponentInstance.VALID); - sc = getServiceContext(import4); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedSimpleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedSimpleImport.java deleted file mode 100644 index 262de1b836..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestDelayedSimpleImport.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestDelayedSimpleImport extends Common { - - ComponentInstance import1; - Factory fooProvider; - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.1"); - try { - import1 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - - import1.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import1.dispose(); - foo1 = null; - foo2 = null; - import1 = null; - } - - @Test - public void testSimple() { - import1.start(); - - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo2.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - public void testSimple2() { - import1.start(); - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo2.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestFilteredImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestFilteredImport.java deleted file mode 100644 index 174e0adfbd..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestFilteredImport.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestFilteredImport extends Common { - - ComponentInstance import1; - Factory fooProvider; - Factory fooProvider2; - - ComponentInstance foo1, foo2; - - @Before - public void setUp() { - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.5"); - try { - import1 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - import1.stop(); - - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - fooProvider2 = ipojoHelper.getFactory("COMPO-FooProviderType-2"); - assertNotNull("Check fooProvider availability", fooProvider2); - - Properties p1 = new Properties(); - p1.put("instance.name", "foo1"); - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo1 = fooProvider.createComponentInstance(p1); - foo2 = fooProvider2.createComponentInstance(p2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - } - - @After - public void tearDown() { - foo1.dispose(); - foo2.dispose(); - import1.dispose(); - foo1 = null; - foo2 = null; - import1 = null; - } - - @Test - public void testSimple() { - import1.start(); - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo2.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - - @Test - @Ignore("known as broken after interception inception in service dependencies") - public void testSimple2() { - import1.start(); - //Two providers - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo2.stop(); - assertTrue("Test component invalidity - 1", import1.getState() == ComponentInstance.INVALID); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component invalidity - 3", import1.getState() == ComponentInstance.INVALID); - - foo2.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestMultipleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestMultipleImport.java deleted file mode 100644 index 7cdb91a5db..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestMultipleImport.java +++ /dev/null @@ -1,199 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestMultipleImport extends Common { - - ComponentInstance import2; - Factory fooProvider; - - @Before - public void setUp() { - osgiHelper.waitForService(Factory.class, "(factory.name=COMPO-FooProviderType-1)", 1000); - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.2"); - try { - import2 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - } - - @After - public void tearDown() { - import2.dispose(); - import2 = null; - } - - @Test - public void testSimple() { - // No provider -> Invalid - assertTrue("Test component invalidity", import2.getState() == ComponentInstance.INVALID); - - ComponentInstance foo = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2 (" + refs.length + ")", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - FooService fs2 = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs2.foo()); - sc.ungetService(refs[0]); - sc.ungetService(refs[1]); - - // Stop the second provider - foo2.dispose(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the foo provider - foo.stop(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import2.getState() == ComponentInstance.INVALID); - - foo.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import2.getState() == ComponentInstance.INVALID); - } - - @Test - public void testSimple2() { - // No provider -> Invalid - assertTrue("Test component invalidity", import2.getState() == ComponentInstance.INVALID); - - ComponentInstance foo1 = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo1 = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2 (" + refs.length + ")", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - FooService fs2 = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs2.foo()); - sc.ungetService(refs[0]); - sc.ungetService(refs[1]); - - // Stop the first provider - foo1.stop(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the second foo provider - foo2.dispose(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import2.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import2.getState() == ComponentInstance.INVALID); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalImport.java deleted file mode 100644 index 3d7d351484..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalImport.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalImport extends Common { - - ComponentInstance import3; - Factory fooProvider; - - @Before - public void setUp() { - osgiHelper.waitForService(Factory.class, "(factory.name=COMPO-FooProviderType-1)", 1000); - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.3"); - try { - import3 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - } - - @After - public void tearDown() { - import3.dispose(); - import3 = null; - } - - @Test - public void testSimple() { - // No provider -> valid - assertTrue("Test component invalidity", import3.getState() == ComponentInstance.VALID); - - ComponentInstance foo = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import3); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.dispose(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the foo provider - foo.stop(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import3.getState() == ComponentInstance.VALID); - - foo.start(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import3.getState() == ComponentInstance.VALID); - } - - @Test - public void testSimple2() { - // No provider -> valid - assertTrue("Test component invalidity", import3.getState() == ComponentInstance.VALID); - - ComponentInstance foo1 = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo1 = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import3); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo1.stop(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the foo provider - foo2.dispose(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import3.getState() == ComponentInstance.VALID); - - foo1.start(); - assertTrue("Test component validity", import3.getState() == ComponentInstance.VALID); - sc = getServiceContext(import3); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import3.getState() == ComponentInstance.VALID); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalMultipleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalMultipleImport.java deleted file mode 100644 index d5259d8508..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestOptionalMultipleImport.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalMultipleImport extends Common { - - ComponentInstance import2; - Factory fooProvider; - - @Before - public void setUp() { - osgiHelper.waitForService(Factory.class, "(factory.name=COMPO-FooProviderType-1)", 1000); - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.4"); - try { - import2 = compFact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate the component : " + e.getMessage()); - } - } - - @After - public void tearDown() { - import2.dispose(); - import2 = null; - } - - @Test - public void testSimple() { - // No provider -> valid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - - ComponentInstance foo = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2 (" + refs.length + ")", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - FooService fs2 = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs2.foo()); - sc.ungetService(refs[0]); - sc.ungetService(refs[1]); - - // Stop the second provider - foo2.dispose(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the foo provider - foo.stop(); - - // No provider -> valid - assertTrue("Test component validity - 2", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo non-availability inside the composite - 1", refs.length, 0); - - foo.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo.dispose(); - // No provider -> Invalid - assertTrue("Test component validity - 3", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo non-availability inside the composite - 2", refs.length, 0); - } - - @Test - public void testSimple2() { - // No provider -> Invalid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - - ComponentInstance foo1 = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo1 = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import2); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2 (" + refs.length + ")", refs.length, 2); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - FooService fs2 = (FooService) sc.getService(refs[1]); - assertTrue("Test foo invocation", fs2.foo()); - sc.ungetService(refs[0]); - sc.ungetService(refs[1]); - - // Stop the first provider - foo1.stop(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the second foo provider - foo2.dispose(); - - // No provider -> Invalid - assertTrue("Test component validity - 2", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo non-availability inside the composite - 1", refs.length, 0); - - foo1.start(); - assertTrue("Test component validity", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import2.getState() == ComponentInstance.VALID); - sc = getServiceContext(import2); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertEquals("Test foo non-availability inside the composite - 2", refs.length, 0); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestSimpleImport.java b/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestSimpleImport.java deleted file mode 100644 index c97965a05b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-import-export-test/src/test/java/org/apache/felix/ipojo/runtime/core/importer/TestSimpleImport.java +++ /dev/null @@ -1,193 +0,0 @@ -/* - * 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.ipojo.runtime.core.importer; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestSimpleImport extends Common { - - ComponentInstance import1; - Factory fooProvider; - - @Before - public void setUp() { - osgiHelper.waitForService(Factory.class, "(factory.name=COMPO-FooProviderType-1)", 1000); - fooProvider = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - assertNotNull("Check fooProvider availability", fooProvider); - - Properties p = new Properties(); - p.put("instance.name", "importer"); - Factory compFact = ipojoHelper.getFactory("composite.requires.1"); - try { - import1 = compFact.createComponentInstance(p); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate the component : " + e.getMessage()); - } - } - - @After - public void tearDown() { - import1.dispose(); - import1 = null; - } - - @Test - public void testSimple() { - // No provider -> Invalid - assertTrue("Test component invalidity - 0 (" + import1.getState() + ")", import1.getState() == ComponentInstance.INVALID); - - ComponentInstance foo = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity - 1", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the second provider - foo2.dispose(); - assertTrue("Test component validity - 2", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the foo provider - foo.stop(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo.start(); - assertTrue("Test component validity - 3", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import1.getState() == ComponentInstance.INVALID); - } - - @Test - public void testSimple2() { - // No provider -> Invalid - assertTrue("Test component invalidity", import1.getState() == ComponentInstance.INVALID); - - ComponentInstance foo1 = null; - Properties p = new Properties(); - p.put("instance.name", "foo"); - try { - foo1 = fooProvider.createComponentInstance(p); - } catch (Exception e) { - fail("Fail to instantiate the foo component " + e.getMessage()); - } - - ComponentInstance foo2 = null; - Properties p2 = new Properties(); - p2.put("instance.name", "foo2"); - try { - foo2 = fooProvider.createComponentInstance(p2); - } catch (Exception e) { - fail("Fail to instantiate the foo2 component " + e.getMessage()); - } - - // The foo service is available => import1 must be valid - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(import1); - ServiceReference[] refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 1", refs); - assertEquals("Test foo availability inside the composite - 1.2", refs.length, 1); - FooService fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // Stop the first provider - foo1.stop(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 2", refs); - assertEquals("Test foo availability inside the composite - 2.1 (" + refs.length + ")", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - // stop the second foo provider - foo2.dispose(); - - // No provider -> Invalid - assertTrue("Test component invalidity - 2", import1.getState() == ComponentInstance.INVALID); - - foo1.start(); - assertTrue("Test component validity", import1.getState() == ComponentInstance.VALID); - sc = getServiceContext(import1); - refs = ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null); - assertNotNull("Test foo availability inside the composite - 3", refs); - assertEquals("Test foo availability inside the composite - 3.1", refs.length, 1); - fs = (FooService) sc.getService(refs[0]); - assertTrue("Test foo invocation", fs.foo()); - sc.ungetService(refs[0]); - - foo1.dispose(); - // No provider -> Invalid - assertTrue("Test component invalidity - 3", import1.getState() == ComponentInstance.INVALID); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/pom.xml b/ipojo/runtime/composite-it/ipojo-composite-instance-test/pom.xml deleted file mode 100644 index dfb1da4506..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.composite-it - 1.12.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - - ipojo-composite-instance-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java deleted file mode 100644 index 20e2773499..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class Baz2CheckProvider implements CheckService { - - BazService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int simpleU = 0; - int objectU = 0; - int refU = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("result", new Boolean(fs.foo())); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - - return props; - } - - private void voidBind() { - simpleB++; - } - private void voidUnbind() { - simpleU++; - } - - protected void objectBind(Object o) { - if(o != null && o instanceof FooService) { objectB++; } - } - protected void objectUnbind(Object o) { - if(o != null && o instanceof FooService) { objectU++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java deleted file mode 100644 index 5711222bb3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; - -import java.util.Properties; - -public class BazProviderType1 implements BazService { - - private int m_bar; - private String m_foo; - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - p.put("foo", m_foo); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index c53570bdc9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index a0e9e430dc..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 700d9fe49a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java deleted file mode 100644 index f1732ba9e3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn2 implements FooService { - - private int intProp = 2; - private boolean boolProp = true; - private String strProp = "foo"; - private String[] strAProp = new String[] {"foo", "bar"}; - private int[] intAProp = new int[] {1, 2, 3}; - - public boolean foo() { - intAProp = null; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java deleted file mode 100644 index f77205902e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.Service; - -import java.util.Properties; - -public class ServiceConsumer implements CheckService { - - private Service service; - private Properties props = new Properties(); - - public ServiceConsumer() { - props.put("1", new Integer(service.count())); - props.put("2", new Integer(service.count())); - props.put("3", new Integer(service.count())); - } - - public boolean check() { - return service.count() > 0; - } - - public Properties getProps() { - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java deleted file mode 100644 index 9c2f212b44..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Service; - - -public class ServiceProvider implements Service { - - private int i = 0; - - public int count() { - i++; - return i; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java deleted file mode 100644 index 84f9e3628e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Tata; - -import java.util.Properties; - - -public class TataProvider implements Tata { - - int tata = 0; - int tataStr = 0; - int tataStrs = 0; - int tata_2 = 0; - int tata_3 = 0; - int tata1 = 0; - int tata1_1 = 0; - int tata5 = 0; - int tata5_1 = 0; - int tata5_2 = 0; - int tataBoolean = 0; - int tataBooleans = 0; - int tataByte = 0; - int tataBytes = 0; - private int add; - private int tataShorts; - private int tataShort; - private int tataLongs; - private int tataLong; - private int tataInts; - private int tataInt; - private int tataFloat; - private int tataFloats; - private int tataDoubles; - private int tataDouble; - private int tataChars; - private int tataChar; - - public Properties getPropsTata() { - Properties props = new Properties(); - props.put("tata", new Integer(tata)); - props.put("tataStr", new Integer(tataStr)); - props.put("tataStrs", new Integer(tataStrs)); - props.put("tata_2", new Integer(tata_2)); - props.put("tata_3", new Integer(tata_3)); - props.put("tata1", new Integer(tata1)); - props.put("tata1_1", new Integer(tata1_1)); - props.put("tata5", new Integer(tata5)); - props.put("tata5_1", new Integer(tata5_1)); - props.put("tata5_2", new Integer(tata5_2)); - props.put("add", new Integer(add)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataByte", new Integer(tataByte)); - props.put("tataBytes", new Integer(tataBytes)); - props.put("tataShort", new Integer(tataShort)); - props.put("tataShorts", new Integer(tataShorts)); - props.put("tataLongs", new Integer(tataLongs)); - props.put("tataLong", new Integer(tataLong)); - props.put("tataInt", new Integer(tataInt)); - props.put("tataInts", new Integer(tataInts)); - props.put("tataFloat", new Integer(tataFloat)); - props.put("tataFloats", new Integer(tataFloats)); - props.put("tataDouble", new Integer(tataDouble)); - props.put("tataDoubles", new Integer(tataDoubles)); - props.put("tataChar", new Integer(tataChar)); - props.put("tataChars", new Integer(tataChars)); - return props; - } - - public void tata() { - tata++; - } - - public String tataStr() { - tataStr++; - return "Tata"; - } - - public String[] tataStrs() { - tataStrs++; - return new String[] {"T", "A", "T", "A"}; - } - - public void tata(int i, int j) { - tata_2++; - } - - public void tata(String s) { - tata_3++; - } - - public String tata1(String a) { - tata1++; - return a; - } - - public String tata1(char[] a) { - tata1_1++; - String s = new String(a); - return s; - } - - public String tata5(String a, int i) { - tata5++; - return a+i; - } - - public String tata5(String[] a, int i) { - tata5_1++; - return ""+a.length + i; - } - - public String tata5(String a, int[] i) { - tata5_2++; - return a + i.length; - } - - public boolean tataBoolean(boolean b) { - tataBoolean++; - return b; - } - - public boolean[] tataBooleans(boolean[] b) { - tataBooleans++; - return b; - } - - public byte tataByte(byte b) { - tataByte++; - return b; - } - - public byte[] tataBytes(byte[] b) { - tataBytes++; - return b; - } - - public char tataChar(char c) { - tataChar++; - return c; - } - - public char[] tataChars(char[] c) { - tataChars++; - return c; - } - - public double tataDouble(double d) { - tataDouble++; - return d; - } - - public double[] tataDoubles(double[] d) { - tataDoubles++; - return d; - } - - public float tataFloat(float f) { - tataFloat++; - return f; - } - - public float[] tataFloats(float[] f) { - tataFloats++; - return f; - } - - public int tataInt(int i) { - tataInt++; - return i; - } - - public int[] tataInts(int[] its) { - tataInts++; - return its; - } - - public long tataLong(long l) { - tataLong++; - return l; - } - - public long[] tataLongs(long[] l) { - tataLongs++; - return l; - } - - public short tataShort(short s) { - tataShort++; - return s; - } - - public short[] tataShorts(short[] s) { - tataShorts++; - return s; - } - - public long add(int i, int j, int k) { - add++; - return i + j + k; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java deleted file mode 100644 index 5c2c03391c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProvider implements Toto { - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - } - - public void toto(int i, int j) { - toto_2++; - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("toto", new Integer(toto)); - props.put("toto_2", new Integer(toto_2)); - props.put("toto_3", new Integer(toto_3)); - props.put("toto_4", new Integer(toto_4)); - props.put("toto1", new Integer(toto1)); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java deleted file mode 100644 index dccebafe70..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProviderGlue implements Toto { - - Toto m_toto; - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - m_toto.toto(); - } - - public void toto(int i, int j) { - toto_2++; - m_toto.toto(i, j); - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - m_toto.toto1(j); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("gtoto", new Integer(toto)); - props.put("gtoto_2", new Integer(toto_2)); - props.put("gtoto_3", new Integer(toto_3)); - props.put("gtoto_4", new Integer(toto_4)); - props.put("gtoto1", new Integer(toto1)); - props.put("glue", "glue"); - Properties p2 = m_toto.getProps(); - props.putAll(p2); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index 5e2b59a0e4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 62eb08d3ae..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java deleted file mode 100644 index b9cec949b7..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BazService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java deleted file mode 100644 index 6ef60bf384..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface Service { - - public int count(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java deleted file mode 100644 index a65e2ddb46..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tata { - - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java deleted file mode 100644 index 82d307c2b0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tota { - - public static final String specification="specification { " + - "requires { " + - "$specification=\"org.apache.felix.ipojo.test.composite.service.Toto\" " + - "$optional=\"true\" " + - "$aggregate=\"true\" " + - "$type=\"service\" " + - "} }"; - - public Properties getProps() throws UnsupportedOperationException;; - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - - public void toto() throws UnsupportedOperationException; - public void toto(int i, int j) throws UnsupportedOperationException; - public String toto(String a) throws UnsupportedOperationException; - - public void toto1(String j) throws UnsupportedOperationException; - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java deleted file mode 100644 index 037dad355f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Toto { - - public Properties getProps(); - - public void toto(); - public void toto(int i, int j); - public String toto(String a); - public String toto(String[] a); - - public void toto1(String j); - - public int count(); - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata-instance.xml b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata-instance.xml deleted file mode 100644 index 90131d8dc9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata-instance.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata.xml b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata.xml deleted file mode 100644 index d70c60b1d4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index b0bf76b9b3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ow2.chameleon.testing.helpers.BaseTest; - -/** - * Bootstrap the test from this project - */ -@ExamReactorStrategy(PerMethod.class) -public class Common extends BaseTest { - - public static ServiceContext getServiceContext(ComponentInstance ci) { - if (ci instanceof CompositeManager) { - return ((CompositeManager) ci).getServiceContext(); - } else { - throw new RuntimeException("Cannot get the service context from a non composite instance"); - } - } - - @Override - public boolean deployiPOJOComposite() { - return true; - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestInstanceScope.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestInstanceScope.java deleted file mode 100644 index f9e09ba875..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestInstanceScope.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.ipojo.runtime.core.instance; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.composite.CompositeFactory; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.Service; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestInstanceScope extends Common { - - CompositeFactory factory; - ComponentInstance instance; - - @Before - public void setUp() { - factory = (CompositeFactory) ipojoHelper.getFactory("SCOPE-scope"); - assertNotNull("Factory", factory); - try { - instance = factory.createComponentInstance(null); - } catch (Exception e) { - fail("Fail instantiation : " + e.getMessage()); - } - - - } - - @After - public void tearDown() { - instance.dispose(); - instance = null; - } - - @Test - public void testScope() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), instance.getInstanceName()); - assertNotNull("Check architecture availability", ref); - Architecture arch = (Architecture) getContext().getService(ref); - assertTrue("Validity", arch.getInstanceDescription().getState() == ComponentInstance.VALID); - - // Get internal service - ServiceContext sc = getServiceContext(instance); - ServiceReference ref2 = ipojoHelper.getServiceReference(sc, CheckService.class.getName(), null); - assertNotNull("Check CheckService availability", ref2); - CheckService svc = (CheckService) sc.getService(ref2); - Properties props = svc.getProps(); - assertEquals("Check props - 1", 1, ((Integer) props.get("1")).intValue()); - assertEquals("Check props - 2", 2, ((Integer) props.get("2")).intValue()); - assertEquals("Check props - 3", 3, ((Integer) props.get("3")).intValue()); - - } - - @Test - public void testGlobalUnavailability() { - ServiceReference ref2 = osgiHelper.getServiceReference(Service.class.getName(), null); - assertNull("Check Service unavailability", ref2); - } - - @Test - public void testScopeUnvailability() { - CompositeFactory factory2 = (CompositeFactory) ipojoHelper.getFactory("SCOPE-badscope"); - assertNotNull("Factory", factory2); - ComponentInstance instance2 = null; - try { - instance2 = factory2.createComponentInstance(null); - } catch (Exception e) { - fail("Fail instantiation : " + e.getMessage()); - } - //System.out.println(instance2.getInstanceDescription().getDescription()); - - assertEquals("Check invalidity", ComponentInstance.INVALID, instance2.getState()); - instance2.dispose(); - - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestSimpleInstance.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestSimpleInstance.java deleted file mode 100644 index d1454048b0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instance/TestSimpleInstance.java +++ /dev/null @@ -1,279 +0,0 @@ -/* - * 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.ipojo.runtime.core.instance; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.composite.CompositeInstanceDescription; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -public class TestSimpleInstance extends Common { - - private ComponentFactory fooFactory1, fooFactory2; - private ComponentFactory compoFactory; - private ComponentInstance empty; - - @Before - public void setUp() { - fooFactory1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooProviderType-1"); - fooFactory2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooProviderType-Dyn2"); - compoFactory = (ComponentFactory) ipojoHelper.getFactory("composite.inst.1"); - Factory fact = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty-X"); - try { - empty = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the empty composite : " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testCreation() { - Properties props = new Properties(); - props.put("instance.name", "under-A"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate under from " + compoFactory.getName() + " -> " + e.getMessage()); - } - - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailability() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - - assertNotNull("Check service availability", sc.getServiceReference(FooService.class.getName())); - assertEquals("Check service provider", ipojoHelper.getServiceReferences(sc, FooService.class.getName(), null).length, - 2); - - under.dispose(); - } - - @Test - public void testCreationLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props, sc); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailabilityLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under-X"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - - assertNotNull("Check service availability", sc2.getServiceReference(FooService.class.getName())); - assertEquals("Check service providers", ipojoHelper.getServiceReferences(sc2, FooService.class.getName(), - null).length, 2); - - under.dispose(); - } - - @Test - public void testFactoryManagement() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - fooFactory1.stop(); - assertTrue("Check instance invalidity - 2", under.getState() == ComponentInstance.INVALID); - - fooFactory1.start(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fooFactory2.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - - fooFactory2.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fooFactory1.start(); - fooFactory2.start(); - } - - @Test - public void testFactoryManagementLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - fooFactory1.stop(); - assertTrue("Check instance invalidity - 2", under.getState() == ComponentInstance.INVALID); - - fooFactory1.start(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fooFactory2.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - - fooFactory2.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fooFactory1.start(); - fooFactory2.start(); - } - - public void atestArchitecture() { // TODO fix and reactivate the method. - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compoFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - ServiceReference ref = osgiHelper.getServiceReference(Architecture.class.getName(), - "(architecture.instance=under)"); - assertNotNull("Check architecture availability", ref); - Architecture arch = (Architecture) getContext().getService(ref); - CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription(); - - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - InstanceDescription[] contained = id.getContainedInstances(); - assertEquals("Check contained instances count (" + contained.length + ")", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - ref = osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=under)"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 0); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - under.dispose(); - fact2.start(); - fact3.start(); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfigurableInstantiation.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfigurableInstantiation.java deleted file mode 100644 index a2411a1ea7..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfigurableInstantiation.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestConfigurableInstantiation extends Common { - - private ComponentFactory acceptF; - private ComponentFactory refuse1F; - private ComponentFactory refuse2F; - - @Before - public void setUp() { - acceptF = (ComponentFactory) ipojoHelper.getFactory("composite.bar.5-accept"); - refuse1F = (ComponentFactory) ipojoHelper.getFactory("composite.bar.5-refuse1"); - refuse2F = (ComponentFactory) ipojoHelper.getFactory("composite.bar.5-refuse2"); - - } - - @After - public void tearDown() { - } - - @Test - public void testAccept() { - Properties props = new Properties(); - props.put("instance.name", "under-A"); - ComponentInstance under = null; - try { - under = acceptF.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - ServiceReference ref = sc.getServiceReference(FooService.class.getName()); - assertNotNull("Check refs not null", ref); - FooService foo = (FooService) sc.getService(ref); - Properties p = foo.fooProps(); - boolean b = ((Boolean) p.get("boolProp")).booleanValue(); - String s = (String) p.get("strProp"); - int i = ((Integer) p.get("intProp")).intValue(); - assertTrue("Test boolean", b); - assertEquals("Test string", s, "foo"); - //TODO See why it fails... - //assertEquals("Test int", i, 5); // The code fix to 5. - under.dispose(); - } - - @Test - public void testRefuse1() { - Properties props = new Properties(); - props.put("instance.name", "under-ref1"); - ComponentInstance under = null; - try { - under = refuse1F.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - - assertTrue("Check that under is not valid", under.getState() == ComponentInstance.INVALID); - - under.dispose(); - } - - @Test - public void testRefuse2() { - Properties props = new Properties(); - props.put("instance.name", "under-ref2"); - ComponentInstance under = null; - try { - under = refuse2F.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - - assertTrue("Check that under is not valid", under.getState() == ComponentInstance.INVALID); - - under.dispose(); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfiguration.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfiguration.java deleted file mode 100644 index a2be2c077a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestConfiguration.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestConfiguration extends Common { - - private ComponentFactory compositeFactory; - - @Before - public void setUp() { - compositeFactory = (ComponentFactory) ipojoHelper.getFactory("CONF-MySuperComposite"); - } - - @After - public void tearDown() { - - } - - @Test - public void testDefaultInstantiation() throws InvalidSyntaxException { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = compositeFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - ServiceReference[] refs = sc.getServiceReferences(FooService.class.getName(), null); - assertEquals(2, refs.length); - for (int i = 0; i < refs.length; i++) { - assertEquals(3, ((Integer) refs[i].getProperty("int")).intValue()); - assertEquals("foo", (String) refs[i].getProperty("string")); - } - under.dispose(); - } - - @Test - public void testConfiguredInstantiation() throws InvalidSyntaxException { - Properties props = new Properties(); - props.put("instance.name", "under"); - props.put("string", "bar"); - props.put("int", "25"); - ComponentInstance under = null; - try { - under = compositeFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - ServiceReference[] refs = sc.getServiceReferences(FooService.class.getName(), null); - assertEquals(2, refs.length); - for (int i = 0; i < refs.length; i++) { - assertEquals(25, ((Integer) refs[i].getProperty("int")).intValue()); - assertEquals("bar", (String) refs[i].getProperty("string")); - } - under.dispose(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestMultipleInstantiation.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestMultipleInstantiation.java deleted file mode 100644 index 3aa511f54e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestMultipleInstantiation.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.composite.CompositeInstanceDescription; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestMultipleInstantiation extends Common { - - private ComponentFactory bar2Factory; - private ComponentInstance empty; - - @Before - public void setUp() { - bar2Factory = (ComponentFactory) ipojoHelper.getFactory("composite.bar.2"); - Factory fact = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - try { - empty = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the empty composite : " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testCreation() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailability() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - assertNotNull("Check service availability", sc.getServiceReference(BarService.class.getName())); - int count = ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length; - assertEquals("Check service provider number : " + count, count, 3); - - under.dispose(); - } - - @Test - public void testCreationLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailabilityLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - assertNotNull("Check service availability", sc2.getServiceReference(BarService.class.getName())); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, BarService.class.getName(), null).length, 3); - - under.dispose(); - } - - @Test - public void testFactoryManagement() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - ServiceContext sc = getServiceContext(under); - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length, 2); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length, 1); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length, 0); - - fact1.start(); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length, 1); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test - public void testFactoryManagementLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, BarService.class.getName(), null).length, 2); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, BarService.class.getName(), null).length, 1); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, BarService.class.getName(), null).length, 0); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, BarService.class.getName(), null).length, 1); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test - public void testArchitecture() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - Architecture arch = (Architecture) getContext().getService(ref); - CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription(); - - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - InstanceDescription[] contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 3); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.2"); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 2); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.2"); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.2"); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 0); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.2"); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.2"); - - getContext().ungetService(ref); - under.dispose(); - fact2.start(); - fact3.start(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalInstantiation.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalInstantiation.java deleted file mode 100644 index 667d7242bc..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalInstantiation.java +++ /dev/null @@ -1,273 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.composite.CompositeInstanceDescription; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalInstantiation extends Common { - - private ComponentFactory bar1Factory; - private ComponentInstance empty; - - @Before - public void setUp() { - bar1Factory = (ComponentFactory) ipojoHelper.getFactory("composite.bar.3"); - Factory fact = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name","empty"); - try { - empty = fact.createComponentInstance(props); - } catch(Exception e) { - fail("Cannot create the empty composite : " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testCreation() { - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test public void testServiceAvailability() { - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - assertNotNull("Check service availability", sc.getServiceReference(BarService.class.getName())); - - under.dispose(); - } - - @Test public void testCreationLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test public void testServiceAvailabilityLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - assertNotNull("Check service availability", sc2.getServiceReference(BarService.class.getName())); - - under.dispose(); - } - - @Test public void testFactoryManagement() { - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fact3.stop(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - assertNull("Check that no Bar Service is available", sc.getServiceReference(BarService.class.getName())); - - fact1.start(); - assertTrue("Check instance validity - 5", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test public void testFactoryManagementLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fact3.stop(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - fact1.start(); - assertTrue("Check instance validity - 5", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test public void testArchitecture() { - Properties props = new Properties(); - props.put("instance.name","under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch(Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - Architecture arch = (Architecture) getContext().getService(ref); - assertNotNull("Check architecture", arch); - CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - InstanceDescription[] contained = id.getContainedInstances(); - assertNotNull("Check contained not null", contained); - assertEquals("Check contained instances count ("+contained.length+") - 1", contained.length, 1); - assertEquals("Check instance name" , id.getName(), "under"); - assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3"); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name" , id.getName(), "under"); - assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3"); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name" , id.getName(), "under"); - assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3"); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 0); - assertEquals("Check instance name" , id.getName(), "under"); - assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3"); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name" , id.getName(), "under"); - assertEquals("Check component type name" , id.getComponentDescription().getName(), "composite.bar.3"); - - getContext().ungetService(ref); - under.dispose(); - fact2.start(); - fact3.start(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalMultipleInstantiation.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalMultipleInstantiation.java deleted file mode 100644 index 0dd0c052c4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestOptionalMultipleInstantiation.java +++ /dev/null @@ -1,214 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestOptionalMultipleInstantiation extends Common { - - private ComponentFactory bar2Factory; - private ComponentInstance empty; - - @Before - public void setUp() { - bar2Factory = (ComponentFactory) ipojoHelper.getFactory("composite.bar.4"); - assertNotNull("Check bar2factory availability", bar2Factory); - - Factory fact = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - try { - empty = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the empty composite : " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testCreation() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailability() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - assertNotNull("Check service availability", sc.getServiceReference(BarService.class.getName())); - int count = ipojoHelper.getServiceReferences(sc, BarService.class.getName(), null).length; - assertEquals("Check service provider number : " + count, count, 3); - - under.dispose(); - } - - @Test - public void testCreationLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailabilityLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - assertNotNull("Check service availability", sc2.getServiceReference(BarService.class.getName())); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, - BarService.class.getName(), null).length, 3); - - under.dispose(); - } - - @Test - public void testFactoryManagement() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - ServiceContext sc = getServiceContext(under); - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, - BarService.class.getName(), null).length, 2); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, - BarService.class.getName(), null).length, 1); - - fact3.stop(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, - BarService.class.getName(), null).length, 0); - - fact1.start(); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc, - BarService.class.getName(), null).length, 1); - assertTrue("Check instance validity - 5", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test - public void testFactoryManagementLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar2Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, - BarService.class.getName(), null).length, 2); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, - BarService.class.getName(), null).length, 1); - - fact3.stop(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, - BarService.class.getName(), null).length, 0); - - fact1.start(); - assertTrue("Check instance validity - 5", under.getState() == ComponentInstance.VALID); - assertEquals("Check service provider number", ipojoHelper.getServiceReferences(sc2, - BarService.class.getName(), null).length, 1); - - under.dispose(); - fact2.start(); - fact3.start(); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestSimpleInstantiation.java b/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestSimpleInstantiation.java deleted file mode 100644 index 1310a645b1..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-instance-test/src/test/java/org/apache/felix/ipojo/runtime/core/instantiator/TestSimpleInstantiation.java +++ /dev/null @@ -1,274 +0,0 @@ -/* - * 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.ipojo.runtime.core.instantiator; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.composite.CompositeInstanceDescription; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestSimpleInstantiation extends Common { - - private ComponentFactory bar1Factory; - private ComponentInstance empty; - - @Before - public void setUp() { - bar1Factory = (ComponentFactory) ipojoHelper.getFactory("composite.bar.1"); - Factory fact = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty-X"); - try { - empty = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the empty composite : " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testCreation() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailability() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc = getServiceContext(under); - assertNotNull("Check service availability", sc.getServiceReference(BarService.class.getName())); - - under.dispose(); - } - - @Test - public void testCreationLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - under.dispose(); - } - - @Test - public void testServiceAvailabilityLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under-X"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity", under.getState() == ComponentInstance.VALID); - ServiceContext sc2 = getServiceContext(under); - assertNotNull("Check service availability", sc2.getServiceReference(BarService.class.getName())); - - under.dispose(); - } - - @Test - public void testFactoryManagement() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test - public void testFactoryManagementLevel2() { - ServiceContext sc = getServiceContext(empty); - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props, sc); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - assertTrue("Check instance validity - 1", under.getState() == ComponentInstance.VALID); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - - under.dispose(); - fact2.start(); - fact3.start(); - } - - @Test - public void testArchitecture() { - Properties props = new Properties(); - props.put("instance.name", "under"); - ComponentInstance under = null; - try { - under = bar1Factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate under : " + e.getMessage()); - } - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - Architecture arch = (Architecture) getContext().getService(ref); - CompositeInstanceDescription id = (CompositeInstanceDescription) arch.getInstanceDescription(); - - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - InstanceDescription[] contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - ComponentFactory fact1 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-1"); - ComponentFactory fact2 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-2"); - ComponentFactory fact3 = (ComponentFactory) ipojoHelper.getFactory("COMPO-FooBarProviderType-3"); - - fact1.stop(); - assertTrue("Check instance validity - 2", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact2.stop(); - assertTrue("Check instance validity - 3", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact3.stop(); - assertTrue("Check instance invalidity", under.getState() == ComponentInstance.INVALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.INVALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 0); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - fact1.start(); - assertTrue("Check instance validity - 4", under.getState() == ComponentInstance.VALID); - ref = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "under"); - assertNotNull("Check architecture availability", ref); - arch = (Architecture) getContext().getService(ref); - //id = arch.getInstanceDescription(); - assertTrue("Check instance validity - 1", id.getState() == ComponentInstance.VALID); - contained = id.getContainedInstances(); - assertEquals("Check contained instances count", contained.length, 1); - assertEquals("Check instance name", id.getName(), "under"); - assertEquals("Check component type name", id.getComponentDescription().getName(), "composite.bar.1"); - - under.dispose(); - fact2.start(); - fact3.start(); - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/pom.xml b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/pom.xml deleted file mode 100644 index 3ca125fe7b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.composite-it - 1.12.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - - ipojo-composite-runtime-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java deleted file mode 100644 index 20e2773499..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class Baz2CheckProvider implements CheckService { - - BazService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int simpleU = 0; - int objectU = 0; - int refU = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("result", new Boolean(fs.foo())); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - - return props; - } - - private void voidBind() { - simpleB++; - } - private void voidUnbind() { - simpleU++; - } - - protected void objectBind(Object o) { - if(o != null && o instanceof FooService) { objectB++; } - } - protected void objectUnbind(Object o) { - if(o != null && o instanceof FooService) { objectU++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java deleted file mode 100644 index 5711222bb3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; - -import java.util.Properties; - -public class BazProviderType1 implements BazService { - - private int m_bar; - private String m_foo; - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - p.put("foo", m_foo); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index c53570bdc9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index a0e9e430dc..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 700d9fe49a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java deleted file mode 100644 index f1732ba9e3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn2 implements FooService { - - private int intProp = 2; - private boolean boolProp = true; - private String strProp = "foo"; - private String[] strAProp = new String[] {"foo", "bar"}; - private int[] intAProp = new int[] {1, 2, 3}; - - public boolean foo() { - intAProp = null; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java deleted file mode 100644 index 84f9e3628e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Tata; - -import java.util.Properties; - - -public class TataProvider implements Tata { - - int tata = 0; - int tataStr = 0; - int tataStrs = 0; - int tata_2 = 0; - int tata_3 = 0; - int tata1 = 0; - int tata1_1 = 0; - int tata5 = 0; - int tata5_1 = 0; - int tata5_2 = 0; - int tataBoolean = 0; - int tataBooleans = 0; - int tataByte = 0; - int tataBytes = 0; - private int add; - private int tataShorts; - private int tataShort; - private int tataLongs; - private int tataLong; - private int tataInts; - private int tataInt; - private int tataFloat; - private int tataFloats; - private int tataDoubles; - private int tataDouble; - private int tataChars; - private int tataChar; - - public Properties getPropsTata() { - Properties props = new Properties(); - props.put("tata", new Integer(tata)); - props.put("tataStr", new Integer(tataStr)); - props.put("tataStrs", new Integer(tataStrs)); - props.put("tata_2", new Integer(tata_2)); - props.put("tata_3", new Integer(tata_3)); - props.put("tata1", new Integer(tata1)); - props.put("tata1_1", new Integer(tata1_1)); - props.put("tata5", new Integer(tata5)); - props.put("tata5_1", new Integer(tata5_1)); - props.put("tata5_2", new Integer(tata5_2)); - props.put("add", new Integer(add)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataByte", new Integer(tataByte)); - props.put("tataBytes", new Integer(tataBytes)); - props.put("tataShort", new Integer(tataShort)); - props.put("tataShorts", new Integer(tataShorts)); - props.put("tataLongs", new Integer(tataLongs)); - props.put("tataLong", new Integer(tataLong)); - props.put("tataInt", new Integer(tataInt)); - props.put("tataInts", new Integer(tataInts)); - props.put("tataFloat", new Integer(tataFloat)); - props.put("tataFloats", new Integer(tataFloats)); - props.put("tataDouble", new Integer(tataDouble)); - props.put("tataDoubles", new Integer(tataDoubles)); - props.put("tataChar", new Integer(tataChar)); - props.put("tataChars", new Integer(tataChars)); - return props; - } - - public void tata() { - tata++; - } - - public String tataStr() { - tataStr++; - return "Tata"; - } - - public String[] tataStrs() { - tataStrs++; - return new String[] {"T", "A", "T", "A"}; - } - - public void tata(int i, int j) { - tata_2++; - } - - public void tata(String s) { - tata_3++; - } - - public String tata1(String a) { - tata1++; - return a; - } - - public String tata1(char[] a) { - tata1_1++; - String s = new String(a); - return s; - } - - public String tata5(String a, int i) { - tata5++; - return a+i; - } - - public String tata5(String[] a, int i) { - tata5_1++; - return ""+a.length + i; - } - - public String tata5(String a, int[] i) { - tata5_2++; - return a + i.length; - } - - public boolean tataBoolean(boolean b) { - tataBoolean++; - return b; - } - - public boolean[] tataBooleans(boolean[] b) { - tataBooleans++; - return b; - } - - public byte tataByte(byte b) { - tataByte++; - return b; - } - - public byte[] tataBytes(byte[] b) { - tataBytes++; - return b; - } - - public char tataChar(char c) { - tataChar++; - return c; - } - - public char[] tataChars(char[] c) { - tataChars++; - return c; - } - - public double tataDouble(double d) { - tataDouble++; - return d; - } - - public double[] tataDoubles(double[] d) { - tataDoubles++; - return d; - } - - public float tataFloat(float f) { - tataFloat++; - return f; - } - - public float[] tataFloats(float[] f) { - tataFloats++; - return f; - } - - public int tataInt(int i) { - tataInt++; - return i; - } - - public int[] tataInts(int[] its) { - tataInts++; - return its; - } - - public long tataLong(long l) { - tataLong++; - return l; - } - - public long[] tataLongs(long[] l) { - tataLongs++; - return l; - } - - public short tataShort(short s) { - tataShort++; - return s; - } - - public short[] tataShorts(short[] s) { - tataShorts++; - return s; - } - - public long add(int i, int j, int k) { - add++; - return i + j + k; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java deleted file mode 100644 index 5c2c03391c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProvider implements Toto { - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - } - - public void toto(int i, int j) { - toto_2++; - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("toto", new Integer(toto)); - props.put("toto_2", new Integer(toto_2)); - props.put("toto_3", new Integer(toto_3)); - props.put("toto_4", new Integer(toto_4)); - props.put("toto1", new Integer(toto1)); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java deleted file mode 100644 index dccebafe70..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProviderGlue implements Toto { - - Toto m_toto; - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - m_toto.toto(); - } - - public void toto(int i, int j) { - toto_2++; - m_toto.toto(i, j); - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - m_toto.toto1(j); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("gtoto", new Integer(toto)); - props.put("gtoto_2", new Integer(toto_2)); - props.put("gtoto_3", new Integer(toto_3)); - props.put("gtoto_4", new Integer(toto_4)); - props.put("gtoto1", new Integer(toto1)); - props.put("glue", "glue"); - Properties p2 = m_toto.getProps(); - props.putAll(p2); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index 5e2b59a0e4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 62eb08d3ae..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java deleted file mode 100644 index b9cec949b7..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BazService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java deleted file mode 100644 index a65e2ddb46..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tata { - - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java deleted file mode 100644 index 82d307c2b0..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tota { - - public static final String specification="specification { " + - "requires { " + - "$specification=\"org.apache.felix.ipojo.test.composite.service.Toto\" " + - "$optional=\"true\" " + - "$aggregate=\"true\" " + - "$type=\"service\" " + - "} }"; - - public Properties getProps() throws UnsupportedOperationException;; - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - - public void toto() throws UnsupportedOperationException; - public void toto(int i, int j) throws UnsupportedOperationException; - public String toto(String a) throws UnsupportedOperationException; - - public void toto1(String j) throws UnsupportedOperationException; - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java deleted file mode 100644 index 037dad355f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Toto { - - public Properties getProps(); - - public void toto(); - public void toto(int i, int j); - public String toto(String a); - public String toto(String[] a); - - public void toto1(String j); - - public int count(); - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/resources/metadata.xml b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/resources/metadata.xml deleted file mode 100644 index bd637650d3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 0b3f1b9360..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,48 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ow2.chameleon.testing.helpers.BaseTest; - -/** - * Bootstrap the test from this project - */ -@ExamReactorStrategy(PerMethod.class) -public class Common extends BaseTest { - - public static ServiceContext getServiceContext(ComponentInstance ci) { - if (ci instanceof CompositeManager) { - return ((CompositeManager) ci).getServiceContext(); - } else { - throw new RuntimeException("Cannot get the service context from a non composite instance"); - } - } - - @Override - public boolean deployiPOJOComposite() { - return true; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/EmptyCompositeTest.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/EmptyCompositeTest.java deleted file mode 100644 index ade8665f85..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/EmptyCompositeTest.java +++ /dev/null @@ -1,228 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.composite.CompositeInstanceDescription; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.junit.Test; -import org.osgi.framework.InvalidSyntaxException; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class EmptyCompositeTest extends Common { - - @Test - public void testEmptyCompositeCreation() { - Factory factory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Unacceptable configuration : " + e.getMessage()); - } - - ComponentTypeDescription cd = ci.getFactory().getComponentDescription(); - assertEquals("Check component type name", cd.getName(), "composite.empty"); -// assertEquals("Check class name (" + cd.getClassName() + ")", cd.getClassName(), "composite"); - assertEquals("Check offered service", cd.getprovidedServiceSpecification().length, 0); - assertEquals("Check configurable properties", cd.getProperties().length, 0); - - CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state (" + id.getState() + ")", id.getState(), ComponentInstance.VALID); - - assertEquals("Check contained instance", id.getContainedInstances().length, 0); - - assertTrue("Check composite manager", ci instanceof CompositeManager); - CompositeManager cm = (CompositeManager) ci; - ServiceContext sc = cm.getServiceContext(); - try { - assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e.getMessage()); - } - ci.dispose(); - } - - @Test - public void testInstanceCreation1() { - Factory factory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Unacceptable configuration : " + e.getMessage()); - } - - assertTrue("Check composite manager", ci instanceof CompositeManager); - CompositeManager cm = (CompositeManager) ci; - ServiceContext sc = cm.getServiceContext(); - try { - assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), - null).length, getContext().getServiceReferences(Factory.class.getName(), null).length); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e.getMessage()); - } - - Properties props2 = new Properties(); - props2.put("instance.name", "empty2"); - ComponentInstance ci2 = null; - try { - ci2 = factory.createComponentInstance(props2, sc); - } catch (Exception e) { - e.printStackTrace(); - fail("Unacceptable configuration : " + e.getMessage()); - } - - CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 1); - CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0]; - assertEquals("Check composite instance name", id2.getName(), "empty2"); - assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id2.getContainedInstances().length, 0); - - ci2.dispose(); - //id = ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 0); - - ci.dispose(); - } - - @Test - public void testInstanceCreation2() { - Factory factory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Unacceptable configuration : " + e.getMessage()); - } - - assertTrue("Check composite manager", ci instanceof CompositeManager); - CompositeManager cm = (CompositeManager) ci; - ServiceContext sc = cm.getServiceContext(); - try { - assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e.getMessage()); - } - - Factory factory2 = ipojoHelper.getFactory(sc, "composite.empty"); - assertNotNull("Check factory2 not null", factory2); - Properties props2 = new Properties(); - props2.put("instance.name", "empty2"); - ComponentInstance ci2 = null; - try { - ci2 = factory2.createComponentInstance(props2); - } catch (Exception e) { - fail("Unacceptable configuration : " + e.getMessage()); - } - - CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 1); - CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0]; - assertEquals("Check composite instance name", id2.getName(), "empty2"); - assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id2.getContainedInstances().length, 0); - - ci2.dispose(); - //id = ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 0); - - ci.dispose(); - } - - @Test - public void testInstanceCreation3() { - Factory factory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty"); - - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Unacceptable configuration : " + e.getMessage()); - } - - assertTrue("Check composite manager", ci instanceof CompositeManager); - CompositeManager cm = (CompositeManager) ci; - ServiceContext sc = cm.getServiceContext(); - try { - assertEquals("Check number of factories imported", sc.getServiceReferences(Factory.class.getName(), null).length, getContext().getServiceReferences(Factory.class.getName(), null).length); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e.getMessage()); - } - - Factory factory2 = ipojoHelper.getFactory(sc, "composite.empty"); - assertNotNull("Check factory2 not null", factory2); - Properties props2 = new Properties(); - props2.put("instance.name", "empty2"); - ComponentInstance ci2 = null; - try { - ci2 = factory2.createComponentInstance(props2, sc); - } catch (Exception e) { - fail("Unacceptable configuration : " + e.getMessage()); - } - - CompositeInstanceDescription id = (CompositeInstanceDescription) ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 1); - CompositeInstanceDescription id2 = (CompositeInstanceDescription) id.getContainedInstances()[0]; - assertEquals("Check composite instance name", id2.getName(), "empty2"); - assertEquals("Check composite instance state", id2.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id2.getContainedInstances().length, 0); - - ci2.dispose(); - //id = ci.getInstanceDescription(); - assertEquals("Check composite instance name", id.getName(), "empty"); - assertEquals("Check composite instance state", id.getState(), ComponentInstance.VALID); - assertEquals("Check contained instance", id.getContainedInstances().length, 0); - - ci.dispose(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/FactoryManagementTest.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/FactoryManagementTest.java deleted file mode 100644 index e3576895bd..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/FactoryManagementTest.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; -import java.util.Properties; - -import static org.junit.Assert.*; - -public class FactoryManagementTest extends Common { - - private FakeFactory fake1 = new FakeFactory("fake"); - private FakeFactory fake2 = new FakeFactory("fake2"); - - private Factory emptyFactory; - private ComponentInstance empty; - - private class FakeFactory implements Factory { - - private String m_name; - - public FakeFactory(String name) { - m_name = name; - } - - public ComponentInstance createComponentInstance(Dictionary arg0) throws UnacceptableConfiguration { - return null; - } - - public ComponentInstance createComponentInstance(Dictionary arg0, ServiceContext arg1) throws UnacceptableConfiguration { - return null; - } - - public Element getDescription() { - return null; - } - - public String getName() { - return m_name; - } - - public boolean isAcceptable(Dictionary arg0) { - return false; - } - - public void reconfigure(Dictionary arg0) throws UnacceptableConfiguration { - } - - public void addFactoryStateListener(FactoryStateListener arg0) { - } - - public List getMissingHandlers() { - return null; - } - - public List getRequiredHandlers() { - return null; - } - - public void removeFactoryStateListener(FactoryStateListener arg0) { - } - - public ComponentTypeDescription getComponentDescription() { - return null; - } - - public String getClassName() { - return ""; - } - - public int getState() { - return Factory.VALID; - } - - public BundleContext getBundleContext() { - return getContext(); - } - - public String getVersion() { - return null; - } - - public Element getComponentMetadata() { - return null; - } - - public List getInstances() { - return new ArrayList(); - } - - public List getInstancesNames() { - return new ArrayList(); - } - - } - - @Before - public void setUp() { - emptyFactory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty-1"); - try { - empty = emptyFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create empty instance " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testOneLevelExposition() { - ServiceReference[] parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - ServiceContext sc = getServiceContext(empty); - ServiceReference[] internalFactoryReferences = ipojoHelper.getServiceReferences(sc, Factory.class.getName(), null); - - assertEquals("Check the number of available factories", parentsFactoryReferences.length, internalFactoryReferences.length); - - for (int i = 0; i < parentsFactoryReferences.length; i++) { - Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]); - assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, internalFactoryReferences, sc)); - } - } - - @Test - public void testTwoLevelExposition() { - ServiceReference[] parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - ServiceContext sc1 = getServiceContext(empty); - ServiceReference[] Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - ServiceReference[] Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - for (int i = 0; i < Level1FactoryReferences.length; i++) { - Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]); - assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, Level2FactoryReferences, sc2)); - } - - empty2.dispose(); - } - - @Test - public void testDynamism() { - ServiceReference[] parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - ServiceContext sc1 = getServiceContext(empty); - ServiceReference[] Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - ServiceReference[] Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - for (int i = 0; i < Level1FactoryReferences.length; i++) { - Factory factory = (Factory) getContext().getService(parentsFactoryReferences[i]); - assertTrue("Check the avaibility of " + factory.getName(), isExposed(factory, Level2FactoryReferences, sc2)); - } - - // Publish fake1 - ServiceRegistration reg1 = getContext().registerService(Factory.class.getName(), fake1, null); - - parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - sc1 = getServiceContext(empty); - Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - sc2 = getServiceContext(empty2); - Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1.1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 1.2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 1.3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - // Publish fake2 - ServiceRegistration reg2 = getContext().registerService(Factory.class.getName(), fake2, null); - - parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - sc1 = getServiceContext(empty); - Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - sc2 = getServiceContext(empty2); - Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1.1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 1.2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 1.3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - reg1.unregister(); - - parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - sc1 = getServiceContext(empty); - Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - sc2 = getServiceContext(empty2); - Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1.1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 1.2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 1.3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - reg2.unregister(); - - parentsFactoryReferences = osgiHelper.getServiceReferences(Factory.class.getName(), null); - sc1 = getServiceContext(empty); - Level1FactoryReferences = ipojoHelper.getServiceReferences(sc1, Factory.class.getName(), null); - sc2 = getServiceContext(empty2); - Level2FactoryReferences = ipojoHelper.getServiceReferences(sc2, Factory.class.getName(), null); - - assertEquals("Check the number of available factories - 1.1", parentsFactoryReferences.length, Level1FactoryReferences.length); - assertEquals("Check the number of available factories - 1.2", parentsFactoryReferences.length, Level2FactoryReferences.length); - assertEquals("Check the number of available factories - 1.3", Level1FactoryReferences.length, Level2FactoryReferences.length); - - empty2.dispose(); - } - - @Test - public void testInvocation() { - ServiceContext sc1 = getServiceContext(empty); - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - - Factory fact1 = ipojoHelper.getFactory(sc2, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc2, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - assertNotNull("Check ref existency", ref); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - client.dispose(); - provider.dispose(); - empty2.dispose(); - } - - - private boolean isExposed(Factory fact, ServiceReference[] refs, ServiceContext sc) { - for (int i = 0; i < refs.length; i++) { - Factory f = (Factory) sc.getService(refs[i]); - if (fact.getName().equals(f.getName())) { - sc.ungetService(refs[i]); - return true; - } - sc.ungetService(refs[i]); - } - return false; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRangeTest.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRangeTest.java deleted file mode 100644 index 88363eecf5..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRangeTest.java +++ /dev/null @@ -1,510 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class ServiceRangeTest extends Common { - - private Factory emptyFactory; - private ComponentInstance empty; - - - @Before - public void setUp() { - emptyFactory = ipojoHelper.getFactory("composite.empty"); - Properties props = new Properties(); - props.put("instance.name", "empty-1"); - try { - empty = emptyFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create empty instance " + e.getMessage()); - } - } - - @After - public void tearDown() { - empty.dispose(); - empty = null; - } - - @Test - public void testLevelOne1() { - ServiceContext sc2 = getServiceContext(empty); - - Factory fact1 = ipojoHelper.getFactory(sc2, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc2, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - provider.dispose(); - client.dispose(); - - assertNull("Check foo service invisible inside the composite", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible from the context", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - } - - @Test - public void testLevelOne2() { - ServiceContext sc2 = getServiceContext(empty); - - Factory fact1 = ipojoHelper.getFactory(sc2, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props, sc2); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc2, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2, sc2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - } - - @Test - public void testLevelOne3() { - ServiceContext sc2 = getServiceContext(empty); - - Factory fact1 = ipojoHelper.getFactory("COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props, sc2); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2, sc2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the context", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - } - - @Test - public void testLevelTwo1() { - ServiceContext sc1 = getServiceContext(empty); - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - - Factory fact1 = ipojoHelper.getFactory(sc2, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc2, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - empty2.dispose(); - } - - @Test - public void testLevelTwo2() { - ServiceContext sc1 = getServiceContext(empty); - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - - Factory fact1 = ipojoHelper.getFactory(sc1, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props, sc2); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc1, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2, sc2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - empty2.dispose(); - } - - @Test - public void testLevelTwo3() { - ServiceContext sc1 = getServiceContext(empty); - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - - Factory fact1 = ipojoHelper.getFactory("COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props, sc2); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory("COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2, sc2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - empty2.dispose(); - } - - @Test - public void testLevelTwo4() { - ServiceContext sc1 = getServiceContext(empty); - Factory fact = ipojoHelper.getFactory(sc1, "composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty2"); - ComponentInstance empty2 = null; - try { - empty2 = fact.createComponentInstance(p); - } catch (Exception e) { - fail("Cannot instantiate empty2 instance : " + e.getMessage()); - } - - ServiceContext sc2 = getServiceContext(empty2); - - Factory fact1 = ipojoHelper.getFactory(sc2, "COMPO-SimpleCheckServiceProvider"); - Properties props = new Properties(); - props.put("instance.name", "client"); - ComponentInstance client = null; - try { - client = fact1.createComponentInstance(props, sc2); - } catch (Exception e) { - fail("Cannot instantiate the client : " + e.getMessage()); - } - - Factory fact2 = ipojoHelper.getFactory(sc2, "COMPO-FooProviderType-1"); - Properties props2 = new Properties(); - props2.put("instance.name", "provider"); - ComponentInstance provider = null; - try { - provider = fact2.createComponentInstance(props2, sc2); - } catch (Exception e) { - fail("Cannot instantiate the provider : " + e.getMessage()); - } - - ServiceReference ref = sc2.getServiceReference(CheckService.class.getName()); - CheckService check = (CheckService) sc2.getService(ref); - - assertTrue("Check invocation", check.check()); - - sc2.ungetService(ref); - - // Check visibility - assertNotNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNotNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - // Check invisibilty - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - - client.dispose(); - provider.dispose(); - - assertNull("Check foo service visible inside the composite 2", sc2.getServiceReference(FooService.class.getName())); - assertNull("Check check service visible inside the composite 2", sc2.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the composite 1", sc1.getServiceReference(FooService.class.getName())); - assertNull("Check check service invisible inside the composite 1", sc1.getServiceReference(CheckService.class.getName())); - assertNull("Check foo service invisible inside the global", getContext().getServiceReference(FooService.class.getName())); - try { - assertNull("Check check service invisible inside the context", getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=client)")); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e); - } - empty2.dispose(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRegistryTest.java b/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRegistryTest.java deleted file mode 100644 index 6c41da30ea..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-runtime-test/src/test/java/org/apache/felix/ipojo/runtime/core/ServiceRegistryTest.java +++ /dev/null @@ -1,282 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.InstanceStateListener; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.context.ServiceRegistry; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.junit.Test; -import org.osgi.framework.*; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static org.junit.Assert.*; - -public class ServiceRegistryTest extends Common { - - private class svcListener implements ServiceListener { - public int registration = 0; - public int unregistration = 0; - public int modification = 0; - - public void serviceChanged(ServiceEvent ev) { - if (ev.getType() == ServiceEvent.REGISTERED) { - registration++; - } - if (ev.getType() == ServiceEvent.UNREGISTERING) { - unregistration++; - } - if (ev.getType() == ServiceEvent.MODIFIED) { - modification++; - } - } - } - - private class barProvider implements BarService { - - public boolean bar() { - return true; - } - - public Properties getProps() { - return null; - } - - } - - private class FakeComponent implements ComponentInstance { - - public ComponentTypeDescription getComponentDescription() { - return null; - } - - public BundleContext getContext() { - return null; - } - - public ComponentFactory getFactory() { - return null; - } - - public InstanceDescription getInstanceDescription() { - return null; - } - - public String getInstanceName() { - return null; - } - - public int getState() { - return 0; - } - - public boolean isStarted() { - return false; - } - - public void reconfigure(Dictionary dictionary) { - } - - public void start() { - } - - public void stop() { - } - - public void dispose() { - } - - public void addInstanceStateListener(InstanceStateListener arg0) { - } - - public void removeInstanceStateListener(InstanceStateListener arg0) { - } - - } - - @Test - public void testRegistrationAndListener() { - ComponentInstance im = new FakeComponent(); - ComponentInstance im2 = new FakeComponent(); - ServiceRegistry registry = new ServiceRegistry(getContext()); - assertNotNull("Assert registry not null", registry); - svcListener all = new svcListener(); - try { - assertNull("Check that there is no available service", registry.getServiceReferences(null, null)); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - registry.addServiceListener(all); - - ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), null); - - try { - assertEquals("Check number of registred service", 1, registry.getServiceReferences(null, null).length); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - ServiceRegistration reg2 = registry.registerService(im2, BarService.class.getName(), new barProvider(), null); - - try { - assertEquals("Check number of registred service", 2, registry.getServiceReferences(null, null).length); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - assertEquals("Check the number of registration", 2, all.registration); - - Dictionary props = new Hashtable(); - props.put("foo", "bar"); - reg1.setProperties(props); - assertEquals("Check the number of modification", 1, all.modification); - - reg1.unregister(); - assertEquals("Check the number of unregistration", 1, all.unregistration); - - reg2.setProperties(props); - assertEquals("Check the number of modification", 2, all.modification); - - reg2.unregister(); - assertEquals("Check the number of unregistration", 2, all.unregistration); - - registry.removeServiceListener(all); - } - - @Test - public void testRegistrationAndFilter() { - ComponentInstance im = new FakeComponent(); - ComponentInstance im2 = new FakeComponent(); - ServiceRegistry registry = new ServiceRegistry(getContext()); - svcListener filtered = new svcListener(); - - try { - assertNull("Check that there is no available service", registry.getServiceReferences(null, null)); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - registry.addServiceListener(filtered, "(foo=bar)"); - - Dictionary props = new Hashtable(); - props.put("foo", "bar"); - ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), props); - - try { - assertEquals("Check number of registred service", 1, registry.getServiceReferences(null, null).length); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - ServiceRegistration reg2 = registry.registerService(im2, BarService.class.getName(), new barProvider(), null); - - try { - assertEquals("Check number of registred service", 2, registry.getServiceReferences(null, null).length); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - assertEquals("Check the number of registration", 1, filtered.registration); - - reg2.setProperties(props); - assertEquals("Check the number of modification", 1, filtered.modification); - // Follow the OSGi semantics of filters - - reg1.unregister(); - reg2.unregister(); - assertEquals("Check the number of unregistration", 2, filtered.unregistration); - registry.removeServiceListener(filtered); - } - - @Test - public void testGetService() { - ComponentInstance im = new FakeComponent(); - ComponentInstance im2 = new FakeComponent(); - ServiceRegistry registry = new ServiceRegistry(getContext()); - - try { - assertNull("Check that there is no available service", registry.getServiceReferences(null, null)); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - Properties props = new Properties(); - props.put("foo", "bar"); - ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), props); - - ServiceReference ref = registry.getServiceReference(BarService.class.getName()); - assertNotNull("Check ref not null", ref); - assertEquals("Test property", ref.getProperty("foo"), "bar"); - BarService bar = (BarService) registry.getService(im2, ref); - assertTrue("Test invocation", bar.bar()); - - reg1.unregister(); - ref = registry.getServiceReference(BarService.class.getName()); - assertNull("Check ref null", ref); - } - - @Test - public void testGetFilteredService() { - ComponentInstance im = new FakeComponent(); - ComponentInstance im2 = new FakeComponent(); - ServiceRegistry registry = new ServiceRegistry(getContext()); - - try { - assertNull("Check that there is no available service", registry.getServiceReferences(null, null)); - } catch (InvalidSyntaxException e) { - fail("Cannot query the registry : " + e.getMessage()); - } - - Properties props = new Properties(); - props.put("foo", "bar"); - ServiceRegistration reg1 = registry.registerService(im, BarService.class.getName(), new barProvider(), props); - ServiceRegistration reg2 = registry.registerService(im2, BarService.class.getName(), new barProvider(), null); - - ServiceReference[] ref = null; - try { - ref = registry.getServiceReferences(BarService.class.getName(), "(foo=bar)"); - } catch (InvalidSyntaxException e) { - fail("Registry query fail : " + e.getMessage()); - } - assertNotNull("Check ref not null", ref); - assertEquals("Check ref count", ref.length, 1); - assertEquals("Test property", ref[0].getProperty("foo"), "bar"); - BarService bar = (BarService) registry.getService(im2, ref[0]); - assertTrue("Test invocation", bar.bar()); - - ref = null; - reg1.unregister(); - try { - ref = registry.getServiceReferences(BarService.class.getName(), "(bar=foo)"); - } catch (InvalidSyntaxException e) { - fail("Registry query fail : " + e.getMessage()); - } - assertNull("Check ref null", ref); - - reg2.unregister(); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/pom.xml b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/pom.xml deleted file mode 100644 index 66dae867b4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/pom.xml +++ /dev/null @@ -1,36 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.composite-it - 1.12.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - - ipojo-composite-service-providing-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java deleted file mode 100644 index 20e2773499..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Baz2CheckProvider.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class Baz2CheckProvider implements CheckService { - - BazService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int simpleU = 0; - int objectU = 0; - int refU = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("result", new Boolean(fs.foo())); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - - return props; - } - - private void voidBind() { - simpleB++; - } - private void voidUnbind() { - simpleU++; - } - - protected void objectBind(Object o) { - if(o != null && o instanceof FooService) { objectB++; } - } - protected void objectUnbind(Object o) { - if(o != null && o instanceof FooService) { objectU++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java deleted file mode 100644 index 5711222bb3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/BazProviderType1.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BazService; - -import java.util.Properties; - -public class BazProviderType1 implements BazService { - - private int m_bar; - private String m_foo; - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - p.put("foo", m_foo); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index c53570bdc9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index a0e9e430dc..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 700d9fe49a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java deleted file mode 100644 index f1732ba9e3..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn2 implements FooService { - - private int intProp = 2; - private boolean boolProp = true; - private String strProp = "foo"; - private String[] strAProp = new String[] {"foo", "bar"}; - private int[] intAProp = new int[] {1, 2, 3}; - - public boolean foo() { - intAProp = null; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java deleted file mode 100644 index f77205902e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceConsumer.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.Service; - -import java.util.Properties; - -public class ServiceConsumer implements CheckService { - - private Service service; - private Properties props = new Properties(); - - public ServiceConsumer() { - props.put("1", new Integer(service.count())); - props.put("2", new Integer(service.count())); - props.put("3", new Integer(service.count())); - } - - public boolean check() { - return service.count() > 0; - } - - public Properties getProps() { - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java deleted file mode 100644 index 9c2f212b44..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ServiceProvider.java +++ /dev/null @@ -1,34 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Service; - - -public class ServiceProvider implements Service { - - private int i = 0; - - public int count() { - i++; - return i; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java deleted file mode 100644 index 84f9e3628e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TataProvider.java +++ /dev/null @@ -1,222 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Tata; - -import java.util.Properties; - - -public class TataProvider implements Tata { - - int tata = 0; - int tataStr = 0; - int tataStrs = 0; - int tata_2 = 0; - int tata_3 = 0; - int tata1 = 0; - int tata1_1 = 0; - int tata5 = 0; - int tata5_1 = 0; - int tata5_2 = 0; - int tataBoolean = 0; - int tataBooleans = 0; - int tataByte = 0; - int tataBytes = 0; - private int add; - private int tataShorts; - private int tataShort; - private int tataLongs; - private int tataLong; - private int tataInts; - private int tataInt; - private int tataFloat; - private int tataFloats; - private int tataDoubles; - private int tataDouble; - private int tataChars; - private int tataChar; - - public Properties getPropsTata() { - Properties props = new Properties(); - props.put("tata", new Integer(tata)); - props.put("tataStr", new Integer(tataStr)); - props.put("tataStrs", new Integer(tataStrs)); - props.put("tata_2", new Integer(tata_2)); - props.put("tata_3", new Integer(tata_3)); - props.put("tata1", new Integer(tata1)); - props.put("tata1_1", new Integer(tata1_1)); - props.put("tata5", new Integer(tata5)); - props.put("tata5_1", new Integer(tata5_1)); - props.put("tata5_2", new Integer(tata5_2)); - props.put("add", new Integer(add)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataBoolean", new Integer(tataBoolean)); - props.put("tataByte", new Integer(tataByte)); - props.put("tataBytes", new Integer(tataBytes)); - props.put("tataShort", new Integer(tataShort)); - props.put("tataShorts", new Integer(tataShorts)); - props.put("tataLongs", new Integer(tataLongs)); - props.put("tataLong", new Integer(tataLong)); - props.put("tataInt", new Integer(tataInt)); - props.put("tataInts", new Integer(tataInts)); - props.put("tataFloat", new Integer(tataFloat)); - props.put("tataFloats", new Integer(tataFloats)); - props.put("tataDouble", new Integer(tataDouble)); - props.put("tataDoubles", new Integer(tataDoubles)); - props.put("tataChar", new Integer(tataChar)); - props.put("tataChars", new Integer(tataChars)); - return props; - } - - public void tata() { - tata++; - } - - public String tataStr() { - tataStr++; - return "Tata"; - } - - public String[] tataStrs() { - tataStrs++; - return new String[] {"T", "A", "T", "A"}; - } - - public void tata(int i, int j) { - tata_2++; - } - - public void tata(String s) { - tata_3++; - } - - public String tata1(String a) { - tata1++; - return a; - } - - public String tata1(char[] a) { - tata1_1++; - String s = new String(a); - return s; - } - - public String tata5(String a, int i) { - tata5++; - return a+i; - } - - public String tata5(String[] a, int i) { - tata5_1++; - return ""+a.length + i; - } - - public String tata5(String a, int[] i) { - tata5_2++; - return a + i.length; - } - - public boolean tataBoolean(boolean b) { - tataBoolean++; - return b; - } - - public boolean[] tataBooleans(boolean[] b) { - tataBooleans++; - return b; - } - - public byte tataByte(byte b) { - tataByte++; - return b; - } - - public byte[] tataBytes(byte[] b) { - tataBytes++; - return b; - } - - public char tataChar(char c) { - tataChar++; - return c; - } - - public char[] tataChars(char[] c) { - tataChars++; - return c; - } - - public double tataDouble(double d) { - tataDouble++; - return d; - } - - public double[] tataDoubles(double[] d) { - tataDoubles++; - return d; - } - - public float tataFloat(float f) { - tataFloat++; - return f; - } - - public float[] tataFloats(float[] f) { - tataFloats++; - return f; - } - - public int tataInt(int i) { - tataInt++; - return i; - } - - public int[] tataInts(int[] its) { - tataInts++; - return its; - } - - public long tataLong(long l) { - tataLong++; - return l; - } - - public long[] tataLongs(long[] l) { - tataLongs++; - return l; - } - - public short tataShort(short s) { - tataShort++; - return s; - } - - public short[] tataShorts(short[] s) { - tataShorts++; - return s; - } - - public long add(int i, int j, int k) { - add++; - return i + j + k; - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java deleted file mode 100644 index 5c2c03391c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProvider implements Toto { - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - } - - public void toto(int i, int j) { - toto_2++; - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("toto", new Integer(toto)); - props.put("toto_2", new Integer(toto_2)); - props.put("toto_3", new Integer(toto_3)); - props.put("toto_4", new Integer(toto_4)); - props.put("toto1", new Integer(toto1)); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java deleted file mode 100644 index dccebafe70..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/TotoProviderGlue.java +++ /dev/null @@ -1,81 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.Toto; - -import java.util.Properties; - - -public class TotoProviderGlue implements Toto { - - Toto m_toto; - - private int i = 0; - public static int toto = 0; - public static int toto_2 = 0; - public static int toto_3 = 0; - public static int toto_4 = 0; - public static int toto1 = 0; - - public int count() { - return i; - } - - public void toto() { - toto++; - m_toto.toto(); - } - - public void toto(int i, int j) { - toto_2++; - m_toto.toto(i, j); - } - - public String toto(String a) { - toto_3++; - return a; - } - - public String toto(String[] a) { - toto_4++; - return "toto"; - } - - public void toto1(String j) { - i++; - toto1++; - m_toto.toto1(j); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("i", new Integer(i)); - props.put("gtoto", new Integer(toto)); - props.put("gtoto_2", new Integer(toto_2)); - props.put("gtoto_3", new Integer(toto_3)); - props.put("gtoto_4", new Integer(toto_4)); - props.put("gtoto1", new Integer(toto1)); - props.put("glue", "glue"); - Properties p2 = m_toto.getProps(); - props.putAll(p2); - return props; - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java deleted file mode 100644 index 5e2b59a0e4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/A123/CheckService2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.services.A123; - -public interface CheckService2 { - - public boolean check(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 62eb08d3ae..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java deleted file mode 100644 index b9cec949b7..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BazService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BazService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java deleted file mode 100644 index 6ef60bf384..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Service.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface Service { - - public int count(); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java deleted file mode 100644 index a65e2ddb46..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tata.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tata { - - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java deleted file mode 100644 index 8f10422a4e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Tota.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Tota { - - public static final String specification="specification { " + - "requires { " + - "$specification=\"org.apache.felix.ipojo.runtime.core.services.Toto\" " + - "$optional=\"true\" " + - "$aggregate=\"true\" " + - "$type=\"service\" " + - "} }"; - - public Properties getProps() throws UnsupportedOperationException;; - public Properties getPropsTata(); - - public void tata(); - - public int tataInt(int i); - public long tataLong(long l); - public double tataDouble(double d); - public char tataChar(char c); - public boolean tataBoolean(boolean b); - public short tataShort(short s); - public float tataFloat(float f); - public byte tataByte(byte b); - - public int[] tataInts(int[] its); - public long[] tataLongs(long[] l); - public double[] tataDoubles(double[] d); - public char[] tataChars(char[] c); - public boolean[] tataBooleans(boolean[] b); - public short[] tataShorts(short[] s); - public float[] tataFloats(float[] f); - public byte[] tataBytes(byte[] b); - - public String tataStr(); - public String[] tataStrs(); - - public void tata(int i, int j); - public void tata(String s); - - public String tata1(String a); - public String tata1(char[] a); - - public String tata5(String a, int i); - public String tata5(String[] a, int i); - public String tata5(String a, int[] i); - - public long add(int i, int j, int k); - - public void toto() throws UnsupportedOperationException; - public void toto(int i, int j) throws UnsupportedOperationException; - public String toto(String a) throws UnsupportedOperationException; - - public void toto1(String j) throws UnsupportedOperationException; - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java deleted file mode 100644 index 037dad355f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/Toto.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface Toto { - - public Properties getProps(); - - public void toto(); - public void toto(int i, int j); - public String toto(String a); - public String toto(String[] a); - - public void toto1(String j); - - public int count(); - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata-providing.xml b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata-providing.xml deleted file mode 100644 index a4cff41a7b..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata-providing.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata.xml b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata.xml deleted file mode 100644 index d70c60b1d4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index bb3b6039a9..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -/** - * Bootstrap the test from this project - */ -@ExamReactorStrategy(PerMethod.class) -public class Common extends BaseTest { - - public static ServiceContext getServiceContext(ComponentInstance ci) { - if (ci instanceof CompositeManager) { - return ((CompositeManager) ci).getServiceContext(); - } else { - throw new RuntimeException("Cannot get the service context from a non composite instance"); - } - } - - @Override - public boolean deployiPOJOComposite() { - return true; - } - - @Override - protected List getExtraExports() { - return Arrays.asList( - "org.apache.felix.ipojo.runtime.core.components" - ); - } -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCompositeAPI.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCompositeAPI.java deleted file mode 100644 index 2bdfea232f..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestCompositeAPI.java +++ /dev/null @@ -1,184 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.runtime.core.services.BazService; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestCompositeAPI extends Common { - - @Test - public void testAPI() { - Factory fact1 = ipojoHelper.getFactory("composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty-1"); - ComponentInstance empty = null; - try { - empty = fact1.createComponentInstance(p); - } catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - ServiceContext sc = getServiceContext(empty); - - Factory fact2 = ipojoHelper.getFactory("composite.test.2"); - Properties props2 = new Properties(); - props2.put("instance.name", "2"); // 2 - Factory fact3 = ipojoHelper.getFactory("composite.test.3"); - Properties props3 = new Properties(); - props3.put("instance.name", "3"); - ComponentInstance comp2 = null; - ComponentInstance comp3 = null; - try { - comp2 = fact2.createComponentInstance(props2, sc); - comp3 = fact3.createComponentInstance(props3, sc); - } catch (Throwable e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - assertTrue("Test comp3", comp3.getState() == ComponentInstance.VALID); - assertTrue("Test comp2", comp2.getState() == ComponentInstance.VALID); - - ServiceReference ref = null; - - ref = ipojoHelper.getServiceReferenceByName(sc, CheckService.class.getName(), "2"); // 2 - - assertNotNull("Check ref", ref); - CheckService cs = (CheckService) sc.getService(ref); - assertTrue("Check invoke", cs.check()); - - comp3.dispose(); - comp2.dispose(); - empty.dispose(); - } - - @Test - public void testInstantiator() { - String type = "composite.instantiator"; - Factory fact = ipojoHelper.getFactory(type); - ComponentInstance ci = null; - Properties p = new Properties(); - p.put("instance.name", "mon_coeur"); - try { - ci = fact.createComponentInstance(p); - } catch (Exception e) { - e.printStackTrace(); - } - - assertTrue("Check ci", ci.getState() == ComponentInstance.VALID); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(BazService.class.getName(), "mon_coeur"); - assertNotNull("Check ref", ref); - BazService bs = (BazService) getContext().getService(ref); - assertTrue("Check invocation", bs.foo()); - getContext().ungetService(ref); - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "mon_coeur"); - assertNotNull("Check ref 2 ", ref); - FooService fs = (FooService) getContext().getService(ref); - assertTrue("Check invocation", fs.foo()); - getContext().ungetService(ref); - ci.dispose(); - } - - @Test - public void testAPI2() { - Factory fact1 = ipojoHelper.getFactory("composite.empty"); - Properties p = new Properties(); - p.put("instance.name", "empty-2"); - ComponentInstance empty = null; - try { - empty = fact1.createComponentInstance(p); - } catch (Exception e) { - e.printStackTrace(); - } - - ServiceContext sc = getServiceContext(empty); - - Factory fact2 = ipojoHelper.getFactory(sc, "composite.test.2"); - Properties props2 = new Properties(); - props2.put("instance.name", "4"); - Factory fact3 = ipojoHelper.getFactory(sc, "composite.test.3"); - Properties props3 = new Properties(); - props3.put("instance.name", "5"); - ComponentInstance comp2 = null; - ComponentInstance comp3 = null; - try { - comp2 = fact2.createComponentInstance(props2, sc); - comp3 = fact3.createComponentInstance(props3, sc); - } catch (Exception e) { - e.printStackTrace(); - } - - assertTrue("Test comp3", comp3.getState() == ComponentInstance.VALID); - assertTrue("Test comp2", comp2.getState() == ComponentInstance.VALID); - - ServiceReference ref = null; - - ref = ipojoHelper.getServiceReferenceByName(sc, CheckService.class.getName(), "4"); - - assertNotNull("Check ref", ref); - CheckService cs = (CheckService) sc.getService(ref); - assertTrue("Check invoke", cs.check()); - - comp3.dispose(); - comp2.dispose(); - empty.dispose(); - } - - @Test - public void testApplication() { - Factory factory = ipojoHelper.getFactory("composite.test.1"); - ComponentInstance ci = null; - Properties props = new Properties(); - props.put("instance.name", "Test"); - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot instantiate Test " + e.getMessage()); - } - - assertTrue("Check ci state", ci.getState() == ComponentInstance.VALID); - - ServiceReference[] refs = null; - try { - refs = getContext().getServiceReferences(CheckService.class.getName(), "(instance.name=Test)"); - } catch (InvalidSyntaxException e) { - fail("Invalid filter : " + e.getMessage()); - } - assertNotNull("Check refs not null", refs); - CheckService cs = (CheckService) getContext().getService(refs[0]); - - assertTrue("Check invocation", cs.check()); - ci.dispose(); - - } - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp0.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp0.java deleted file mode 100644 index c8149dbe4c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp0.java +++ /dev/null @@ -1,343 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.apache.felix.ipojo.runtime.core.services.Toto; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp0 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentFactory tataFactory2; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create an instance : " + e.getMessage()); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - fail("Cannot create an instance : " + e.getMessage()); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-0"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot create an instance : " + e.getMessage()); - } - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertNotNull("Assert toto service - 1", getContext().getServiceReference(Toto.class.getName())); - assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 3", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - Integer tataStr = (Integer) props.get("tataStr"); - Integer tataStrs = (Integer) props.get("tataStrs"); - Integer tata_2 = (Integer) props.get("tata_2"); - Integer tata_3 = (Integer) props.get("tata_3"); - Integer tata1 = (Integer) props.get("tata1"); - Integer tata1_1 = (Integer) props.get("tata1_1"); - Integer tata5 = (Integer) props.get("tata5"); - Integer tata5_1 = (Integer) props.get("tata5_1"); - Integer tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - assertEquals("Assert tataStr - 3", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 3", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 3", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 4", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - assertEquals("Assert tataStr - 4", tataStr.intValue(), 2); - assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2); - assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2); - assertEquals("Assert tata1 - 4", tata1.intValue(), 2); - assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2); - assertEquals("Assert tata5 - 4", tata5.intValue(), 2); - assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2); - assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2); - - getContext().ungetService(ref); - tota = null; - - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 6", toto.intValue(), 3); - assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3); - assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3); - assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - assertEquals("Assert tataStr - 6", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 6", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 6", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - totoProv.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeArrays(Tota tota) { - - int[] a = new int[]{1, 2, 3}; - assertEquals("Assert invoke tataint[]", tota.tataInts(a), a); - - long[] b = new long[]{1, 2, 3}; - assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b); - - double[] c = new double[]{1, 2, 3}; - assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c); - - char[] d = new char[]{'a', 'b', 'c'}; - assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d); - - boolean[] e = new boolean[]{true, false}; - assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e); - - byte[] f = new byte[]{(byte) 1}; - assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f); - - short[] g = new short[]{(short) 1}; - assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g); - - float[] h = new float[]{5, 6, 7}; - assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeTata(Tota tota) { - tota.tata(1, 2); - tota.tata("tototototo"); - } - - private void invokeTata1(Tota tota) { - assertEquals("Assert tata1", tota.tata1("foo"), "foo"); - assertEquals("Assert tata1 - 2", tota.tata1(new char[]{'a', 'b', 'c'}), "abc"); - } - - private void invokeTata5(Tota tota) { - assertEquals("Assert tata5 -1", tota.tata5("foo", 1), "foo" + 1); - assertEquals("Assert tata5 - 2", tota.tata5(new String[]{"a", "b", "c"}, 1), "31"); - assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[]{1, 2, 3}), "foo3"); - } - - private void invokeAdd(Tota tota) { - assertEquals("Assert add", tota.add(1, 1, 1), 3); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - } - - private void invokeAll(Tota tota) { - invoke(tota); - invokeArrays(tota); - invokeStr(tota); - invokeTata(tota); - invokeTata1(tota); - invokeTata5(tota); - invokeAdd(tota); - invokeToto(tota); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp1.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp1.java deleted file mode 100644 index 62af8b7b12..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp1.java +++ /dev/null @@ -1,341 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp1 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - private ComponentFactory tataFactory2; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-1"); - Properties props2 = new Properties(); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - fail("Cannot create the instance : " + e.getMessage()); - } - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 (" + under.getState() + ")", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - Integer tataStr = (Integer) props.get("tataStr"); - Integer tataStrs = (Integer) props.get("tataStrs"); - Integer tata_2 = (Integer) props.get("tata_2"); - Integer tata_3 = (Integer) props.get("tata_3"); - Integer tata1 = (Integer) props.get("tata1"); - Integer tata1_1 = (Integer) props.get("tata1_1"); - Integer tata5 = (Integer) props.get("tata5"); - Integer tata5_1 = (Integer) props.get("tata5_1"); - Integer tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - assertEquals("Assert tataStr - 3", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 3", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 3", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 4", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - assertEquals("Assert tataStr - 4", tataStr.intValue(), 2); - assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2); - assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2); - assertEquals("Assert tata1 - 4", tata1.intValue(), 2); - assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2); - assertEquals("Assert tata5 - 4", tata5.intValue(), 2); - assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2); - assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2); - - getContext().ungetService(ref); - tota = null; - - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 6", toto.intValue(), 3); - assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3); - assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3); - assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - assertEquals("Assert tataStr - 6", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 6", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 6", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), under.getInstanceName())); - - totoProv.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), under.getInstanceName())); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeArrays(Tota tota) { - - int[] a = new int[]{1, 2, 3}; - assertEquals("Assert invoke tataint[]", tota.tataInts(a), a); - - long[] b = new long[]{1, 2, 3}; - assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b); - - double[] c = new double[]{1, 2, 3}; - assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c); - - char[] d = new char[]{'a', 'b', 'c'}; - assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d); - - boolean[] e = new boolean[]{true, false}; - assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e); - - byte[] f = new byte[]{(byte) 1}; - assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f); - - short[] g = new short[]{(short) 1}; - assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g); - - float[] h = new float[]{5, 6, 7}; - assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeTata(Tota tota) { - tota.tata(1, 2); - tota.tata("tototototo"); - } - - private void invokeTata1(Tota tota) { - assertEquals("Assert tata1", tota.tata1("foo"), "foo"); - assertEquals("Assert tata1 - 2", tota.tata1(new char[]{'a', 'b', 'c'}), "abc"); - } - - private void invokeTata5(Tota tota) { - assertEquals("Assert tata5 -1", tota.tata5("foo", 1), "foo" + 1); - assertEquals("Assert tata5 - 2", tota.tata5(new String[]{"a", "b", "c"}, 1), "31"); - assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[]{1, 2, 3}), "foo3"); - } - - private void invokeAdd(Tota tota) { - assertEquals("Assert add", tota.add(1, 1, 1), 3); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - } - - private void invokeAll(Tota tota) { - invoke(tota); - invokeArrays(tota); - invokeStr(tota); - invokeTata(tota); - invokeTata1(tota); - invokeTata5(tota); - invokeAdd(tota); - invokeToto(tota); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp2.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp2.java deleted file mode 100644 index f7e2f64b63..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp2.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp2 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - private ComponentFactory tataFactory2; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-2"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 (" + under.getState() + ")", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - - invokeAll(tota); - - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 4", toto_1.intValue(), 3); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - - getContext().ungetService(ref); - tota = null; - - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 6 (" + toto.intValue() + ")", toto.intValue(), 3); - assertEquals("Assert toto_2 - 6 (" + toto_2.intValue() + ")", toto_2.intValue(), 3); - assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3); - assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 6", toto_1.intValue(), 4); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - totoProv.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - tota.toto1("foo2"); - } - - private void invokeAll(Tota tota) { - invoke(tota); - invokeToto(tota); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp3.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp3.java deleted file mode 100644 index 904d61c69c..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp3.java +++ /dev/null @@ -1,271 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp3 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - private ComponentFactory tataFactory2; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-3"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 (" + under.getState() + ")", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 4", toto_1.intValue(), 2); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - getContext().ungetService(ref); - tota = null; - - // Stop the factory - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - totoProv.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAllOpt(tota); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - tataFactory.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - tota.toto1("foo"); - } - - private void invokeAll(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeToto(tota); - } - - private void invokeAllOpt(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeTotoOpt(tota); - } - - private void invokeTotoOpt(Tota tota) { - try { - tota.toto(); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - assertEquals("Assert toto", tota.toto("foo"), "foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - - try { - tota.toto(1, 2); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - tota.toto1("foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp4.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp4.java deleted file mode 100644 index 9982ae41b4..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp4.java +++ /dev/null @@ -1,270 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp4 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - private ComponentFactory tataFactory2; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-4"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @After - public void tearDown() { - tataFactory2.start(); - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 (" + under.getState() + ")", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 4 (" + toto.intValue() + ")", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 4", toto_1.intValue(), 2); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - getContext().ungetService(ref); - tota = null; - - // Stop the factory - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - totoProv.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAllOpt(tota); - // Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - tataFactory.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - tota.toto1("foo"); - } - - private void invokeAll(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeToto(tota); - } - - private void invokeAllOpt(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeTotoOpt(tota); - } - - private void invokeTotoOpt(Tota tota) { - try { - tota.toto(); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - assertEquals("Assert toto", tota.toto("foo"), "foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - - try { - tota.toto(1, 2); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - tota.toto1("foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp5.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp5.java deleted file mode 100644 index 5714a4116e..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp5.java +++ /dev/null @@ -1,272 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import static org.junit.Assert.*; - -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class TestComp5 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - private ComponentFactory tataFactory2; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name","toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch(Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name","toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch(Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-5"); - Properties props2 = new Properties(); - props2.put("instance.name","ff"); - try { - under = factory.createComponentInstance(props2); - } catch(Exception e) { - e.printStackTrace(); - fail("Cannot create an instance from comp-5 : " + e.getMessage()); - } - - } - - @After - public void tearDown() { - tataFactory2.start(); - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 ("+under.getState()+")", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 3 ("+toto.intValue()+")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 4 ("+toto.intValue()+")", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4 ("+toto_2.intValue()+")", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 4", toto_1.intValue(), 3); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - getContext().ungetService(ref); - tota = null; - - // Stop the factory - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - totoProv.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAllOpt(tota); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "ff")); - - tataFactory.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName( Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte)2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short)5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1,2); - tota.toto1("foo"); - } - - private void invokeAll(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeToto(tota); - } - - private void invokeAllOpt(Tota tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - invokeTotoOpt(tota); - } - - private void invokeTotoOpt(Tota tota) { - try { - tota.toto(); - fail("UnsupportedOperationException expected"); - } catch(UnsupportedOperationException e) { } - - try { - assertEquals("Assert toto", tota.toto("foo"), "foo"); - fail("UnsupportedOperationException expected"); - } catch(UnsupportedOperationException e) { } - - - try { - tota.toto(1,2); - fail("UnsupportedOperationException expected"); - } catch(UnsupportedOperationException e) { } - - try { - tota.toto1("foo"); - fail("UnsupportedOperationException expected"); - } catch(UnsupportedOperationException e) { } - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp6.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp6.java deleted file mode 100644 index a222261deb..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp6.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tata; -import org.apache.felix.ipojo.runtime.core.services.Toto; -import org.junit.After; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp6 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - - tataFactory.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-6"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - @Ignore("known as borekn after service dependency interceptors") - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - ServiceReference refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - ServiceReference refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNull("Assert no toto service - 1", refToto); - assertNull("Assert no tata service - 1", refTata); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2 (" + under.getState() + ")", under.getState() == ComponentInstance.INVALID); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNull("Assert no toto service - 2", refToto); - assertNull("Assert no tata service - 2", refTata); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNotNull("Assert toto service - 3", refToto); - assertNotNull("Assert tata service - 3", refTata); - Toto toto = (Toto) getContext().getService(refToto); - Tata tata = (Tata) getContext().getService(refTata); - - invokeAll(tata); - invokeToto(toto); - - // Check toto - Properties props = toto.getProps(); - Integer toto_0 = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 3 (" + toto_0.intValue() + ")", toto_0.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 3 (" + toto_1.intValue() + ")", toto_1.intValue(), 1); - //Check tata - props = tata.getPropsTata(); - Integer tata_0 = (Integer) props.get("tata"); - assertEquals("Assert tata - 3", tata_0.intValue(), 1); - - getContext().ungetService(refToto); - getContext().ungetService(refTata); - toto = null; - tata = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNotNull("Assert toto service - 4", refToto); - assertNotNull("Assert tata service - 4", refTata); - - toto = (Toto) getContext().getService(refToto); - tata = (Tata) getContext().getService(refTata); - invokeAll(tata); - invokeToto(toto); - - // Check toto - props = toto.getProps(); - toto_0 = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - toto_1 = (Integer) props.get("toto1"); - assertEquals("Assert toto - 4 (" + toto_0.intValue() + ")", toto_0.intValue(), 2); - assertEquals("Assert toto_2 - 4 (" + toto_2.intValue() + ")", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert toto1 - 4", toto_1.intValue(), 3); - //Check tata - props = tata.getPropsTata(); - tata_0 = (Integer) props.get("tata"); - assertEquals("Assert tata - 4", tata_0.intValue(), 2); - getContext().ungetService(refToto); - getContext().ungetService(refTata); - toto = null; - tata = null; - - // Stop the factory - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNull("Assert no toto service - 5", refToto); - assertNull("Assert no tata service - 5", refTata); - - totoProv2.stop(); - totoProv.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNotNull("Assert toto service - 6", refToto); - assertNotNull("Assert tata service - 6", refTata); - toto = (Toto) getContext().getService(refToto); - tata = (Tata) getContext().getService(refTata); - - invokeAll(tata); - invokeTotoOpt(toto); - // Check tata - props = tata.getPropsTata(); - tata_0 = (Integer) props.get("tata"); - assertEquals("Assert tata - 6", tata_0.intValue(), 1); - getContext().ungetService(refToto); - getContext().ungetService(refTata); - toto = null; - tata = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - tataFactory.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - refToto = ipojoHelper.getServiceReferenceByName(Toto.class.getName(), "ff"); - refTata = ipojoHelper.getServiceReferenceByName(Tata.class.getName(), "ff"); - assertNull("Assert no toto service - 7", refToto); - assertNull("Assert no tata service - 7", refTata); - - under.dispose(); - under = null; - } - - private void invoke(Tata tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeStr(Tata tota) { - tota.tataStr(); - } - - private void invokeToto(Toto tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - tota.toto1("foo"); - } - - private void invokeAll(Tata tota) { - invoke(tota); - //invokeArrays(tota); - invokeStr(tota); - //invokeTata(tota); - //invokeTata1(tota); - //invokeTata5(tota); - //invokeAdd(tota); - } - - private void invokeTotoOpt(Toto tota) { - try { - tota.toto(); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - assertEquals("Assert toto", tota.toto("foo"), "foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - - try { - tota.toto(1, 2); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - - try { - tota.toto1("foo"); - fail("UnsupportedOperationException expected"); - } catch (UnsupportedOperationException e) { - } - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp7.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp7.java deleted file mode 100644 index f6389f43aa..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp7.java +++ /dev/null @@ -1,339 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp7 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentFactory tataFactory2; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-7"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - tataFactory.stop(); - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 1); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - Integer tataStr = (Integer) props.get("tataStr"); - Integer tataStrs = (Integer) props.get("tataStrs"); - Integer tata_2 = (Integer) props.get("tata_2"); - Integer tata_3 = (Integer) props.get("tata_3"); - Integer tata1 = (Integer) props.get("tata1"); - Integer tata1_1 = (Integer) props.get("tata1_1"); - Integer tata5 = (Integer) props.get("tata5"); - Integer tata5_1 = (Integer) props.get("tata5_1"); - Integer tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - assertEquals("Assert tataStr - 3", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 3", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 3", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 4", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 2); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - assertEquals("Assert tataStr - 4", tataStr.intValue(), 2); - assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2); - assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2); - assertEquals("Assert tata1 - 4", tata1.intValue(), 2); - assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2); - assertEquals("Assert tata5 - 4", tata5.intValue(), 2); - assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2); - assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2); - - getContext().ungetService(ref); - tota = null; - - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - assertEquals("Assert toto - 6", toto.intValue(), 3); - assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3); - assertEquals("Assert toto_3 - 6", toto_3.intValue(), 3); - assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 6", 1, tata.intValue()); - assertEquals("Assert tataStr - 6", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 6", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 6", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - totoProv.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeArrays(Tota tota) { - - int[] a = new int[]{1, 2, 3}; - assertEquals("Assert invoke tataint[]", tota.tataInts(a), a); - - long[] b = new long[]{1, 2, 3}; - assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b); - - double[] c = new double[]{1, 2, 3}; - assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c); - - char[] d = new char[]{'a', 'b', 'c'}; - assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d); - - boolean[] e = new boolean[]{true, false}; - assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e); - - byte[] f = new byte[]{(byte) 1}; - assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f); - - short[] g = new short[]{(short) 1}; - assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g); - - float[] h = new float[]{5, 6, 7}; - assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeTata(Tota tota) { - tota.tata(1, 2); - tota.tata("tototototo"); - } - - private void invokeTata1(Tota tota) { - assertEquals("Assert tata1", tota.tata1("foo"), "foo"); - assertEquals("Assert tata1 - 2", tota.tata1(new char[]{'a', 'b', 'c'}), "abc"); - } - - private void invokeTata5(Tota tota) { - assertEquals("Assert tata5 -1", tota.tata5("foo", 1), "foo" + 1); - assertEquals("Assert tata5 - 2", tota.tata5(new String[]{"a", "b", "c"}, 1), "31"); - assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[]{1, 2, 3}), "foo3"); - } - - private void invokeAdd(Tota tota) { - assertEquals("Assert add", tota.add(1, 1, 1), 3); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - } - - private void invokeAll(Tota tota) { - invoke(tota); - invokeArrays(tota); - invokeStr(tota); - invokeTata(tota); - invokeTata1(tota); - invokeTata5(tota); - invokeAdd(tota); - invokeToto(tota); - } - - -} diff --git a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp8.java b/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp8.java deleted file mode 100644 index 0f34872429..0000000000 --- a/ipojo/runtime/composite-it/ipojo-composite-service-providing-test/src/test/java/org/apache/felix/ipojo/runtime/core/providing/TestComp8.java +++ /dev/null @@ -1,369 +0,0 @@ -/* - * 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.ipojo.runtime.core.providing; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.Common; -import org.apache.felix.ipojo.runtime.core.components.TotoProvider; -import org.apache.felix.ipojo.runtime.core.components.TotoProviderGlue; -import org.apache.felix.ipojo.runtime.core.services.Tota; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -public class TestComp8 extends Common { - - private ComponentFactory tataFactory; - private ComponentFactory totoFactory; - private ComponentFactory tataFactory2; - private ComponentInstance totoProv, totoProv2; - private ComponentInstance under; - - @Before - public void setUp() { - tataFactory = (ComponentFactory) ipojoHelper.getFactory("tata"); - totoFactory = (ComponentFactory) ipojoHelper.getFactory("toto"); - tataFactory2 = (ComponentFactory) ipojoHelper.getFactory("comp-6"); - tataFactory2.stop(); - - Properties props = new Properties(); - props.put("instance.name", "toto provider"); - try { - totoProv = totoFactory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - } - - Properties props3 = new Properties(); - props3.put("instance.name", "toto provider 2"); - try { - totoProv2 = totoFactory.createComponentInstance(props3); - } catch (Exception e) { - e.printStackTrace(); - } - - totoProv.stop(); - totoProv2.stop(); - - Factory factory = ipojoHelper.getFactory("comp-8"); - Properties props2 = new Properties(); - props2.put("instance.name", "ff"); - try { - under = factory.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - } - tataFactory.stop(); - - } - - @After - public void tearDown() { - tataFactory.start(); - totoProv.dispose(); - totoProv = null; - totoProv2.dispose(); - totoProv2 = null; - tataFactory2.start(); - - // Reset counters - TotoProvider.toto = 0; - TotoProvider.toto_2 = 0; - TotoProvider.toto_3 = 0; - TotoProvider.toto_4 = 0; - TotoProvider.toto1 = 0; - TotoProviderGlue.toto = 0; - TotoProviderGlue.toto_2 = 0; - TotoProviderGlue.toto_3 = 0; - TotoProviderGlue.toto_4 = 0; - TotoProviderGlue.toto1 = 0; - } - - @Test - public void testSimple() { - // Neither factory nor instance - assertTrue("Assert under state - 1", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 1", getContext().getServiceReference(Tota.class.getName())); - - // Start the importer - totoProv.start(); - assertTrue("Assert under state - 2", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 2", getContext().getServiceReference(Tota.class.getName())); - - // Start the factory - tataFactory.start(); - assertTrue("Assert under state - 3", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 3", getContext().getServiceReference(Tota.class.getName())); - ServiceReference ref = getContext().getServiceReference(Tota.class.getName()); - Tota tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - Properties props = tota.getProps(); - Integer toto = (Integer) props.get("toto"); - Integer toto_2 = (Integer) props.get("toto_2"); - Integer toto_3 = (Integer) props.get("toto_3"); - Integer toto_4 = (Integer) props.get("toto_4"); - Integer gtoto = (Integer) props.get("gtoto"); - Integer gtoto_2 = (Integer) props.get("gtoto_2"); - Integer gtoto_3 = (Integer) props.get("gtoto_3"); - Integer gtoto_4 = (Integer) props.get("gtoto_4"); - assertEquals("Assert toto - 3 (" + toto.intValue() + ")", toto.intValue(), 1); - assertEquals("Assert toto_2 - 3", toto_2.intValue(), 1); - assertEquals("Assert toto_3 - 3", toto_3.intValue(), 0); - assertEquals("Assert toto_4 - 3", toto_4.intValue(), 0); - assertEquals("Assert gtoto - 3 (" + gtoto.intValue() + ")", gtoto.intValue(), 1); - assertEquals("Assert gtoto_2 - 3", gtoto_2.intValue(), 1); - assertEquals("Assert gtoto_3 - 3", gtoto_3.intValue(), 1); - assertEquals("Assert gtoto_4 - 3", gtoto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - Integer tata = (Integer) props.get("tata"); - Integer tataStr = (Integer) props.get("tataStr"); - Integer tataStrs = (Integer) props.get("tataStrs"); - Integer tata_2 = (Integer) props.get("tata_2"); - Integer tata_3 = (Integer) props.get("tata_3"); - Integer tata1 = (Integer) props.get("tata1"); - Integer tata1_1 = (Integer) props.get("tata1_1"); - Integer tata5 = (Integer) props.get("tata5"); - Integer tata5_1 = (Integer) props.get("tata5_1"); - Integer tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 3", tata.intValue(), 1); - assertEquals("Assert tataStr - 3", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 3", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 3", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 3", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 3", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 3", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 3", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 3", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 3", tata5_2.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Start a second import - totoProv2.start(); - assertTrue("Assert under state - 4", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 4", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - gtoto = (Integer) props.get("gtoto"); - gtoto_2 = (Integer) props.get("gtoto_2"); - gtoto_3 = (Integer) props.get("gtoto_3"); - gtoto_4 = (Integer) props.get("gtoto_4"); - assertEquals("Assert toto - 4", toto.intValue(), 2); - assertEquals("Assert toto_2 - 4", toto_2.intValue(), 2); - assertEquals("Assert toto_3 - 4", toto_3.intValue(), 0); - assertEquals("Assert toto_4 - 4", toto_4.intValue(), 0); - assertEquals("Assert gtoto - 4 (" + gtoto.intValue() + ")", gtoto.intValue(), 2); - assertEquals("Assert gtoto_2 - 4", gtoto_2.intValue(), 2); - assertEquals("Assert gtoto_3 - 4", gtoto_3.intValue(), 2); - assertEquals("Assert gtoto_4 - 4", gtoto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 4", tata.intValue(), 2); - assertEquals("Assert tataStr - 4", tataStr.intValue(), 2); - assertEquals("Assert tataStrs - 4", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 4", tata_2.intValue(), 2); - assertEquals("Assert tata_3 - 4", tata_3.intValue(), 2); - assertEquals("Assert tata1 - 4", tata1.intValue(), 2); - assertEquals("Assert tata1_1 - 4", tata1_1.intValue(), 2); - assertEquals("Assert tata5 - 4", tata5.intValue(), 2); - assertEquals("Assert tata5_1 - 4", tata5_1.intValue(), 2); - assertEquals("Assert tata5_2 - 4", tata5_2.intValue(), 2); - - getContext().ungetService(ref); - tota = null; - - tataFactory.stop(); - assertTrue("Assert under state - 5", under.getState() == ComponentInstance.INVALID); - assertNull("Assert no tota service - 5", getContext().getServiceReference(Tota.class.getName())); - - totoProv2.stop(); - tataFactory.start(); - assertTrue("Assert under state - 6", under.getState() == ComponentInstance.VALID); - assertNotNull("Assert tota service - 6", getContext().getServiceReference(Tota.class.getName())); - ref = getContext().getServiceReference(Tota.class.getName()); - tota = (Tota) getContext().getService(ref); - invokeAll(tota); - // Check toto - props = tota.getProps(); - toto = (Integer) props.get("toto"); - toto_2 = (Integer) props.get("toto_2"); - toto_3 = (Integer) props.get("toto_3"); - toto_4 = (Integer) props.get("toto_4"); - gtoto = (Integer) props.get("gtoto"); - gtoto_2 = (Integer) props.get("gtoto_2"); - gtoto_3 = (Integer) props.get("gtoto_3"); - gtoto_4 = (Integer) props.get("gtoto_4"); - assertEquals("Assert toto - 6", toto.intValue(), 3); - assertEquals("Assert toto_2 - 6", toto_2.intValue(), 3); - assertEquals("Assert toto_3 - 6", toto_3.intValue(), 0); - assertEquals("Assert toto_4 - 6", toto_4.intValue(), 0); - assertEquals("Assert gtoto - 6 (" + gtoto.intValue() + ")", gtoto.intValue(), 3); - assertEquals("Assert gtoto_2 - 6", gtoto_2.intValue(), 3); - assertEquals("Assert gtoto_3 - 6", gtoto_3.intValue(), 3); - assertEquals("Assert gtoto_4 - 6", gtoto_4.intValue(), 0); - //Check tata - props = tota.getPropsTata(); - tata = (Integer) props.get("tata"); - tataStr = (Integer) props.get("tataStr"); - tataStrs = (Integer) props.get("tataStrs"); - tata_2 = (Integer) props.get("tata_2"); - tata_3 = (Integer) props.get("tata_3"); - tata1 = (Integer) props.get("tata1"); - tata1_1 = (Integer) props.get("tata1_1"); - tata5 = (Integer) props.get("tata5"); - tata5_1 = (Integer) props.get("tata5_1"); - tata5_2 = (Integer) props.get("tata5_2"); - assertEquals("Assert tata - 6", tata.intValue(), 1); - assertEquals("Assert tataStr - 6", tataStr.intValue(), 1); - assertEquals("Assert tataStrs - 6", tataStrs.intValue(), 0); - assertEquals("Assert tata_2 - 6", tata_2.intValue(), 1); - assertEquals("Assert tata_3 - 6", tata_3.intValue(), 1); - assertEquals("Assert tata1 - 6", tata1.intValue(), 1); - assertEquals("Assert tata1_1 - 6", tata1_1.intValue(), 1); - assertEquals("Assert tata5 - 6", tata5.intValue(), 1); - assertEquals("Assert tata5_1 - 6", tata5_1.intValue(), 1); - assertEquals("Assert tata5_2 - 6", tata5_2.intValue(), 1); - getContext().ungetService(ref); - tota = null; - - // Is arch exposed - assertNotNull("Test arch", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - - totoProv.stop(); - - assertTrue("Assert under state - 7", under.getState() == ComponentInstance.INVALID); - assertNotNull("Test arch-2", ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "ff")); - assertNull("Assert no tota service - 7", getContext().getServiceReference(Tota.class.getName())); - - under.dispose(); - under = null; - } - - private void invoke(Tota tota) { - tota.tata(); - - assertEquals("Assert invoke tataint", tota.tataInt(2), 2); - assertEquals("Assert invoke tataLong", tota.tataLong(2), 2); - assertEquals("Assert invoke tataDouble", tota.tataDouble(2), 2, 0); - assertEquals("Assert invoke tataChar", tota.tataChar('a'), 'a'); - assertTrue("Assert invoke tataBoolean", tota.tataBoolean(true)); - assertEquals("Assert invoke tataByte", tota.tataByte((byte) 2), 2); - assertEquals("Assert invoke tataShort", tota.tataShort((short) 5), 5); - assertEquals("Assert invoke tataFloat", tota.tataFloat(5), 5, 0); - - } - - private void invokeArrays(Tota tota) { - - int[] a = new int[]{1, 2, 3}; - assertEquals("Assert invoke tataint[]", tota.tataInts(a), a); - - long[] b = new long[]{1, 2, 3}; - assertEquals("Assert invoke tataLong[]", tota.tataLongs(b), b); - - double[] c = new double[]{1, 2, 3}; - assertEquals("Assert invoke tataDouble[]", tota.tataDoubles(c), c); - - char[] d = new char[]{'a', 'b', 'c'}; - assertEquals("Assert invoke tataChar[]", tota.tataChars(d), d); - - boolean[] e = new boolean[]{true, false}; - assertEquals("Assert invoke tataBoolean[]", tota.tataBooleans(e), e); - - byte[] f = new byte[]{(byte) 1}; - assertEquals("Assert invoke tataByte[]", tota.tataBytes(f), f); - - short[] g = new short[]{(short) 1}; - assertEquals("Assert invoke tataShort[]", tota.tataShorts(g), g); - - float[] h = new float[]{5, 6, 7}; - assertEquals("Assert invoke tataFloat[]", tota.tataFloats(h), h); - - } - - private void invokeStr(Tota tota) { - tota.tataStr(); - } - - private void invokeTata(Tota tota) { - tota.tata(1, 2); - tota.tata("tototototo"); - } - - private void invokeTata1(Tota tota) { - assertEquals("Assert tata1", tota.tata1("foo"), "foo"); - assertEquals("Assert tata1 - 2", tota.tata1(new char[]{'a', 'b', 'c'}), "abc"); - } - - private void invokeTata5(Tota tota) { - assertEquals("Assert tata5 -1", tota.tata5("foo", 1), "foo" + 1); - assertEquals("Assert tata5 - 2", tota.tata5(new String[]{"a", "b", "c"}, 1), "31"); - assertEquals("Assert tata5 - 3", tota.tata5("foo", new int[]{1, 2, 3}), "foo3"); - } - - private void invokeAdd(Tota tota) { - assertEquals("Assert add", tota.add(1, 1, 1), 3); - } - - private void invokeToto(Tota tota) { - tota.toto(); - assertEquals("Assert toto", tota.toto("foo"), "foo"); - tota.toto(1, 2); - } - - private void invokeAll(Tota tota) { - invoke(tota); - invokeArrays(tota); - invokeStr(tota); - invokeTata(tota); - invokeTata1(tota); - invokeTata5(tota); - invokeAdd(tota); - invokeToto(tota); - } - - -} diff --git a/ipojo/runtime/composite-it/pom.xml b/ipojo/runtime/composite-it/pom.xml deleted file mode 100644 index 975eada21f..0000000000 --- a/ipojo/runtime/composite-it/pom.xml +++ /dev/null @@ -1,354 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - org.apache.felix.ipojo.runtime.composite-it - 1.12.2-SNAPSHOT - Apache Felix iPOJO Runtime Project ~ Composite Integration Tests - pom - - - - true - - 3.0.1 - 1.5.1 - - 4.2.0 - 3.8.1.v20120830-144521 - 5.3.3 - - 1.12.1 - - - - ipojo-composite-runtime-test - ipojo-composite-import-export-test - ipojo-composite-instance-test - ipojo-composite-service-providing-test - - - - - - org.apache.maven.plugins - maven-surefire-plugin - 2.14.1 - - - - ${TIME_FACTOR} - - ${skipTestExecution} - - - - - org.apache.maven.plugins - maven-compiler-plugin - 2.5.1 - - 1.6 - 1.6 - - - - - org.apache.servicemix.tooling - depends-maven-plugin - 1.2 - - - generate-config - - generate-depends-file - - - - - - - org.apache.rat - apache-rat-plugin - - - verify - - check - - - - - - - src/** - - - src/main/appended-resources/** - **/*.iml - - - src/it/**/target/**/* - - - - - - maven-deploy-plugin - 2.4 - - true - - - - - - - - - org.ops4j.pax.exam - pax-exam-container-native - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-junit4 - ${exam.version} - test - - - - org.ops4j.pax.exam - pax-exam-link-mvn - ${exam.version} - test - - - - org.ops4j.pax.url - pax-url-aether - ${url.version} - test - - - - ch.qos.logback - logback-core - 1.5.25 - test - - - - ch.qos.logback - logback-classic - 1.3.12 - test - - - - - junit - junit - 4.13.1 - test - - - - org.mockito - mockito-all - 1.9.5 - - - - org.ops4j.pax.tinybundles - tinybundles - 1.0.0 - - - - org.apache.felix - org.apache.felix.ipojo - 1.12.2-SNAPSHOT - provided - - - - org.apache.felix - org.apache.felix.ipojo.composite - 1.12.2-SNAPSHOT - provided - - - - org.apache.felix - org.apache.felix.ipojo.manipulator - ${manipulator.version} - - - - org.apache.felix - org.apache.felix.configadmin - 1.8.0 - test - - - - commons-io - commons-io - 2.14.0 - - - - org.ow2.chameleon.testing - osgi-helpers - 0.6.1 - test - - - org.osgi - org.osgi.core - - - - - - org.ow2.chameleon.testing - tinybundles-ipojo - 0.3.0 - test - - - - org.apache.felix - org.apache.felix.ipojo.handler.eventadmin - - 1.8.0 - - - org.osgi - org.osgi.core - - - - - - org.ops4j.pax.url - pax-url-wrap - 1.5.2 - - - - org.apache.felix - org.apache.felix.framework - ${felix.version} - - - - - - knopflerfish - - false - - pax.exam.framework - knopflerfish - - - - knopflerfish - - - - knopflerfish-releases - http://www.knopflerfish.org/maven2 - - - - - org.knopflerfish - framework - ${knoperflerfish.version} - test - - - - - - equinox - - false - - pax.exam.framework - equinox - - - - equinox - - - - org.eclipse.tycho - org.eclipse.osgi - ${equinox.version} - test - - - - - - felix - - false - - pax.exam.framework - felix - - - - felix - - - - org.apache.felix - org.apache.felix.framework - ${felix.version} - - - - - - test - - false - - - - diff --git a/ipojo/runtime/composite-it/src/main/appended-resources/META-INF/NOTICE b/ipojo/runtime/composite-it/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/ipojo/runtime/composite/changelog.txt b/ipojo/runtime/composite/changelog.txt deleted file mode 100644 index 639323f66b..0000000000 --- a/ipojo/runtime/composite/changelog.txt +++ /dev/null @@ -1,268 +0,0 @@ -Changes from 1.12.0 to 1.12.1 ------------------------------ - -** Bug - * [FELIX-3836] - NPE when calling InstanceDescription.getDescription() - * [FELIX-4565] - Occasional ArrayIndexOutOfBoundException in iPOJO's ProvidedServiceHandler - * [FELIX-4646] - @Context(Context.Source.INSTANCE) does not inject bundle context - * [FELIX-4713] - Error in ProvidedServiceHandler.checkProvidedService : only the first service is checked - * [FELIX-4715] - instance bundle context injection does not works - * [FELIX-4716] - Bundle org.apache.felix.ipojo physically contains OSGi API classes - * [FELIX-4717] - Cannot use the stream API on injected collections - * [FELIX-4728] - InstanceManager concurrency issue - -Changes from 1.11.2 to 1.12.0 ------------------------------ - -** Bug - * [FELIX-4464] - Wrong configuration admin package import / export clause - * [FELIX-4488] - Attempt to create nullable object for non-interface service - -** Improvement - * [FELIX-4482] - Use scope=provided for OSGi APIs dependencies - * [FELIX-4490] - IPOJO allows "instance.name" property to be an empty String - -** New Feature - * [FELIX-4476] - Java 8 Support - -** Sub-task - * [FELIX-4508] - Update to ASM 5.0.2 - * [FELIX-4509] - Change the frame computation strategy - * [FELIX-4510] - Support lambda expression - -Changes from 1.11.1 to 1.11.2 ------------------------------ - -** Bug - * [FELIX-4229] - Provide a way to obtain the component's BundleContext (other than constructor injection) - * [FELIX-4419] - Open access to InstanceDeclaration and TypeDeclaration - * [FELIX-4432] - DefaultServiceRankingInterceptor holds duplicate dependencies - * [FELIX-4448] - Invalid dynamism management when an interceptor implements both Tracking and Ranking interceptors - * [FELIX-4449] - The ConfigurationListener list contains duplicates and fires update on unchanged configurations - -** Improvement - * [FELIX-3931] - Provide a handler to inject the bundle context - * [FELIX-4160] - Create an Maven Parent POM for iPOJO - -Changes from 1.11.0 to 1.11.1 ------------------------------ - -** Bug - * [FELIX-4335] - PropertyDescription does not allow retrieving the current value of the represented property - * [FELIX-4374] - iPOJO: ConcurrentModificationException in ProvidedService - * [FELIX-4386] - Deadlock while creating composite instances programmatically - -** Improvement - * [FELIX-4292] - @Component 'propagation' attribute has wrong default value - -Changes from 1.10.1 to 1.11.0 ------------------------------ - -** Bug - * [FELIX-4115] - NPE in DependencyModel.getService() when @Bind method throws an exception - * [FELIX-4132] - @Modified not working on Equinox - * [FELIX-4138] - TypeDeclaration calls factory.dispose() even if it already has been disposed (externally) - * [FELIX-4139] - package conflict with ipojo-annotations and ipojo-runtime - * [FELIX-4164] - Instance / Component matching regression - * [FELIX-4172] - Updated method called twice at the bundle start - * [FELIX-4183] - Wrong Javadoc of TrackerCustomizer addingService method - * [FELIX-4199] - The filter based service tracking interceptor should always be created - * [FELIX-4200] - Only the last iPOJO Tracking interceptor is modifying the reference - * [FELIX-4204] - Service Dependencies with a callback without a type attribute must be rejected - * [FELIX-4207] - ipojo @Component with propagation set to true doesn't propagate properties - * [FELIX-4218] - NPE with field annotated with both @Property and @ServiceProperty - * [FELIX-4236] - Unvalued properties should be part of the instance's architecture - * [FELIX-4247] - Memory leak with ServiceUsage and inner class (Listener style) - * [FELIX-4248] - ServiceUsage ThreadLocal removal - * [FELIX-4250] - Specification deduction broken when the method does not start with the 'bind' prefix - * [FELIX-4251] - The @Bind annotation should use Class instead of String - * [FELIX-4261] - NPE when an instance is declared without a configuration using the @ConfigurationTracker - * [FELIX-4268] - Duplicated name errors always happen when there are 2 factories with the same name - -** Improvement - * [FELIX-4143] - Improve @Configuration management performances - * [FELIX-4216] - Allow @Property without name in constructors - * [FELIX-4228] - Improve dependency identification in log messages and exceptions - * [FELIX-4232] - Service Dependency Interceptors should be part of the instance architecture - * [FELIX-4252] - Make Extender's ThreadPool size configurable - * [FELIX-4262] - QueueServices should be observable - * [FELIX-4263] - iPOJO Core should use ranged imports - * [FELIX-4264] - JobInfo should provide a way to identify the kind of task - -** New Feature - * [FELIX-4146] - Add getInstances and getInstanceNames in the Factory interface - * [FELIX-4147] - Add getProvidedService in ProvidedServiceDescription and allow external service management - * [FELIX-4215] - Extend manipulation metadata with argument names - * [FELIX-4231] - Provide service binding interceptors - * [FELIX-4265] - Provides a recorder for startup events - * [FELIX-4267] - Define Apache Karaf features for iPOJO - -** Task - * [FELIX-3925] - Merge the temporal dependency handler within the service dependency handler - * [FELIX-4133] - Add distribution creation in the iPOJO runtime build - * [FELIX-4134] - Move integration-tests to the reactor - * [FELIX-4136] - Document service dependency interceptors - * [FELIX-4151] - Fix mistakes in the javadoc tags - * [FELIX-4156] - Fix versions of maven plugins - * [FELIX-4217] - Ensure compatibility between Aries Blueprint and iPOJO - * [FELIX-4245] - Deadlock in Dependency - * [FELIX-4270] - Bump iPOJO package version to 1.11.0 - -** Sub-task - * [FELIX-4239] - Extend service dependency documentation with the 'exception' attribute. - * [FELIX-4240] - Support the 'exception' attribute in service dependencies - * [FELIX-4242] - Support the 'timeout' attribute in service dependencies - * [FELIX-4243] - Define the dependency configuration matrix and improve error detection - * [FELIX-4244] - Extend the service dependency documentation with the timeout attribute - * [FELIX-4257] - Allow the dependency handler to track the entry and exit of inner class methods - -Changes from 1.10.0 to 1.10.1 ------------------------------ - -** Bug - * [FELIX-4072] - onGet and onSet methods do not provide the reference on the pojo object - * [FELIX-4076] - Useless locking on getRequiredHandler - * [FELIX-4077] - Fix documentation urls in maven projects - * [FELIX-4089] - Extender do not deactivate managed components when stopped - * [FELIX-4096] - NPE when retrieve required and missing handler on a disposed factory - * [FELIX-4105] - Factories not disposed when their bundle is leaving - * [FELIX-4106] - Defensive service registration and update - * [FELIX-4108] - Deadlock in the new extender - * [FELIX-4109] - ComponentTypeDescription.addProperty() ignore immutable parameter - * [FELIX-4113] - Factories not disposed when the extension provider is leaving - * [FELIX-4114] - iPOJO ProvidedServiceDescription does not expose policy & CreationStrategy - * [FELIX-4123] - Deadlock in new extender because of factory lock used in removedService - * [FELIX-4127] - Configuration tracker bug when starting and stopping iPOJO successively - * [FELIX-4129] - Cannot change the optionality of a dependency - -** Improvement - * [FELIX-1430] - Notification mechanism on bind/unbind events - * [FELIX-4073] - PrimitiveHandler.attach(ComponentInstance) is final - * [FELIX-4119] - Allow customization of DependencyHandler created Callbacks - -** New Feature - * [FELIX-4116] - Ability to listen for component service dependencies, providings, configuration properties, ... - * [FELIX-4120] - Allow external entity to interact during the service resolution - * [FELIX-4125] - Provide 'components' and 'component' commands - * [FELIX-4130] - Allow retrieving the component instance from the instance description - * [FELIX-4131] - Explicitly set configuration's location when the configuration is null - -** Task - * [FELIX-4092] - Move 'annotation' module from 'runtime' to 'manipulator' project - * [FELIX-4103] - Skip deployment of it-tests - * [FELIX-4104] - Do not run integration-tests in the default build - * [FELIX-4124] - Move arch-gogo to runtime - -Changes from 1.8.6 to 1.10.0 ----------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3843] - ClassCastException when listing service properties of a non-ComponentFactory Factory service - * [FELIX-3895] - iPOJO instance is not shown (with the "arch" commands) if constructor is failing - * [FELIX-3896] - Null reference are injected with @Bind(optional=false) method on iPOJO components - * [FELIX-3918] - iPOJO Logger cannot be dynamically configured on Equinox and KF - * [FELIX-3919] - iPOJO Proxies strategy cannot be configured dynamically on Equinox and KF - * [FELIX-3920] - Creation Strategy does not work on KF3 - * [FELIX-3974] - Properties cannot be set as immutable using annotations - * [FELIX-3995] - Missing options in Bind annotation - * [FELIX-4041] - Properties starting with . should not be propagated - * [FELIX-4048] - @Requires handler does not fail when no specification can be found - * [FELIX-4053] - Avoid @StaticServiceProperty to be used on classes - * [FELIX-4054] - Use current factory version to generate instance name if required - -** Improvement - * [FELIX-3860] - factories and instances iPOJO gogo commands should show the "public=false" instances/factories - * [FELIX-3932] - Allow dependency filter's to get context-source variables - * [FELIX-4040] - Implement config admin support to handle binding location properly - * [FELIX-4045] - Chain Exceptions when possible - -** New Feature - * [FELIX-4034] - Instance configuration DSL - -** Task - * [FELIX-3892] - Upgrade runtime codebase to Java 5 - * [FELIX-3903] - Migrate tests to pax exam 3 - * [FELIX-3921] - Update pom to latest Felix's parent - * [FELIX-3948] - Define a new extender model - * [FELIX-3978] - Check that we don't use java 6+ API - -** Wish - * [FELIX-3926] - Provide metadata for the Extender namespace - -Changes from the 1.8.4 to 1.8.6 -------------------------------- - -** Bug - * [FELIX-3742] - Implementing class fails to load unless super interface's (interface extended by implemented interface) package is imported. - * [FELIX-3789] - Deadlock due to synchronization on INSTANCE_NAME - * [FELIX-3819] - The export directive of iPOJO is wrong - -Changes from the 1.8.2 to 1.8.4 --------------------------------- - -** Bug - * [FELIX-3451] - "instance.name" attribute not recognized - * [FELIX-3500] - InstanceManager concurrency issue: "A methodID cannot be associated with a method from the POJO class" - * [FELIX-3501] - IPojo FactoryStateListener doesn't get notified while stopping factory - * [FELIX-3545] - Memory leak when unregistering a component used by an aggregate dependency with an unbind callback - * [FELIX-3548] - Concurrent access during startup - * [FELIX-3567] - iPOJO Configuration Handler should not reuse the dictionary object from the configuration admin - * [FELIX-3576] - iPOJO fails when using constructor injection and expecting BundleContext in ctor - * [FELIX-3599] - Problem with 'subservice action="instantiate"' in ipojo composite - * [FELIX-3621] - Two dimensional array as argument to a method in a component - * [FELIX-3672] - Potential Concurrent Modification Exception when a bundle is stopped - -** Improvement - * [FELIX-3560] - Extensions to IPojo's Factory and ComponentInstance documentation for custom handlers - -Changes from the 1.8.0 to 1.8.2 -------------------------------- -** Bug - * [FELIX-3130] - Nested composites throws StackOverflowError on instantiation - * [FELIX-3323] - Ipojo composite throw ClassCastException when configuration is updated thru ConfigAdmin - * [FELIX-3451] - "instance.name" attribute not recognized - -Changes from the 1.6.0 to 1.8.0 -------------------------------- -** Improvement - * [FELIX-2746] - Composite should support instance configuration - -Changes from the 1.4.0 to 1.6.0 -------------------------------- -** Improvement - * [FELIX-1427] - Service injection with Smart Proxies - * [FELIX-1906] - Allow calling a method when service properties of an already injected service are modified - - -Changes from 1.2.0 to 1.4.0 ---------------------------- -** Bug - * [FELIX-994] - ClassCastException while Architecture on a composite with a provided service - -** Improvement - * Update parent pom - - -Changes from 1.0.0 to 1.2.0 ---------------------------- -** Bug - * [FELIX-797] - Composite Architecture contains duplicate instances - * [FELIX-817] - iPOJO Service Exported throw an error when stopping - -Changes from 0.8.1 to 1.0.0 ---------------------------- -** Bug - * [FELIX-622] - iPOJO Composite Service Instance can use factories twice to create service instance - * [FELIX-628] - Architecture service should not publish the instance.name property - * [FELIX-637] - Composite service implementation does not support long argument - -** Improvement - * [FELIX-673] - Provide OBR description to iPOJO bundles - * [FELIX-688] - Better error reporting when an instance creation failed - * [FELIX-689] - Instance 'name' property should become 'instance.name' - * [FELIX-716] - Provide XML schemas for iPOJO descriptors - -Version 0.8.1 -------------- - * Initial release diff --git a/ipojo/runtime/composite/obr.xml b/ipojo/runtime/composite/obr.xml deleted file mode 100644 index a39ed25f1f..0000000000 --- a/ipojo/runtime/composite/obr.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - -

-

-

- - -

-

-

- - -

-

-

- - -

-

-

- - \ No newline at end of file diff --git a/ipojo/runtime/composite/pom.xml b/ipojo/runtime/composite/pom.xml deleted file mode 100644 index 5e96d84313..0000000000 --- a/ipojo/runtime/composite/pom.xml +++ /dev/null @@ -1,189 +0,0 @@ - - - - org.apache.felix - felix-parent - 2.1 - ../../../pom/pom.xml - - 4.0.0 - bundle - Apache Felix iPOJO Composite - org.apache.felix.ipojo.composite - 1.12.2-SNAPSHOT - - - 1.12.1 - - - - iPOJO Composition Model. This is an iPOJO extension to execute service composition. - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html - - - - - org.osgi - org.osgi.core - 4.3.1 - provided - - - org.apache.felix - org.apache.felix.ipojo.manipulator - 1.12.1 - - - org.apache.felix - org.apache.felix.ipojo - 1.12.2-SNAPSHOT - provided - - - - - - org.apache.felix - maven-bundle-plugin - 2.3.7 - true - - - Apache Felix iPOJO Composite - ${project.artifactId} - The Apache Software Foundation - iPOJO Composition Layer - - - http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-gettingstarted/ipojo-composition-tutorial.html - - - org.apache.felix.ipojo, - org.apache.felix.ipojo.architecture, - org.apache.felix.ipojo.context, - org.apache.felix.ipojo.metadata, - org.apache.felix.ipojo.parser, - org.apache.felix.ipojo.util, - org.osgi.framework;version=1.3, - !org.objectweb.asm.tree*, - !org.apache.felix.ipojo.xml.parser, - !org.apache.felix.ipojo.annotations, - * - - - org.apache.felix.ipojo.composite.architecture, - org.apache.felix.ipojo.composite.service*, - org.apache.felix.ipojo.composite.instance, - org.apache.felix.ipojo.composite.util, - - org.objectweb.asm.commons, - org.objectweb.asm.util, - org.objectweb.asm.signature, - org.objectweb.asm, - org.objectweb.asm.tree*, - org.apache.felix.ipojo.manipulation*, - org.apache.felix.ipojo.manipulator* - - - org.apache.felix.ipojo.composite; version="${ipojo.package.version}" - - - composite:org.apache.felix.ipojo.composite.CompositeFactory - - <_donotcopy>(CVS|.svn|.+.bak|~.+|metadata.xml) - - - - - org.apache.felix - maven-ipojo-plugin - 1.10.1 - - - - ipojo-bundle - - - src/main/resources/metadata.xml - true - - - - - - org.codehaus.mojo - rat-maven-plugin - 1.0-alpha-3 - - false - true - true - - doc/**/* - maven-eclipse.xml - .checkstyle - .externalToolBuilders/* - LICENSE.asm - - - - - org.apache.maven.plugins - maven-checkstyle-plugin - 2.10 - - false - warning - http://felix.apache.org/ipojo/dev/checkstyle_ipojo.xml - - - - org.apache.maven.plugins - maven-compiler-plugin - - 1.5 - 1.5 - - - - org.codehaus.mojo - animal-sniffer-maven-plugin - 1.7 - - - org.codehaus.mojo.signature - java15 - 1.0 - - - - - test - - check - - - - - - - diff --git a/ipojo/runtime/composite/src/main/appended-resources/META-INF/DEPENDENCIES b/ipojo/runtime/composite/src/main/appended-resources/META-INF/DEPENDENCIES deleted file mode 100644 index e23daafe1f..0000000000 --- a/ipojo/runtime/composite/src/main/appended-resources/META-INF/DEPENDENCIES +++ /dev/null @@ -1,16 +0,0 @@ -I. Included Third-Party Software - -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - -II. Used Third-Party Software - -This product uses software developed at -The OSGi Alliance (http://www.osgi.org/). -Copyright (c) OSGi Alliance (2000, 2009). -Licensed under the Apache License 2.0. - -III. Overall License Summary -- Apache License 2.0 -- BSD License diff --git a/ipojo/runtime/composite/src/main/appended-resources/META-INF/LICENSE b/ipojo/runtime/composite/src/main/appended-resources/META-INF/LICENSE deleted file mode 100644 index 1a5539d295..0000000000 --- a/ipojo/runtime/composite/src/main/appended-resources/META-INF/LICENSE +++ /dev/null @@ -1,42 +0,0 @@ - - -APACHE FELIX iPOJO Composite: - -The Apache Felix iPOJO Composite includes a number of subcomponents with -separate copyright notices and license terms. Your use of the source -code for the these subcomponents is subject to the terms and -conditions of the following licenses. - - -For the ASM component: - -Copyright (c) 2000-2005 INRIA, France Telecom -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions -are met: - -1. Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright - notice, this list of conditions and the following disclaimer in the - documentation and/or other materials provided with the distribution. - -3. Neither the name of the copyright holders nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF -SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS -INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN -CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) -ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGE. - diff --git a/ipojo/runtime/composite/src/main/appended-resources/META-INF/NOTICE b/ipojo/runtime/composite/src/main/appended-resources/META-INF/NOTICE deleted file mode 100644 index 6f2e68f9d5..0000000000 --- a/ipojo/runtime/composite/src/main/appended-resources/META-INF/NOTICE +++ /dev/null @@ -1,4 +0,0 @@ -This product includes software developed at -Copyright (c) 2000-2005 INRIA, France Telecom -Licensed under BSD License. - diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java deleted file mode 100644 index edf08c149c..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeFactory.java +++ /dev/null @@ -1,180 +0,0 @@ -/* - * 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.ipojo.composite; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.HandlerManager; -import org.apache.felix.ipojo.IPojoContext; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.Logger; -import org.apache.felix.ipojo.util.Tracker; -import org.apache.felix.ipojo.util.TrackerCustomizer; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; - -/** - * The component factory manages component instance objects. This management - * consist in creating and managing component instance build with the component - * factory. This class could export Factory and ManagedServiceFactory services. - * - * @author Felix Project Team - */ -public class CompositeFactory extends ComponentFactory implements TrackerCustomizer { - - /** - * Tracker used to track required handler factories. - */ - protected Tracker m_tracker; - - /** - * Create a composite factory. - * @param context : bundle context - * @param metadata : metadata of the component to create - * @throws ConfigurationException occurs when the element describing the factory is malformed. - */ - public CompositeFactory(BundleContext context, Element metadata) throws ConfigurationException { - super(context, metadata); - } - - /** - * Check if the metadata are well formed. - * @param metadata : metadata - * @throws ConfigurationException occurs when the element describing the factory is malformed. - * @see org.apache.felix.ipojo.ComponentFactory#check(org.apache.felix.ipojo.metadata.Element) - */ - public void check(Element metadata) throws ConfigurationException { - String name = metadata.getAttribute("name"); - if (name == null) { - throw new ConfigurationException("A composite needs a name : " + metadata); - } - } - - public String getClassName() { return null; } - - /** - * Compute required handlers. - * @return the list of required handler. - */ - public List getRequiredHandlerList() { - List list = new ArrayList(); - Element[] elems = m_componentMetadata.getElements(); - for (Element current : elems) { - RequiredHandler req = new RequiredHandler(current.getName(), current.getNameSpace()); - if (!list.contains(req)) { - list.add(req); - } - } - - // Add architecture if architecture != 'false' - String arch = m_componentMetadata.getAttribute("architecture"); - if (arch == null || arch.equalsIgnoreCase("true")) { - RequiredHandler req = new RequiredHandler("architecture", null); - if (! list.contains(req)) { list.add(req); } - } - - return list; - } - - /** - * Stop all the instance managers. - */ - public synchronized void stopping() { - if (m_tracker != null) { - m_tracker.close(); - } - m_tracker = null; - } - - /** - * Start all the instance managers. - */ - public synchronized void starting() { - if (m_requiredHandlers.size() != 0) { - try { - String filter = "(&(" + Constants.OBJECTCLASS + "=" + HandlerFactory.class.getName() + ")" - + "(" + Handler.HANDLER_TYPE_PROPERTY + "=" + CompositeHandler.HANDLER_TYPE + ")" - + "(factory.state=1)" - + ")"; - m_tracker = new Tracker(m_context, m_context.createFilter(filter), this); - m_tracker.open(); - } catch (InvalidSyntaxException e) { - m_logger.log(Logger.ERROR, "A factory filter is not valid: " + e.getMessage()); - stop(); - } - } - } - - /** - * Create an instance from the current factory. - * @param configuration : instance configuration - * @param context : bundle context to inject in the instance manager - * @param handlers : array of handler object to attached on the instance - * @return the created instance - * @throws ConfigurationException either the instance configuration or the instance starting has failed - * @see org.apache.felix.ipojo.ComponentFactory#createInstance(java.util.Dictionary, org.apache.felix.ipojo.IPojoContext, org.apache.felix.ipojo.HandlerManager[]) - */ - public ComponentInstance createInstance(Dictionary configuration, IPojoContext context, HandlerManager[] handlers) throws ConfigurationException { - CompositeManager inst = new CompositeManager(this, context, handlers); - inst.configure(m_componentMetadata, configuration); - inst.start(); - return inst; - } - - /** - * Reconfigure an existing instance. - * @param properties : the new configuration to push. - * @throws UnacceptableConfiguration : occurs if the new configuration is - * not consistent with the component type. - * @throws MissingHandlerException : occurs when an handler is unavailable when creating the instance. - * @see org.apache.felix.ipojo.Factory#reconfigure(java.util.Dictionary) - */ - public synchronized void reconfigure(Dictionary properties) throws UnacceptableConfiguration, MissingHandlerException { - if (properties == null || (properties.get("instance.name") == null && properties.get("name") == null)) { // Support both instance.name and name - throw new UnacceptableConfiguration("The configuration does not contains the \"instance.name\" property"); - } - - String name = (String) properties.get("instance.name"); - if (name == null) { - name = (String) properties.get("name"); - } - - ComponentInstance instance = m_componentInstances.get(name); - if (instance == null) { // The instance does not exists. - return; - } - - instance.reconfigure(properties); // re-configure the component - } - - public String getFactoryName() { - return m_componentMetadata.getAttribute("name"); // Mandatory attribute. - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeHandler.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeHandler.java deleted file mode 100644 index 02ffe75e51..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeHandler.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.composite; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.util.Logger; - - -/** - * Composite Handler Abstract Class. An composite handler need implements these - * method to be notified of lifecycle change... - * - * @author Felix Project Team - */ -public abstract class CompositeHandler extends Handler { - - /** - * Composite Handler type. - */ - public static final String HANDLER_TYPE = "composite"; - - /** - * Reference on the composite manager. - */ - private CompositeManager m_manager; - - /** - * Composite Factory. - */ - private CompositeFactory m_factory; - - /** - * Sets the manager. - * This method must be called only once, and should not be overridden. - * @param instance : the composite manager. - */ - protected void attach(ComponentInstance instance) { - m_manager = (CompositeManager) instance; - } - - public final void setFactory(Factory factory) { - m_factory = (CompositeFactory) factory; - } - - public final Logger getLogger() { - return m_factory.getLogger(); - } - - public final CompositeManager getCompositeManager() { - return m_manager; - } - - /** - * Get a plugged handler of the same container. - * This method must be call only in the start method (or after). - * In the configure method, this method can not return a consistent - * result as all handlers are not plugged. - * @param name : name of the handler to find (class name). - * @return the composite handler object or null if the handler is not found. - */ - public final Handler getHandler(String name) { - return m_manager.getCompositeHandler(name); - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java deleted file mode 100644 index 87793fcaed..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeInstanceDescription.java +++ /dev/null @@ -1,130 +0,0 @@ -/* - * 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.ipojo.composite; - -import java.util.Arrays; -import java.util.List; - -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - - -/** - * Composite Instance Description. - * - * @author Felix Project Team - */ -public class CompositeInstanceDescription extends InstanceDescription { - - /** - * Creates a Primitive Instance Description. - * @param type the component type description - * @param instance the instance description - */ - public CompositeInstanceDescription(ComponentTypeDescription type, CompositeManager instance) { - super(type, instance); - } - - - /** - * Gets the list of contained instance in the described instance. - * This list contains only instances who exposed their architecture. - * @return the list of contained instances. - */ - public InstanceDescription[] getContainedInstances() { - // Get instances description of internal instance - ServiceContext internal = ((CompositeManager) m_instance).getServiceContext(); - try { - ServiceReference[] refs = internal.getServiceReferences(Architecture.class.getName(), null); - if (refs != null) { - InstanceDescription[] desc = new InstanceDescription[refs.length]; - for (int i = 0; i < refs.length; i++) { - Architecture arch = (Architecture) internal.getService(refs[i]); - desc[i] = arch.getInstanceDescription(); - internal.ungetService(refs[i]); - } - return desc; - } - } catch (InvalidSyntaxException e) { - // Cannot happen - } - return new InstanceDescription[0]; - } - - /** - * Gets the list of internally published services. - * @return the list of published services. - */ - public Element getInternalServices() { - Element services = new Element("services", ""); - ServiceContext internal = ((CompositeManager) m_instance) - .getServiceContext(); - try { - ServiceReference[] refs = internal.getServiceReferences((String) null, "(!(objectclass=" + Factory.class - .getName() + "))"); - for (int i = 0; refs != null && i < refs.length; i++) { - Element svc = new Element("service", ""); - String[] keys = refs[i].getPropertyKeys(); - for (int j = 0; j < keys.length; j++) { - Object v = refs[i].getProperty(keys[j]); - if (v instanceof String[]) { - List l = Arrays.asList((String[]) v); - svc.addAttribute(new Attribute(keys[j], l.toString())); - } else { - svc.addAttribute(new Attribute(keys[j], v.toString())); - } - } - services.addElement(svc); - } - - } catch (InvalidSyntaxException e) { - // Cannot happen - } - return services; - } - - /** - * Gets the instance description. - * Overridden to add created objects. - * @return the instance description - */ - public Element getDescription() { - Element elem = super.getDescription(); - elem.addElement(getInternalServices()); - - InstanceDescription[] descs = getContainedInstances(); - if (descs.length > 0) { - Element inst = new Element("ContainedInstances", ""); - for (int i = 0; i < descs.length; i++) { - inst.addElement(descs[i].getDescription()); - } - elem.addElement(inst); - } - - return elem; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java deleted file mode 100644 index 3ed565e204..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeManager.java +++ /dev/null @@ -1,442 +0,0 @@ -/* - * 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.ipojo.composite; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.HandlerManager; -import org.apache.felix.ipojo.IPojoContext; -import org.apache.felix.ipojo.InstanceStateListener; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.Logger; -import org.osgi.framework.BundleContext; - -/** - * iPOJO Composite manager. The composite manager class manages one instance of - * a component type which is a composition. It manages component lifecycle, and - * handlers... - * - * @author Felix Project Team - */ -public class CompositeManager implements ComponentInstance, InstanceStateListener { - - /** - * The context of the component. - */ - private final BundleContext m_context; - - /** - * Parent factory (ComponentFactory). - */ - private final CompositeFactory m_factory; - - /** - * Composite Handler list. - */ - private HandlerManager[] m_handlers; - - /** - * Instance State Listener List. - */ - private List m_listeners = new ArrayList(); - - /** - * Internal service context of the composition. - */ - private CompositeServiceContext m_internalContext; - - /** - * The instance description. - */ - private final CompositeInstanceDescription m_description; - - /** - * Name of the component instance. - */ - private String m_name; - - /** - * Component state (STOPPED at the beginning). - */ - private int m_state = STOPPED; - - /** - * Logger. - */ - private Logger m_logger; - - /** - * Construct a new Component Manager. - * @param factory : the factory managing the instance manager - * @param context : the bundle context to give to the instance - * @param handlers : the handlers to plug - */ - public CompositeManager(CompositeFactory factory, BundleContext context, HandlerManager[] handlers) { - m_factory = factory; - m_context = context; - // Initialize the service context. - m_internalContext = new CompositeServiceContext(m_context, this); - m_handlers = handlers; - m_description = new CompositeInstanceDescription(m_factory.getComponentDescription(), this); - m_logger = new Logger(m_context, this); - - } - - /** - * Plug the given handler to the current container. - * @param handler : the handler to plug. - */ - public synchronized void addCompositeHandler(HandlerManager handler) { - if (m_handlers.length > 0) { - HandlerManager[] newInstances = new HandlerManager[m_handlers.length + 1]; - System.arraycopy(m_handlers, 0, newInstances, 0, m_handlers.length); - newInstances[m_handlers.length] = handler; - m_handlers = newInstances; - } else { - m_handlers = new HandlerManager[] { handler }; - } - } - - /** - * Add an instance to the created instance list. - * @param listener : the instance state listener to add. - * @see org.apache.felix.ipojo.ComponentInstance#addInstanceStateListener(org.apache.felix.ipojo.InstanceStateListener) - */ - public void addInstanceStateListener(InstanceStateListener listener) { - synchronized (m_listeners) { - m_listeners.add(listener); - } - } - - /** - * Configure the instance manager. Stop the existing handler, clear the - * handler list, change the metadata, recreate the handler - * - * @param metadata : the component type metadata - * @param configuration : the configuration of the instance - * @throws ConfigurationException : occurs when the component type are incorrect. - */ - public void configure(Element metadata, Dictionary configuration) throws ConfigurationException { - // Add the name - m_name = (String) configuration.get("instance.name"); - - // Create the standard handlers and add these handlers to the list - for (int i = 0; i < m_handlers.length; i++) { - m_handlers[i].init(this, metadata, configuration); - } - } - - /** - * Dispose the instance. - * @see org.apache.felix.ipojo.ComponentInstance#dispose() - */ - public void dispose() { - if (m_state > STOPPED) { stop(); } - - for (int i = 0; i < m_listeners.size(); i++) { - ((InstanceStateListener) m_listeners.get(i)).stateChanged(this, DISPOSED); - } - - m_factory.disposed(this); - - // Cleaning - m_state = DISPOSED; - for (int i = m_handlers.length - 1; i > -1; i--) { - m_handlers[i].dispose(); - } - m_handlers = new HandlerManager[0]; - m_listeners.clear(); - } - - /** - * Return a specified handler. - * @param name : class name of the handler to find - * @return : the handler, or null if not found - */ - public CompositeHandler getCompositeHandler(String name) { - for (int i = 0; i < m_handlers.length; i++) { - HandlerFactory fact = (HandlerFactory) m_handlers[i].getFactory(); - if (fact.getHandlerName().equals(name) || name.equals(fact.getComponentDescription().getClassName())) { - return (CompositeHandler) m_handlers[i].getHandler(); - } - } - return null; - } - - /** - * Get the bundle context used by this instance. - * @return the parent context of the instance. - * @see org.apache.felix.ipojo.ComponentInstance#getContext() - */ - public BundleContext getContext() { - return m_context; - } - - /** - * Get the factory which create this instance. - * @return the factory of the component - * @see org.apache.felix.ipojo.ComponentInstance#getFactory() - */ - public ComponentFactory getFactory() { - return m_factory; - } - - /** - * Get the global bundle context. - * @return the global bundle context. - */ - public BundleContext getGlobalContext() { - IPojoContext context = (IPojoContext) m_context; - return context.getGlobalContext(); - } - - /** - * Return the instance description of this instance. - * @return the instance description. - * @see org.apache.felix.ipojo.ComponentInstance#getInstanceDescription() - */ - public InstanceDescription getInstanceDescription() { - return m_description; - } - - /** - * Get the instance name. - * @return the instance name - * @see org.apache.felix.ipojo.ComponentInstance#getInstanceName() - */ - public String getInstanceName() { - return m_name; - } - - /** - * Get the parent service context. - * @return the parent service context. - */ - public ServiceContext getParentServiceContext() { - IPojoContext context = (IPojoContext) m_context; - return context.getServiceContext(); - } - - /** - * REturn the list of handlers plugged on this instance. - * @return the list of the registered handlers. - */ - public CompositeHandler[] getRegistredCompositeHandlers() { - CompositeHandler[] handler = new CompositeHandler[m_handlers.length]; - for (int i = 0; i < m_handlers.length; i++) { - handler[i] = (CompositeHandler) m_handlers[i].getHandler(); - } - return handler; - } - - /** - * Get the internal service context of this instance. - * @return the internal service context. - */ - public ServiceContext getServiceContext() { - return m_internalContext; - } - - /** - * Get the actual state of the instance. - * @return the actual state of the instance - * @see org.apache.felix.ipojo.ComponentInstance#getState() - */ - public int getState() { - return m_state; - } - - /** - * Check if the instance is started. - * @return true if the instance is started. - * @see org.apache.felix.ipojo.ComponentInstance#isStarted() - */ - public boolean isStarted() { - return m_state > STOPPED; - } - - /** - * Reconfigure the current instance. - * @param configuration : the new instance configuration. - * @see org.apache.felix.ipojo.ComponentInstance#reconfigure(java.util.Dictionary) - */ - public void reconfigure(Dictionary configuration) { - m_logger.log(Logger.INFO, "Reconfiguring composite with " + configuration); - for (int i = 0; i < m_handlers.length; i++) { - m_logger.log(Logger.INFO, "Delegating reconfiguration to " + m_handlers[i].getClassName()); - m_handlers[i].getHandler().reconfigure(configuration); - } - } - - /** - * Remove an instance state listener. - * @param listener : the listener to remove - * @see org.apache.felix.ipojo.ComponentInstance#removeInstanceStateListener(org.apache.felix.ipojo.InstanceStateListener) - */ - public void removeInstanceStateListener(InstanceStateListener listener) { - synchronized (m_listeners) { - m_listeners.remove(listener); - } - } - - /** - * Set the state of the component. - * if the state changed call the stateChanged(int) method on the handlers. - * @param state : new state - */ - public void setState(int state) { - if (m_state != state) { - if (state > m_state) { - // The state increases (Stopped = > IV, IV => V) => invoke handlers from the higher priority to the lower - m_state = state; - for (int i = 0; i < m_handlers.length; i++) { - m_handlers[i].getHandler().stateChanged(state); - } - } else { - // The state decreases (V => IV, IV = > Stopped, Stopped => Disposed) - m_state = state; - for (int i = m_handlers.length - 1; i > -1; i--) { - m_handlers[i].getHandler().stateChanged(state); - } - } - - for (int i = 0; i < m_listeners.size(); i++) { - ((InstanceStateListener) m_listeners.get(i)).stateChanged(this, state); - } - } - } - - /** - * Start the instance manager. - */ - public synchronized void start() { - if (m_state > STOPPED) { - return; - } // Instance already started - - - // The new state of the component is UNRESOLVED - m_state = INVALID; - - m_internalContext.start(); // Turn on the factory tracking - - // Plug handler descriptions - Handler[] handlers = getRegistredCompositeHandlers(); - for (int i = 0; i < handlers.length; i++) { - m_description.addHandler(handlers[i].getDescription()); - } - - for (int i = 0; i < m_handlers.length; i++) { - m_handlers[i].start(); - m_handlers[i].addInstanceStateListener(this); - } - - for (int i = 0; i < m_handlers.length; i++) { - if (m_handlers[i].getState() != VALID) { - setState(INVALID); - return; - } - } - setState(VALID); - - } - - /** - * State Change listener callback. - * This method is notified at each time a plugged handler becomes invalid. - * @param instance : changing instance - * @param newState : new state - * @see org.apache.felix.ipojo.InstanceStateListener#stateChanged(org.apache.felix.ipojo.ComponentInstance, int) - */ - public synchronized void stateChanged(ComponentInstance instance, int newState) { - if (m_state <= STOPPED) { return; } - - // Update the component state if necessary - if (newState == INVALID && m_state == VALID) { - // Need to update the state to UNRESOLVED - setState(INVALID); - return; - } - if (newState == VALID && m_state == INVALID) { - // An handler becomes valid => check if all handlers are valid - boolean isValid = true; - for (int i = 0; i < m_handlers.length; i++) { - isValid = isValid && m_handlers[i].getState() == VALID; - } - - if (isValid) { setState(VALID); } - } - if (newState == DISPOSED) { - kill(); - } - } - - /** - * Stop the instance manager. - */ - public synchronized void stop() { - if (m_state <= STOPPED) { - return; - } // Instance already stopped - - setState(INVALID); - // Stop all the handlers - for (int i = m_handlers.length - 1; i > -1; i--) { - m_handlers[i].removeInstanceStateListener(this); - m_handlers[i].stop(); - } - - m_internalContext.stop(); // Turn off the factory tracking - m_state = STOPPED; - - for (int i = 0; i < m_listeners.size(); i++) { - ((InstanceStateListener) m_listeners.get(i)).stateChanged(this, STOPPED); - } - } - - /** - * Kill the current instance. - * Only the factory of this instance can call this method. - */ - protected synchronized void kill() { - if (m_state > STOPPED) { stop(); } - - for (int i = 0; i < m_listeners.size(); i++) { - ((InstanceStateListener) m_listeners.get(i)).stateChanged(this, DISPOSED); - } - - // Cleaning - m_state = DISPOSED; - - for (int i = m_handlers.length - 1; i > -1; i--) { - m_handlers[i].dispose(); - } - m_handlers = new HandlerManager[0]; - m_listeners.clear(); - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java deleted file mode 100644 index f514c27317..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/CompositeServiceContext.java +++ /dev/null @@ -1,506 +0,0 @@ -/* - * 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.ipojo.composite; - -import java.io.File; -import java.io.InputStream; -import java.util.*; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.IPojoContext; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.context.ServiceReferenceImpl; -import org.apache.felix.ipojo.context.ServiceRegistry; -import org.apache.felix.ipojo.dependency.interceptors.TransformedServiceReference; -import org.apache.felix.ipojo.util.Tracker; -import org.apache.felix.ipojo.util.TrackerCustomizer; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.BundleException; -import org.osgi.framework.BundleListener; -import org.osgi.framework.Filter; -import org.osgi.framework.FrameworkListener; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceListener; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; - -/** - * CompositeServiceContext Class. This class provides an implementation of the - * service context for composite. - * - * @author Felix Project Team - */ -public class CompositeServiceContext implements ServiceContext, TrackerCustomizer { - - /** - * Structure storing the reference, the factory and the registration. - */ - private class Record { - /** - * Reference of the represented factory from the external context. - */ - private ServiceReference m_ref; - /** - * Registration of the factory in the internal context. - */ - private ServiceRegistration m_reg; - /** - * Represented Factory. - */ - private FactoryProxy m_fact; - } - - /** - * List of imported factories. - */ - private List m_factories = new ArrayList(); - /** - * Internal service registry. - */ - private ServiceRegistry m_registry; - - /** - * Component Instance who creates this registry. - */ - private ComponentInstance m_instance; - - /** - * Global service context. - */ - private BundleContext m_global; - - /** - * Tracker tracking Factories to import. - */ - private Tracker m_tracker; - - /** - * Constructor. This constructor instantiate a service registry with the - * given bundle context. - * - * @param context : the bundle context - */ - public CompositeServiceContext(BundleContext context) { - m_registry = new ServiceRegistry(context); - if (context instanceof IPojoContext) { - m_global = ((IPojoContext) context).getGlobalContext(); - } else { - m_global = context; // the parent context is the global context - } - } - - /** - * Constructor. - * - * @param context : the bundle context - * @param instance : the component instance owning this context - */ - public CompositeServiceContext(BundleContext context, ComponentInstance instance) { - this(context); - m_instance = instance; - } - - /** - * Add a service listener. - * @param arg0 : The service listener to add - * @see org.apache.felix.ipojo.ServiceContext#addServiceListener(org.osgi.framework.ServiceListener) - */ - public void addServiceListener(ServiceListener arg0) { - m_registry.addServiceListener(arg0); - } - - /** - * Add a filtered service listener. - * @param arg0 : the service listener object to add - * @param arg1 : the LDAP filter for this listener - * @throws InvalidSyntaxException : occurs if the LDAP filter is malformed - * @see org.apache.felix.ipojo.ServiceContext#addServiceListener(org.osgi.framework.ServiceListener, - * java.lang.String) - */ - public void addServiceListener(ServiceListener arg0, String arg1) throws InvalidSyntaxException { - m_registry.addServiceListener(arg0, arg1); - } - - /** - * Get all service references. - * @param arg0 : The required service interface. - * @param arg1 : LDAP filter - * @return the list of all service reference matching with the query - * @throws InvalidSyntaxException : occurs when the given filter is malformed - * @see org.apache.felix.ipojo.ServiceContext#getAllServiceReferences(java.lang.String, - * java.lang.String) - */ - public ServiceReference[] getAllServiceReferences(String arg0, String arg1) throws InvalidSyntaxException { - return m_registry.getAllServiceReferences(arg0, arg1); - } - - /** - * Get a service object for the given service reference. - * @param arg0 : the service reference - * @return the service object or null if the reference is no more valid or if the object is not accessible - * @see org.apache.felix.ipojo.ServiceContext#getService(org.osgi.framework.ServiceReference) - */ - public Object getService(ServiceReference arg0) { - ServiceReference ref; - if (arg0 instanceof TransformedServiceReference) { - ref = ((TransformedServiceReference) arg0).getWrappedReference(); - } else { - ref = arg0; - } - - if (ref instanceof ServiceReferenceImpl) { - return m_registry.getService(m_instance, ref); - } else { - throw new RuntimeException("Cannot get a global service from the local registry"); - } - } - - - /** - * Get a service reference for the required interface. - * @param arg0 : the required interface name - * @return the service reference or null if no available provider - * @see org.apache.felix.ipojo.ServiceContext#getServiceReference(java.lang.String) - */ - public ServiceReference getServiceReference(String arg0) { - return m_registry.getServiceReference(arg0); - } - - public ServiceReference getServiceReference(Class clazz) { - //noinspection unchecked - return getServiceReference(clazz.getName()); - } - - @SuppressWarnings("unchecked") - public Collection> getServiceReferences(Class clazz, String filter) throws InvalidSyntaxException { - ServiceReference[] refs = getServiceReferences(clazz.getName(), filter); - return Arrays.asList(refs); - } - - /** - * Get all accessible service reference for the given query. - * @param clazz : required interface - * @param filter : LDAP filter - * @return the list (array) of service reference matching with the query. - * @throws InvalidSyntaxException : occurs when the LDAP filter is malformed - * @see org.apache.felix.ipojo.ServiceContext#getServiceReferences(java.lang.String, java.lang.String) - */ - public ServiceReference[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException { - return m_registry.getServiceReferences(clazz, filter); - } - - - /** - * Register a service inside the composite context. - * @param arg0 : list of interfaces to register. - * @param arg1 : service object - * @param arg2 : properties list - * @return the service registration - * @see org.apache.felix.ipojo.ServiceContext#registerService(java.lang.String[], java.lang.Object, java.util.Dictionary) - */ - public ServiceRegistration registerService(String[] arg0, Object arg1, Dictionary arg2) { - return m_registry.registerService(m_instance, arg0, arg1, arg2); - } - - /** - * Register a service inside the composite context. - * @param arg0 : interface to register. - * @param arg1 : service object - * @param arg2 : properties list - * @return the service registration - * @see org.apache.felix.ipojo.ServiceContext#registerService(java.lang.String, java.lang.Object, java.util.Dictionary) - */ - public ServiceRegistration registerService(String arg0, Object arg1, Dictionary arg2) { - return m_registry.registerService(m_instance, arg0, arg1, arg2); - } - - /** - * Remove a service listener. - * @param arg0 : the service listener to remove - * @see org.apache.felix.ipojo.ServiceContext#removeServiceListener(org.osgi.framework.ServiceListener) - */ - public void removeServiceListener(ServiceListener arg0) { - m_registry.removeServiceListener(arg0); - } - - /** - * Unget a service. - * @param arg0 the service reference to unget - * @return true - * @see org.apache.felix.ipojo.ServiceContext#ungetService(org.osgi.framework.ServiceReference) - */ - public boolean ungetService(ServiceReference arg0) { - return m_registry.ungetService(m_instance, arg0); - } - - /** - * Import a factory form the parent to the internal registry. - * - * @param ref : the reference of the factory to import. - */ - private void importFactory(ServiceReference ref) { - Record rec = new Record(); - m_factories.add(rec); - Dictionary dict = new Hashtable(); - for (int j = 0; j < ref.getPropertyKeys().length; j++) { - dict.put(ref.getPropertyKeys()[j], ref.getProperty(ref.getPropertyKeys()[j])); - } - rec.m_fact = new FactoryProxy((Factory) m_tracker.getService(ref), this); - rec.m_reg = registerService(Factory.class.getName(), rec.m_fact, dict); - rec.m_ref = ref; - } - - /** - * Remove a factory of the available factory list. - * - * @param ref : the reference on the factory to remove. - */ - private void removeFactory(ServiceReference ref) { - for (int i = 0; i < m_factories.size(); i++) { - Record rec = m_factories.get(i); - if (rec.m_ref == ref) { - if (rec.m_reg != null) { - rec.m_reg.unregister(); - rec.m_fact = null; - } - m_tracker.ungetService(rec.m_ref); - m_factories.remove(rec); - return; - } - } - } - - /** - * Start the registry management. - */ - public void start() { - m_tracker = new Tracker(m_global, Factory.class.getName(), this); - m_tracker.open(); - } - - /** - * Stop the registry management. - */ - public synchronized void stop() { - m_tracker.close(); - m_registry.reset(); - List records = new ArrayList(m_factories); - for (Record rec : records) { - removeFactory(rec.m_ref); - } - m_tracker = null; - } - - /** - * Check if the factory list contain the given reference. - * - * @param ref : the reference to find. - * @return true if the list contains the given reference. - */ - private boolean containsRef(ServiceReference ref) { - for (Record rec : m_factories) { - if (rec.m_ref == ref) { - return true; - } - } - return false; - } - - /** - * Add a bundle listener. - * Delegate on the global bundle context. - * @param arg0 : bundle listener to add - * @see org.osgi.framework.BundleContext#addBundleListener(org.osgi.framework.BundleListener) - */ - public void addBundleListener(BundleListener arg0) { - m_global.addBundleListener(arg0); - } - - /** - * Add a framework listener. - * Delegate on the global bundle context. - * @param arg0 : framework listener to add. - * @see org.osgi.framework.BundleContext#addFrameworkListener(org.osgi.framework.FrameworkListener) - */ - public void addFrameworkListener(FrameworkListener arg0) { - m_global.addFrameworkListener(arg0); - } - - /** - * Create a LDAP filter. - * @param arg0 : String-form of the filter - * @return the created filter object - * @throws InvalidSyntaxException : if the given argument is not a valid against the LDAP grammar. - * @see org.osgi.framework.BundleContext#createFilter(java.lang.String) - */ - public Filter createFilter(String arg0) throws InvalidSyntaxException { - return m_global.createFilter(arg0); - } - - public Bundle getBundle(String location) { - return m_global.getBundle(location); - } - - /** - * Get the current bundle. - * @return the current bundle - * @see org.osgi.framework.BundleContext#getBundle() - */ - public Bundle getBundle() { - return m_global.getBundle(); - } - - /** - * Get the bundle object with the given id. - * @param bundleId : bundle id - * @return the bundle object - * @see org.osgi.framework.BundleContext#getBundle(long) - */ - public Bundle getBundle(long bundleId) { - return m_global.getBundle(bundleId); - } - - /** - * Get installed bundles. - * @return the list of installed bundles - * @see org.osgi.framework.BundleContext#getBundles() - */ - public Bundle[] getBundles() { - return m_global.getBundles(); - } - - - /** - * Get a data file. - * @param filename : File name. - * @return the File object - * @see org.osgi.framework.BundleContext#getDataFile(java.lang.String) - */ - public File getDataFile(String filename) { - return m_global.getDataFile(filename); - } - - /** - * Get a property value. - * @param key : key of the asked property - * @return the property value (object) or null if no property are associated with the given key - * @see org.osgi.framework.BundleContext#getProperty(java.lang.String) - */ - public String getProperty(String key) { - return m_global.getProperty(key); - } - - /** - * Install a bundle. - * @param location : URL of the bundle to install - * @return the installed bundle - * @throws BundleException : if the bundle cannot be installed correctly - * @see org.osgi.framework.BundleContext#installBundle(java.lang.String) - */ - public Bundle installBundle(String location) throws BundleException { - return m_global.installBundle(location); - } - - /** - * Install a bundle. - * @param location : URL of the bundle to install - * @param input : - * @return the installed bundle - * @throws BundleException : if the bundle cannot be installed correctly - * @see org.osgi.framework.BundleContext#installBundle(java.lang.String, java.io.InputStream) - */ - public Bundle installBundle(String location, InputStream input) throws BundleException { - return m_global.installBundle(location, input); - } - - /** - * Remove a bundle listener. - * @param listener : the listener to remove - * @see org.osgi.framework.BundleContext#removeBundleListener(org.osgi.framework.BundleListener) - */ - public void removeBundleListener(BundleListener listener) { - m_global.removeBundleListener(listener); - } - - /** - * Remove a framework listener. - * @param listener : the listener to remove - * @see org.osgi.framework.BundleContext#removeFrameworkListener(org.osgi.framework.FrameworkListener) - */ - public void removeFrameworkListener(FrameworkListener listener) { - m_global.removeFrameworkListener(listener); - } - - public ServiceRegistration registerService(Class clazz, S service, Dictionary properties) { - return registerService(clazz.getName(), service, properties); - } - - /** - * A new factory is detected. - * @param reference : service reference - * @return true if not already imported. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference) - */ - public boolean addingService(ServiceReference reference) { - return !containsRef(reference); - } - - /** - * A matching reference has been added. The import factory can now be imported. - * @param reference : the added reference. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference) - */ - public void addedService(ServiceReference reference) { - importFactory(reference); - } - - /** - * An imported factory is modified. - * @param reference : modified reference - * @param service : factory object. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void modifiedService(ServiceReference reference, Object service) { - for (Record rec : m_factories) { - if (rec.m_ref == reference) { - Dictionary dict = new Hashtable(); - for (int j = 0; j < reference.getPropertyKeys().length; j++) { - dict.put(reference.getPropertyKeys()[j], reference.getProperty(reference.getPropertyKeys()[j])); - } - rec.m_reg.setProperties(dict); - return; - } - } - } - - /** - * An imported factory disappears. - * @param reference : reference - * @param service : factory object. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void removedService(ServiceReference reference, Object service) { - if (containsRef(reference)) { - removeFactory(reference); - } - - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java deleted file mode 100644 index f219810ab3..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/FactoryProxy.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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.ipojo.composite; - -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.FactoryStateListener; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.BundleContext; - -/** - * Bridge representing a Factory inside a composition. - * @author Felix Project Team - */ -public class FactoryProxy implements Factory { - - /** - * Delegated factory. - */ - private Factory m_delegate; - - /** - * Destination context. - */ - private ServiceContext m_context; - - /** - * Constructor. - * @param fact : the targeted factory. - * @param svcContext : the service context to target. - */ - public FactoryProxy(Factory fact, ServiceContext svcContext) { - m_delegate = fact; - m_context = svcContext; - } - - /** - * Create an instance manager (i.e. component type instance). - * @param configuration : the configuration properties for this component. - * @return the created instance manager. - * @throws UnacceptableConfiguration : when a given configuration is not valid. - * @throws MissingHandlerException : occurs when the creation failed due to a missing handler (the factory should be invalid) - * @throws ConfigurationException : occurs when the creation failed due to a configuration issue - * @see org.apache.felix.ipojo.Factory#createComponentInstance(java.util.Dictionary) - */ - public ComponentInstance createComponentInstance(Dictionary configuration) throws UnacceptableConfiguration, MissingHandlerException, - ConfigurationException { - return m_delegate.createComponentInstance(configuration, m_context); - } - - /** - * Create an instance manager (i.e. component type instance). This has these service interaction in the scope given in argument. - * @param configuration : the configuration properties for this component. - * @param serviceContext : the service context of the component. - * @return the created instance manager. - * @throws UnacceptableConfiguration : when the given configuration is not valid. - * @throws MissingHandlerException : when at least one handler is missing. - * @throws ConfigurationException : when an issue occurs during the oconfiguration of the instance. - * @see org.apache.felix.ipojo.Factory#createComponentInstance(java.util.Dictionary, org.apache.felix.ipojo.ServiceContext) - */ - public ComponentInstance createComponentInstance(Dictionary configuration, ServiceContext serviceContext) throws UnacceptableConfiguration, - MissingHandlerException, ConfigurationException { - return m_delegate.createComponentInstance(configuration, serviceContext); - } - - /** - * Get the component type information containing provided service, configuration properties ... - * @return the component type information. - * @see org.apache.felix.ipojo.Factory#getDescription() - */ - public Element getDescription() { - return m_delegate.getDescription(); - } - - /** - * Return the factory name. - * @return the name of the factory. - * @see org.apache.felix.ipojo.Factory#getName() - */ - public String getName() { - return m_delegate.getName(); - } - - /** - * Check if the given configuration is acceptable as a configuration of a component instance. - * @param conf : the configuration to test - * @return true if the configuration is acceptable - * @see org.apache.felix.ipojo.Factory#isAcceptable(java.util.Dictionary) - */ - public boolean isAcceptable(Dictionary conf) { - return m_delegate.isAcceptable(conf); - } - - /** - * Reconfigure an instance already created. This configuration need to have the name property to identify the instance. - * @param conf : the configuration to reconfigure the instance. - * @throws UnacceptableConfiguration : if the given configuration is not consistent for the targeted instance. - * @throws MissingHandlerException : when at least one handler is missing - * @see org.apache.felix.ipojo.Factory#reconfigure(java.util.Dictionary) - */ - public void reconfigure(Dictionary conf) throws UnacceptableConfiguration, MissingHandlerException { - m_delegate.reconfigure(conf); - } - - /** - * Add a factory listener. - * @param listener : the listener to add. - * @see org.apache.felix.ipojo.Factory#addFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener) - */ - public void addFactoryStateListener(FactoryStateListener listener) { - m_delegate.addFactoryStateListener(listener); - - } - - public List getMissingHandlers() { - return m_delegate.getMissingHandlers(); - } - - public List getRequiredHandlers() { - return m_delegate.getRequiredHandlers(); - } - - /** - * Remove a service listener. - * @param listener : the listener to remove - * @see org.apache.felix.ipojo.Factory#removeFactoryStateListener(org.apache.felix.ipojo.FactoryStateListener) - */ - public void removeFactoryStateListener(FactoryStateListener listener) { - m_delegate.removeFactoryStateListener(listener); - - } - - public ComponentTypeDescription getComponentDescription() { - return m_delegate.getComponentDescription(); - } - - public String getClassName() { - return m_delegate.getClassName(); - } - - public int getState() { - return m_delegate.getState(); - } - - public BundleContext getBundleContext() { - return m_delegate.getBundleContext(); - } - - public String getVersion() { - return m_delegate.getVersion(); - } - - public Element getComponentMetadata() { - return m_delegate.getComponentMetadata(); - } - - public List getInstances() { - return m_delegate.getInstances(); - } - - public List getInstancesNames() { - return m_delegate.getInstancesNames(); - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java deleted file mode 100644 index 8286c867d1..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/architecture/ArchitectureHandler.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - * 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.ipojo.composite.architecture; - -import java.util.Dictionary; -import java.util.Hashtable; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.InstanceStateListener; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.InstanceDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.ServiceRegistration; - -/** - * Composite Architecture Handler. - * - * @author Felix Project Team - */ -public class ArchitectureHandler extends CompositeHandler implements Architecture, InstanceStateListener { - - /** - * Name of the component. - */ - private String m_name; - - /** - * The Architecture service registration. - */ - private ServiceRegistration m_serviceRegistration; - - /** - * Configure the handler. - * - * @param metadata : the metadata of the component - * @param configuration : the instance configuration - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary configuration) { - m_name = (String) configuration.get(Factory.INSTANCE_NAME_PROPERTY); - Dictionary dict = new Hashtable(); - dict.put(ARCHITECTURE_INSTANCE, m_name); - - debug("Registering architecture service for " + m_name); - m_serviceRegistration = getCompositeManager().getContext().registerService(Architecture.class.getName(), this, dict); - - // We can't use the regular handler stateChanged method as this method is not called when the instance is - // disposed. This handler stays actives until the instance disposal. - getCompositeManager().addInstanceStateListener(this); - } - - /** - * Stop method. - * - * @see org.apache.felix.ipojo.Handler#stop() - */ - public void stop() { - // Nothing do do when stopping. - } - - /** - * Start method. - * - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - // Nothing to do. - } - - /** - * The instance lifecycle listener callback. - * When we receive the DISPOSED state, the architecture is unregistered from the service registry. - * @param instance the changing instance the instance, meaningless in our case. - * @param newState the new instance state the new instance state. - */ - public void stateChanged(ComponentInstance instance, int newState) { - if (newState == ComponentInstance.DISPOSED && m_serviceRegistration != null) { - debug("Withdrawing the architecture service of " + m_name + " due to instance disposal"); - m_serviceRegistration.unregister(); - m_serviceRegistration = null; - } - } - - /** - * Get the instance description. - * @return the instance description - * @see org.apache.felix.ipojo.architecture.Architecture#getInstanceDescription() () - */ - public InstanceDescription getInstanceDescription() { - return getCompositeManager().getInstanceDescription(); - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java deleted file mode 100644 index 47c3cbc9cc..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandler.java +++ /dev/null @@ -1,441 +0,0 @@ -/* - * 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.ipojo.composite.instance; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.InstanceManager; -import org.apache.felix.ipojo.InstanceStateListener; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ParseException; - -/** - * Composite Instance Handler. - * This handler allows creating an instance inside a composite. - * This instance is determine by its type and a configuration. - * @author Felix Project Team - */ -public class InstanceHandler extends CompositeHandler implements InstanceStateListener { - - /** - * Internal context. - */ - private ServiceContext m_scope; - - /** - * Available factories. - */ - private Factory[] m_factories; - - /** - * Handler description. - */ - private InstanceHandlerDescription m_description; - - - /** - * This structure aims to manage a configuration. It stores all necessary - * information to create an instance and to track the factory. - */ - class ManagedConfiguration { - /** - * Configuration of the instance to create. - */ - private Dictionary m_configuration; - - /** - * Factory name. - */ - private String m_factoryName; - - /** - * Created instance. - */ - private ComponentInstance m_instance; - - /** - * Desired Factory (can be the classname). - */ - private String m_desiredFactory; - - /** - * Constructor. - * - * @param conf : the configuration to create. - */ - ManagedConfiguration(Dictionary conf) { - m_configuration = conf; - m_desiredFactory = (String) conf.get("component"); - } - - /** - * Return the managed configuration. - * @return the configuration. - */ - protected Dictionary getConfiguration() { - return m_configuration; - } - - /** - * Return the used factory name. - * @return the factory name - */ - protected String getFactory() { - return m_factoryName; - } - - protected String getNeededFactoryName() { - return m_desiredFactory; - } - - /** - * Return the created instance. - * @return the instance (or null if no instance are created). - */ - protected ComponentInstance getInstance() { - return m_instance; - } - - /** - * Set the factory name. - * - * @param name : the factory name. - */ - protected void setFactory(String name) { - m_factoryName = name; - } - - /** - * Set the instance object. - * - * @param instance : the instance - */ - protected void setInstance(ComponentInstance instance) { - m_instance = instance; - } - } - - /** - * Configurations to create and maintains. - */ - private ManagedConfiguration[] m_configurations = new ManagedConfiguration[0]; - - /** - * Create an instance using the given factory and the given configuration. - * - * @param fact : the factory name to used. - * @param config : the configuration. - */ - private void createInstance(Factory fact, ManagedConfiguration config) { - Dictionary conf = config.getConfiguration(); - try { - config.setInstance(fact.createComponentInstance(conf, m_scope)); - config.setFactory(fact.getName()); - config.getInstance().addInstanceStateListener(this); - } catch (UnacceptableConfiguration e) { - error("A factory is available for the configuration but the configuration is not acceptable", e); - } catch (MissingHandlerException e) { - error("The instance creation has failed, at least one handler is missing", e); - } catch (ConfigurationException e) { - error("The instance creation has failed, an error during the configuration has occurred", e); - } - } - - /** - * A new valid factory appears. - * @param factory : factory. - */ - public void bindFactory(Factory factory) { - boolean implicated = false; - String factName = factory.getName(); - String className = factory.getComponentDescription().getClassName(); - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() == null - && (m_configurations[i].getNeededFactoryName().equals(factName) - || m_configurations[i].getNeededFactoryName().equals(className))) { - createInstance(factory, m_configurations[i]); - implicated = true; - } - } - if (implicated && ! getValidity()) { - checkValidity(); - } - } - - /** - * An existing factory disappears or becomes invalid. - * @param factory : factory - */ - public void unbindFactory(Factory factory) { - boolean implicated = false; - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() != null - && m_configurations[i].getFactory().equals(factory.getName())) { - m_configurations[i].setInstance(null); - m_configurations[i].setFactory(null); - implicated = true; - } - } - if (implicated && getValidity()) { - checkValidity(); - } - } - - /** - * Stop all created instances. - */ - public synchronized void stop() { - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() != null) { - m_configurations[i].getInstance().removeInstanceStateListener(this); - if (m_configurations[i].getInstance().getState() != ComponentInstance.DISPOSED) { - m_configurations[i].getInstance().dispose(); - } - } - m_configurations[i].setInstance(null); - m_configurations[i].setFactory(null); - } - m_configurations = new ManagedConfiguration[0]; - } - - /** - * Configure method. - * @param metadata : component type metadata. - * @param configuration : instance configuration. - * @throws ConfigurationException : occurs an instance cannot be parsed correctly. - * @see org.apache.felix.ipojo.Handler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary configuration) throws ConfigurationException { - m_scope = getCompositeManager().getServiceContext(); - - // Prepare the configuration to append. - Properties toAppend = new Properties(); - Enumeration keys = configuration.keys(); - while(keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - if (! (key.equals("instance.name") - || key.equals("component"))) { // Remove instance.name and component - toAppend.put(key, configuration.get(key)); - } - } - - Element[] instances = metadata.getElements("instance"); - m_configurations = new ManagedConfiguration[instances.length]; - for (int i = 0; i < instances.length; i++) { - Properties conf = null; - try { - conf = parseInstance(instances[i]); - } catch (ParseException e) { - error("An instance cannot be parsed correctly", e); - throw new ConfigurationException("An instance cannot be parsed correctly", e); - } - - Properties instanceConfiguration = new Properties(); - instanceConfiguration.putAll(conf); - instanceConfiguration.putAll(toAppend); - m_configurations[i] = new ManagedConfiguration(instanceConfiguration); - } - - m_description = new InstanceHandlerDescription(this, m_configurations); - } - - /** - * Parse an Element to get a dictionary. - * @param instance : the Element describing an instance. - * @return : the resulting dictionary - * @throws ParseException : occurs when a configuration cannot be parse correctly. - */ - public static Properties parseInstance(Element instance) throws ParseException { - Properties dict = new Properties(); - String name = instance.getAttribute("name"); - if (name != null) { - dict.put("instance.name", name); - } - - String comp = instance.getAttribute("component"); - if (comp == null) { - throw new ParseException("An instance does not have the 'component' attribute"); - } else { - dict.put("component", comp); - } - - Element[] props = instance.getElements("property"); - for (int i = 0; props != null && i < props.length; i++) { - parseProperty(props[i], dict); - } - - return dict; - } - - /** - * Parse a property. - * @param prop : the current element to parse - * @param dict : the dictionary to populate - * @throws ParseException : occurs if the property cannot be parsed correctly - */ - public static void parseProperty(Element prop, Dictionary dict) throws ParseException { - // Check that the property has a name - String name = prop.getAttribute("name"); - String value = prop.getAttribute("value"); - if (name == null) { throw new ParseException("A property does not have the 'name' attribute"); } - // Final case : the property element has a 'value' attribute - if (value == null) { - // Recursive case - // Check if there is 'property' element - Element[] subProps = prop.getElements("property"); - if (subProps == null) { throw new ParseException("A complex property must have at least one 'property' sub-element"); } - Dictionary dict2 = new Properties(); - for (int i = 0; i < subProps.length; i++) { - parseProperty(subProps[i], dict2); - dict.put(prop.getAttribute("name"), dict2); - } - } else { - dict.put(name, value); - } - } - - /** - * Start method. - * @see org.apache.felix.ipojo.Handler#start() - */ - public void start() { - for (int j = 0; j < m_factories.length; j++) { - String factName = m_factories[j].getName(); - String className = m_factories[j].getClassName(); - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() == null && (m_configurations[i].getNeededFactoryName().equals(factName) || m_configurations[i].getNeededFactoryName().equals(className))) { - createInstance(m_factories[j], m_configurations[i]); - } - } - } - checkValidity(); - } - - /** - * Check handler validity. - * The method updates the validity of the handler. - */ - private void checkValidity() { - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() == null || m_configurations[i].getInstance().getState() != ComponentInstance.VALID) { - setValidity(false); - return; - } - } - setValidity(true); - } - - /** - * Instance state listener. - * This method listens when managed instance states change. - * @param instance : instance - * @param newState : the now state of the given instance - * @see org.apache.felix.ipojo.InstanceStateListener#stateChanged(org.apache.felix.ipojo.ComponentInstance, int) - */ - public void stateChanged(ComponentInstance instance, int newState) { - switch (newState) { - case ComponentInstance.DISPOSED: - break; // Should not happen - case ComponentInstance.STOPPED: - break; // Should not happen - case ComponentInstance.VALID: - if (!getValidity()) { - checkValidity(); - } - break; - case ComponentInstance.INVALID: - if (getValidity()) { - checkValidity(); - } - break; - default: - break; - - } - } - - /** - * Method returning an instance object of the given component type. - * This method must be called only on 'primitive' type. - * @param type : type. - * @return an instance object or null if not found. - */ - public Object getObjectFromInstance(String type) { - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() != null && type.equals(m_configurations[i].getFactory())) { - if (m_configurations[i].getInstance().getState() == ComponentInstance.VALID) { - return ((InstanceManager) m_configurations[i].getInstance()).getPojoObject(); - } else { - error("An object cannot be get from the instance of the type " + type + ": invalid instance" + - m_configurations[i].getInstance().getInstanceDescription().getDescription()); - return null; - } - } - } - return null; - } - - /** - * Return the handler description, i.e. the state of created instances. - * @return the handler description. - * @see org.apache.felix.ipojo.Handler#getDescription() - */ - public HandlerDescription getDescription() { - return m_description; - } - - /** - * Get the list of used component type. - * @return the list containing the used component type - */ - public List getUsedType() { - List result = new ArrayList(); - for (int i = 0; i < m_configurations.length; i++) { - result.add(m_configurations[i].getConfiguration().get("component")); - } - return result; - } - - /** - * The composite is reconfigured, we check if we have a property to change. - * We reconfigure all contained instances. - * @param configuration the new instance configuration - */ - public void reconfigure(Dictionary configuration) { - for (int i = 0; i < m_configurations.length; i++) { - if (m_configurations[i].getInstance() != null) { - info("Reconfiguring " + m_configurations[i].getInstance().getInstanceName()); - m_configurations[i].getInstance().reconfigure(configuration); - } - } - - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java deleted file mode 100644 index a7fc53e24f..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/instance/InstanceHandlerDescription.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.ipojo.composite.instance; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.composite.instance.InstanceHandler.ManagedConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -/** - * Description of the Instance Handler. - * - * @author Felix Project Team - */ -public class InstanceHandlerDescription extends HandlerDescription { - - - /** - * List of managed instances. - */ - private ManagedConfiguration[] m_configurations; - - /** - * Constructor. - * - * @param handler : handler - * @param insts : list of component instances - */ - public InstanceHandlerDescription(CompositeHandler handler, ManagedConfiguration[] insts) { - super(handler); - m_configurations = insts; - } - - /** - * Build handler description. - * @return the handler description - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - public Element getHandlerInfo() { - Element instances = super.getHandlerInfo(); - for (int i = 0; i < m_configurations.length; i++) { - ManagedConfiguration inst = m_configurations[i]; - Element instance = new Element("Instance", ""); - if (inst.getInstance() == null) { - instance.addAttribute(new Attribute("Factory", inst.getConfiguration().get("component").toString())); - instance.addAttribute(new Attribute("State", "Not Available")); - } else { - instance.addAttribute(new Attribute("Factory", inst.getFactory())); - instance.addAttribute(new Attribute("Name", inst.getInstance().getInstanceName())); - String state = null; - switch(inst.getInstance().getState()) { - case ComponentInstance.DISPOSED : - state = "disposed"; break; - case ComponentInstance.STOPPED : - state = "stopped"; break; - case ComponentInstance.VALID : - state = "valid"; break; - case ComponentInstance.INVALID : - state = "invalid"; break; - default : - break; - } - instance.addAttribute(new Attribute("State", state)); - // The instance description is already contained inside parent instance description. - //instance.addElement(inst.getInstance().getInstanceDescription().getDescription()); - } - instances.addElement(instance); - } - return instances; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java deleted file mode 100644 index 5712080079..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceDependencyHandler.java +++ /dev/null @@ -1,393 +0,0 @@ -/* - * 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.ipojo.composite.service.instantiator; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.PolicyServiceContext; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.composite.instance.InstanceHandler; -import org.apache.felix.ipojo.composite.util.SourceManager; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ParseException; -import org.apache.felix.ipojo.util.DependencyMetadataHelper; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.DependencyStateListener; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; - -/** - * Service Instantiator Class. This handler allows to instantiate service - * instance inside the composition. - * - * @author Felix Project Team - */ -public class ServiceDependencyHandler extends CompositeHandler implements DependencyStateListener { - - /** - * List of instances to manage. - */ - private List/* */m_instances = new ArrayList(); - - /** - * List of importers. - */ - private List/* */ m_importers = new ArrayList(); - - /** - * Flag indicating if the handler has already finished the start method. - */ - private boolean m_isStarted; - - /** - * The handler description. - */ - private ServiceInstantiatorDescription m_description; - - /** - * Source Managers. - */ - private List m_sources; - - - /** - * Create a Service instance object form the given Element. - * This method parse the given element and configure the service instance object. - * @param service : the Element describing the service instance - * @param conf : the configuration from the composite instance - * @throws ConfigurationException : the service instance cannot be created correctly - */ - private void createServiceInstance(Element service, Dictionary conf) throws ConfigurationException { - // Prepare the configuration to append. - Properties toAppend = new Properties(); - Enumeration keys = conf.keys(); - while(keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - if (! (key.equals("instance.name") - || key.equals("component"))) { // Remove instance.name and component - toAppend.put(key, conf.get(key)); - } - } - - String spec = service.getAttribute("specification"); - if (spec == null) { - throw new ConfigurationException("Malformed service : the specification attribute is mandatory"); - } - String filter = "(&(!(factory.name=" + getCompositeManager().getFactory().getComponentDescription().getName() + "))(factory.state=1))"; // Cannot reinstantiate yourself - String givenFilter = service.getAttribute("filter"); - if (givenFilter != null) { - filter = "(&" + filter + givenFilter + ")"; //NOPMD - } - - Filter fil; - try { - fil = getCompositeManager().getGlobalContext().createFilter(filter); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("Malformed filter " + filter, e); - } - - Properties prop = new Properties(); - Element[] props = service.getElements("property"); - for (int k = 0; props != null && k < props.length; k++) { - try { - InstanceHandler.parseProperty(props[k], prop); - } catch (ParseException e) { - throw new ConfigurationException("An instance configuration is invalid", e); - } - } - - Properties instanceConfiguration = new Properties(); - instanceConfiguration.putAll(prop); - instanceConfiguration.putAll(toAppend); - - String aggregate = service.getAttribute("aggregate"); - boolean agg = aggregate != null && aggregate.equalsIgnoreCase("true"); - - String optional = service.getAttribute("optional"); - boolean opt = optional != null && optional.equalsIgnoreCase("true"); - - int policy = DependencyMetadataHelper.getPolicy(service); - - Comparator cmp = DependencyMetadataHelper.getComparator(service, getCompositeManager().getGlobalContext()); - - SvcInstance inst = new SvcInstance(this, spec, instanceConfiguration, agg, opt, fil, cmp, policy); - m_instances.add(inst); - - String sources = service.getAttribute("context-source"); - if (sources != null) { - SourceManager source = new SourceManager(sources, filter, inst, getCompositeManager()); - if (m_sources == null) { - m_sources = new ArrayList(1); - } - m_sources.add(source); - } - } - - /** - * Create a Service importer object from the given Element. - * This method parse the given element and configure the service importer object. - * @param imp : Element describing the import - * @param confFilter : instance filter customization - * @throws ConfigurationException : the service importer cannot be created correctly - */ - private void createServiceImport(Element imp, Dictionary confFilter) throws ConfigurationException { - boolean optional = false; - boolean aggregate = false; - String specification = imp.getAttribute("specification"); - - if (specification == null) { - // Malformed import - error("Malformed import: the specification attribute is mandatory"); - throw new ConfigurationException("Malformed import : the specification attribute is mandatory"); - } else { - String opt = imp.getAttribute("optional"); - optional = opt != null && opt.equalsIgnoreCase("true"); - - String agg = imp.getAttribute("aggregate"); - aggregate = agg != null && agg.equalsIgnoreCase("true"); - - String original = "(&(objectClass=" + specification + ")(!(instance.name=" + getCompositeManager().getInstanceName() + ")))"; // Cannot import yourself - String filter = original; - String givenFilter = imp.getAttribute("filter"); - if (givenFilter != null) { - filter = "(&" + filter + givenFilter + ")"; //NOPMD - } - - String identitity = imp.getAttribute("id"); - - String scope = imp.getAttribute("scope"); - BundleContext context = getCompositeManager().getGlobalContext(); // Get the default bundle context. - if (scope != null) { - if (scope.equalsIgnoreCase("global")) { - context = new PolicyServiceContext(getCompositeManager().getGlobalContext(), getCompositeManager().getParentServiceContext(), PolicyServiceContext.GLOBAL); - } else if (scope.equalsIgnoreCase("composite")) { - context = new PolicyServiceContext(getCompositeManager().getGlobalContext(), getCompositeManager().getParentServiceContext(), PolicyServiceContext.LOCAL); - } else if (scope.equalsIgnoreCase("composite+global")) { - context = new PolicyServiceContext(getCompositeManager().getGlobalContext(), getCompositeManager().getParentServiceContext(), PolicyServiceContext.LOCAL_AND_GLOBAL); - } - } - - // Configure instance filter if available - if (confFilter != null && identitity != null && confFilter.get(identitity) != null) { - filter = "(&" + original + (String) confFilter.get(identitity) + ")"; - } - - Filter fil = null; - if (filter != null) { - try { - fil = getCompositeManager().getGlobalContext().createFilter(filter); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("A required filter " + filter + " is malformed", e); - } - } - - Comparator cmp = DependencyMetadataHelper.getComparator(imp, getCompositeManager().getGlobalContext()); - Class spec = DependencyMetadataHelper.loadSpecification(specification, getCompositeManager().getGlobalContext()); - int policy = DependencyMetadataHelper.getPolicy(imp); - - ServiceImporter importer = new ServiceImporter(spec, fil, aggregate, optional, cmp, policy, context, identitity, this); - m_importers.add(importer); - - String sources = imp.getAttribute("context-source"); - if (sources != null) { - SourceManager source = new SourceManager(sources, filter, importer, getCompositeManager()); - if (m_sources == null) { - m_sources = new ArrayList(1); - } - m_sources.add(source); - } - - } - } - - /** - * Configure the handler. - * @param metadata : the metadata of the component - * @param conf : the instance configuration - * @throws ConfigurationException : the specification attribute is missing - * @see CompositeHandler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary conf) throws ConfigurationException { - Element[] services = metadata.getElements("subservice"); - // Get instance filters - Dictionary confFilter = null; - if (conf.get("requires.filters") != null) { - confFilter = (Dictionary) conf.get("requires.filters"); - } - - for (int i = 0; i < services.length; i++) { - String action = services[i].getAttribute("action"); - if (action == null) { - throw new ConfigurationException("The action attribute must be set to 'instantiate' or 'import'"); - } else if ("instantiate".equalsIgnoreCase(action)) { - createServiceInstance(services[i], conf); - } else if ("import".equalsIgnoreCase(action)) { - createServiceImport(services[i], confFilter); - } else { - throw new ConfigurationException("Unknown action : " + action); - } - } - - m_description = new ServiceInstantiatorDescription(this, m_instances, m_importers); - } - - /** - * Start the service instantiator handler. - * Start all created service instance. - * @see org.apache.felix.ipojo.composite.CompositeHandler#start() - */ - public void start() { - for (int i = 0; m_sources != null && i < m_sources.size(); i++) { - SourceManager source = (SourceManager) m_sources.get(i); - source.start(); - } - - for (int i = 0; i < m_importers.size(); i++) { - ServiceImporter imp = (ServiceImporter) m_importers.get(i); - imp.start(); - } - - for (int i = 0; i < m_instances.size(); i++) { - SvcInstance inst = (SvcInstance) m_instances.get(i); - inst.start(); - } - - isHandlerValid(); - m_isStarted = true; - } - - /** - * Check the handler validity. - * @see org.apache.felix.ipojo.composite.CompositeHandler#isValid() - */ - private void isHandlerValid() { - for (int i = 0; i < m_importers.size(); i++) { - ServiceImporter imp = (ServiceImporter) m_importers.get(i); - if (imp.getState() != DependencyModel.RESOLVED) { - setValidity(false); - return; - } - } - - for (int i = 0; i < m_instances.size(); i++) { - SvcInstance inst = (SvcInstance) m_instances.get(i); - if (inst.getState() != DependencyModel.RESOLVED) { - setValidity(false); - return; - } - } - - setValidity(true); - } - - /** - * Handler stop method. - * Stop all created service instance. - * @see org.apache.felix.ipojo.composite.CompositeHandler#stop() - */ - public void stop() { - for (int i = 0; m_sources != null && i < m_sources.size(); i++) { - SourceManager source = (SourceManager) m_sources.get(i); - source.stop(); - } - - for (int i = 0; i < m_instances.size(); i++) { - SvcInstance inst = (SvcInstance) m_instances.get(i); - inst.stop(); - } - - for (int i = 0; i < m_importers.size(); i++) { - ServiceImporter imp = (ServiceImporter) m_importers.get(i); - imp.stop(); - } - - m_isStarted = false; - } - - /** - * State change callback. - * This method is used to freeze the set of used provider if the static binding policy is used. - * @param newState : the new state of the underlying instance - * @see org.apache.felix.ipojo.Handler#stateChanged(int) - */ - public void stateChanged(int newState) { - // If we are becoming valid and started, check if we need to freeze importers. - if (m_isStarted && newState == ComponentInstance.VALID) { - for (int i = 0; i < m_importers.size(); i++) { - ServiceImporter imp = (ServiceImporter) m_importers.get(i); - if (imp.getBindingPolicy() == DependencyModel.STATIC_BINDING_POLICY) { - imp.freeze(); - } - } - - for (int i = 0; i < m_instances.size(); i++) { - SvcInstance imp = (SvcInstance) m_instances.get(i); - if (imp.getBindingPolicy() == DependencyModel.STATIC_BINDING_POLICY) { - imp.freeze(); - } - } - } - } - - /** - * An service instance becomes valid. - * @param dep : dependency becoming valid. - */ - public void validate(DependencyModel dep) { - if (!getValidity()) { - isHandlerValid(); - } - } - - /** - * A service instance becomes invalid. - * @param dep : dependency becoming valid. - */ - public void invalidate(DependencyModel dep) { - if (getValidity()) { - isHandlerValid(); - } - } - - /** - * Get the service instantiator handler description. - * @return the description - * @see org.apache.felix.ipojo.composite.CompositeHandler#getDescription() - */ - public HandlerDescription getDescription() { - return m_description; - } - - public List getInstances() { - return m_instances; - } - - public List getRequirements() { - return m_importers; - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java deleted file mode 100644 index 36ac5a99e4..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceImporter.java +++ /dev/null @@ -1,326 +0,0 @@ -/* - * 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.ipojo.composite.service.instantiator; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Dictionary; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.PolicyServiceContext; -import org.apache.felix.ipojo.util.DependencyModel; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; - -/** - * Import a service form the parent to the internal service registry. - * @author Felix Project Team - */ -public class ServiceImporter extends DependencyModel { - - /** - * Reference on the handler. - */ - private ServiceDependencyHandler m_handler; - - private final class Record { - /** - * External Reference. - */ - private ServiceReference m_ref; - - /** - * Internal Registration. - */ - private ServiceRegistration m_reg; - - /** - * Exposed Object. - */ - private Object m_svcObject; - - /** - * Constructor. - * @param ref : service reference. - */ - protected Record(ServiceReference ref) { - m_ref = ref; - } - - /** - * Register the current import. - */ - private void register() { - if (m_reg != null) { - m_reg.unregister(); - } - m_svcObject = getService(m_ref); - m_reg = m_handler.getCompositeManager().getServiceContext() - .registerService(getSpecification().getName(), m_svcObject, getProps(m_ref)); - } - - /** - * Update the current import. - */ - private void update() { - if (m_reg != null) { - m_reg.setProperties(getProps(m_ref)); - } - } - - /** - * Unregister and release the current import. - */ - private void dispose() { - if (m_reg != null) { - m_reg.unregister(); - m_svcObject = null; - m_reg = null; - } - m_ref = null; - } - - /** - * Test object equality. - * @param object : object to confront against the current object. - * @return true if the two objects are equals (same service reference). - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object object) { - if (object instanceof Record) { - Record rec = (Record) object; - return rec.m_ref == m_ref; - } - return false; - } - - /** - * Hash code method. - * @return the hash code by calling the parent method. - */ - public int hashCode() { - return super.hashCode(); - } - } - - /** - * List of managed records. - */ - private List/**/m_records = new ArrayList()/* */; - - /** - * Requirement Id. - */ - private String m_id; - - /** - * Is this requirement attached to a service-level requirement. - */ - private boolean m_specLevelReq; - - /** - * Is the set of used provider frozen ? - */ - private boolean m_isFrozen; - - /** - * Constructor. - * - * @param specification : targeted specification - * @param filter : LDAP filter - * @param multiple : should the importer imports several services ? - * @param optional : is the import optional ? - * @param cmp : comparator to use for the tracking - * @param policy : resolving policy - * @param context : bundle context to use for the tracking (can be a servie context) - * @param identitity : requirement id (may be null) - * @param handler : handler - */ - public ServiceImporter(Class specification, Filter filter, boolean multiple, boolean optional, Comparator cmp, int policy, BundleContext context, String identitity - , ServiceDependencyHandler handler) { - super(specification, multiple, optional, filter, cmp, policy, context, handler, handler.getCompositeManager()); - - this.m_handler = handler; - - if (m_id == null) { - m_id = super.getSpecification().getName(); - } else { - m_id = identitity; - } - - } - - /** - * Get the properties for the exposed service from the given reference. - * - * @param ref : the reference. - * @return the property dictionary - */ - private static Dictionary getProps(ServiceReference ref) { - Properties prop = new Properties(); - String[] keys = ref.getPropertyKeys(); - for (int i = 0; i < keys.length; i++) { - prop.put(keys[i], ref.getProperty(keys[i])); - } - return prop; - } - - /** - * Freeze the set of used provider. - * This method allow to fix the set of provider when the static binding policy is used. - */ - public void freeze() { - m_isFrozen = true; - } - - /** - * Unfreezes. - */ - public void unfreeze() { - m_isFrozen = false; - } - - public boolean isFrozen() { - return m_isFrozen; - } - - /** - * Stop the management of the import. - */ - public void stop() { - - super.stop(); - - for (int i = 0; i < m_records.size(); i++) { - Record rec = (Record) m_records.get(i); - rec.dispose(); - } - - m_records.clear(); - - } - - /** - * Get the record list using the given reference. - * - * @param ref : the reference - * @return the list containing all record using the given reference - */ - private List/* */getRecordsByRef(ServiceReference ref) { - List list = new ArrayList(); - for (int i = 0; i < m_records.size(); i++) { - Record rec = (Record) m_records.get(i); - if (rec.m_ref == ref) { - list.add(rec); - } - } - return list; - } - - /** - * Build the list of imported service provider. - * @return the list of all imported services. - */ - public List getProviders() { - List list = new ArrayList(); - for (int i = 0; i < m_records.size(); i++) { - list.add((((Record) m_records.get(i)).m_ref).getProperty("instance.name")); - } - return list; - } - - /** - * Set that this dependency is a service level dependency. - * This forces the scoping policy to be STRICT. - */ - public void setServiceLevelDependency() { - m_specLevelReq = true; - PolicyServiceContext context = new PolicyServiceContext(m_handler.getCompositeManager().getGlobalContext(), m_handler.getCompositeManager().getParentServiceContext(), PolicyServiceContext.LOCAL); - setBundleContext(context); - } - - public String getId() { - return m_id; - } - - public boolean isServiceLevelRequirement() { - return m_specLevelReq; - } - - /** - * On Dependency Reconfiguration notification method. - * @param departs : leaving service references. - * @param arrivals : new injected service references. - * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[]) - */ - public void onDependencyReconfiguration(ServiceReference[] departs, ServiceReference[] arrivals) { - for (int i = 0; departs != null && i < departs.length; i++) { - onServiceDeparture(departs[i]); - } - - for (int i = 0; arrivals != null && i < arrivals.length; i++) { - onServiceArrival(arrivals[i]); - } - } - - /** - * A new service is injected by the tracker. - * This method create a 'Record' and register it. - * @param ref : new service reference. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference) - */ - public void onServiceArrival(ServiceReference ref) { - Record rec = new Record(ref); - m_records.add(rec); - // Always register the reference, as the method is call only when needed. - rec.register(); - } - - /** - * A used service disappears. - * This method find the implicated 'Record', dispose it and remove it from the list. - * @param ref : leaving service reference. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference) - */ - public void onServiceDeparture(ServiceReference ref) { - List list = getRecordsByRef(ref); - for (int i = 0; i < list.size(); i++) { // Stop the implied record - Record rec = (Record) list.get(i); - rec.dispose(); - } - m_records.removeAll(list); - } - - /** - * A used service is modified. - * @param ref : modified service reference. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceModification(org.osgi.framework.ServiceReference) - */ - public void onServiceModification(ServiceReference ref) { - List list = getRecordsByRef(ref); - for (int i = 0; i < list.size(); i++) { // Stop the implied record - Record rec = (Record) list.get(i); - rec.update(); - } - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java deleted file mode 100644 index 21251532d2..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/ServiceInstantiatorDescription.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.ipojo.composite.service.instantiator; - -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyModel; -import org.osgi.framework.ServiceReference; - -/** - * Description of the Service Creator Handler. - * - * @author Felix Project Team - */ -public class ServiceInstantiatorDescription extends HandlerDescription { - - /** - * List of managed service instances. - */ - private List m_instances; - - /** - * List of exports. - */ - private List m_imports; - - /** - * Constructor. - * - * @param handler : composite handler - * @param insts : list of service instances - * @param imps : list of service importers - */ - public ServiceInstantiatorDescription(CompositeHandler handler, List insts, List imps) { - super(handler); - m_instances = insts; - m_imports = imps; - } - - /** - * Build service instantiator handler description. - * @return the handler description - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - public Element getHandlerInfo() { - Element services = super.getHandlerInfo(); - for (int i = 0; i < m_imports.size(); i++) { - ServiceImporter imp = (ServiceImporter) m_imports.get(i); - Element impo = new Element("Requires", ""); - impo.addAttribute(new Attribute("Specification", imp.getSpecification().getName())); - if (imp.getFilter() != null) { - impo.addAttribute(new Attribute("Filter", imp.getFilter())); - } - if (imp.getState() == DependencyModel.RESOLVED) { - impo.addAttribute(new Attribute("State", "resolved")); - for (int j = 0; j < imp.getProviders().size(); j++) { - Element prov = new Element("Provider", ""); - prov.addAttribute(new Attribute("name", (String) imp.getProviders().get(j))); - impo.addElement(prov); - } - } else { - impo.addAttribute(new Attribute("State", "unresolved")); - } - services.addElement(impo); - } - - for (int i = 0; i < m_instances.size(); i++) { - SvcInstance inst = (SvcInstance) m_instances.get(i); - Element service = new Element("Service", ""); - service.addAttribute(new Attribute("Specification", inst.getServiceSpecification())); - String state = "unresolved"; - if (inst.getState() == DependencyModel.RESOLVED) { - state = "resolved"; - } - service.addAttribute(new Attribute("State", state)); - Map map = inst.getMatchingFactories(); - Set keys = map.keySet(); - Iterator iterator = keys.iterator(); - while (iterator.hasNext()) { - ServiceReference ref = (ServiceReference) iterator.next(); - Object object = map.get(ref); - if (object != null) { - Element fact = new Element("Factory", ""); - fact.addAttribute(new Attribute("Name", ((ComponentInstance) object).getFactory().getName())); - service.addElement(fact); - } - } - services.addElement(service); - } - return services; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java deleted file mode 100644 index d61d347a9f..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/instantiator/SvcInstance.java +++ /dev/null @@ -1,295 +0,0 @@ -/* - * 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.ipojo.composite.service.instantiator; - -import java.util.Comparator; -import java.util.Dictionary; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.util.DependencyModel; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; - -/** - * Manage a service instantiation. This service create component instance providing the required service specification. - * @author Felix Project Team - */ -public class SvcInstance extends DependencyModel { - - /** - * Configuration to push to the instance. - */ - private Dictionary m_configuration; - - /** - * Handler creating the service instance. - */ - private ServiceDependencyHandler m_handler; - - /** - * Map of matching factories Service Reference => instance or null (null if the service reference is not actually used). - */ - private Map /* */m_factories = new HashMap(); - - /** - * Required specification. - */ - private String m_specification; - - /** - * Is the service provider frozen ? (Is used for static biding policy) - */ - private boolean m_isFrozen; - - /** - * Constructor. - * @param handler : the handler. - * @param spec : required specification. - * @param conf : instance configuration. - * @param isAgg : is the service instance an aggregate service ? - * @param isOpt : is the service instance optional ? - * @param filt : LDAP filter - * @param cmp : comparator to use for the tracking - * @param policy : binding policy - * @throws ConfigurationException : an attribute cannot be parsed correctly, or is incorrect. - */ - public SvcInstance(ServiceDependencyHandler handler, String spec, Dictionary conf, boolean isAgg, boolean isOpt, Filter filt, Comparator cmp, int policy) throws ConfigurationException { - super(Factory.class, isAgg, isOpt, filt, cmp, policy, null, handler, handler.getCompositeManager()); - - m_specification = spec; - - m_handler = handler; - setBundleContext(m_handler.getCompositeManager().getServiceContext()); - - m_configuration = conf; - } - - /** - * Stop the service instance. - */ - public void stop() { - super.stop(); - - Set keys = m_factories.keySet(); - Iterator iterator = keys.iterator(); - while (iterator.hasNext()) { - ServiceReference ref = (ServiceReference) iterator.next(); - Object object = m_factories.get(ref); - if (object != null) { - m_handler.info("Dispose a service instance when stopping the handler " + ((ComponentInstance) object).getInstanceName()); - ((ComponentInstance) object).dispose(); - } - } - - m_factories.clear(); - - } - - public boolean isFrozen() { - return m_isFrozen; - } - - /** - * Freeze the set of used provider. - * This method is when the static binding policy is applied. - */ - public void freeze() { - m_isFrozen = true; - } - - /** - * Unfreezes. - */ - public void unfreeze() { - m_isFrozen = false; - } - - - /** - * Create an instance for the given reference. The instance is not added inside the map. - * @param factory : the factory from which we need to create the instance. - * @return the created component instance. - * @throws ConfigurationException : the instance cannot be configured correctly. - * @throws MissingHandlerException : the factory is invalid. - * @throws UnacceptableConfiguration : the given configuration is invalid for the given factory. - */ - private ComponentInstance createInstance(Factory factory) throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Recreate the configuration to avoid sharing. - Properties props = new Properties(); - Enumeration keys = m_configuration.keys(); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - props.put(key, m_configuration.get(key)); - } - ComponentInstance instance = null; - instance = factory.createComponentInstance(props); - m_handler.info("Creation of a service instance " + instance.getInstanceName()); - return instance; - } - - /** - * Does the service instance match with the given factory ? - * @param fact : the factory to test. - * @return true if the factory match, false otherwise. - */ - public boolean match(ServiceReference fact) { - // Check if the factory can provide the specification - ComponentTypeDescription desc = (ComponentTypeDescription) fact.getProperty("component.description"); - if (desc == null) { - return false; // No component type description. - } - - String[] provides = desc.getprovidedServiceSpecification(); - for (int i = 0; provides != null && i < provides.length; i++) { - if (provides[i].equals(m_specification)) { - // Check that the factory needs every properties contained in - // the configuration - PropertyDescription[] props = desc.getProperties(); - Properties conf = new Properties(); - Enumeration keys = m_configuration.keys(); - while (keys.hasMoreElements()) { - String key = (String) keys.nextElement(); - if (!containsProperty(key, props)) { return false; } - conf.put(key, m_configuration.get(key)); - } - - Factory factory = (Factory) getService(fact); - return factory.isAcceptable(conf); - } - } - return false; - } - - /** - * Does the factory support the given property ? This method check if the property is contained in the given property description array. - * @param name : name of the property - * @param props : list of property description - * @return true if the factory support this property - */ - private boolean containsProperty(String name, org.apache.felix.ipojo.architecture.PropertyDescription[] props) { - for (int i = 0; props != null && i < props.length; i++) { - if (props[i].getName().equalsIgnoreCase(name)) { return true; } - } - if (name.equalsIgnoreCase("name")) { return true; } // Skip the name property - return false; - } - - /** - * Get the required specification. - * @return the required specification. - */ - public String getServiceSpecification() { - return m_specification; - } - - /** - * Get the map of used references [reference, component instance]. - * @return the map of used references. - */ - protected Map getMatchingFactories() { - return m_factories; - } - - /** - * On Dependency Reconfiguration notification method. - * @param departs : leaving service references. - * @param arrivals : new injected service references. - * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[]) - */ - public void onDependencyReconfiguration(ServiceReference[] departs, ServiceReference[] arrivals) { - for (int i = 0; departs != null && i < departs.length; i++) { - onServiceDeparture(departs[i]); - } - - for (int i = 0; arrivals != null && i < arrivals.length; i++) { - onServiceArrival(arrivals[i]); - } - } - - /** - * A new service is injected. - * This method create the sub-service instance in the composite. - * @param ref : service reference. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceArrival(org.osgi.framework.ServiceReference) - */ - public void onServiceArrival(ServiceReference ref) { - // The given factory matches. - try { - Factory fact = (Factory) getService(ref); - if (m_factories.get(ref) == null) { - ComponentInstance instance = createInstance(fact); - m_factories.put(ref, instance); - } else { - m_handler - .info("An arriving factory is already used, ignore the creation : " - + fact.getName()); - } - - } catch (UnacceptableConfiguration e) { - m_handler.error("A matching factory refuses the actual configuration : " + e.getMessage()); - m_handler.getCompositeManager().stop(); - } catch (MissingHandlerException e) { - m_handler.error("A matching factory is no more valid : " + e.getMessage()); - m_handler.getCompositeManager().stop(); - } catch (ConfigurationException e) { - m_handler.error("A matching configuration is refused by the instance : " + e.getMessage()); - m_handler.getCompositeManager().stop(); - } - - } - - - /** - * A used service is leaving. - * This method dispose the created instance. - * @param ref : leaving service reference. - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceDeparture(org.osgi.framework.ServiceReference) - */ - public void onServiceDeparture(ServiceReference ref) { - // Remove the reference is contained - Object instance = m_factories.remove(ref); - if (instance != null) { - m_handler.info("Dispose the instance (departure of the factory) " - + ((ComponentInstance) instance).getInstanceName()); - ((ComponentInstance) instance).dispose(); - } - } - - /** - * A factory is modified. This should not happen. - * @param arg0 the service reference - * @see org.apache.felix.ipojo.util.DependencyModel#onServiceModification(org.osgi.framework.ServiceReference) - */ - public void onServiceModification(ServiceReference arg0) { - // Nothing to do. - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java deleted file mode 100644 index 801b595c5b..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionException.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -/** - * Exception occurs when a composition error occurs. - * - * @author Felix Project Team - */ -public class CompositionException extends Exception { - //TODO consider removing this class to use configuration exception. - /** - * serialVersionUID. - */ - private static final long serialVersionUID = -3063353267573738105L; - - /** - * Constructor. - * @param message a message. - */ - public CompositionException(String message) { - this(message, null); - } - - public CompositionException(String message, Throwable cause) { - super(message, cause); - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java deleted file mode 100644 index 39c497d9ee..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/CompositionMetadata.java +++ /dev/null @@ -1,361 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.manipulation.Manipulator; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.osgi.framework.BundleContext; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -/** - * Check and build a composition, i.e. a POJO containing the composition. - * @author Felix Project Team - */ -public class CompositionMetadata { - - /** - * Implemented composition. - */ - private SpecificationMetadata m_specification; - - /** - * Name of the composition. - */ - private String m_name; - - /** - * Bundle Context. - */ - private BundleContext m_context; - - /** - * Manipulation Metadata. - */ - private Element m_manipulation; - - /** - * Reference on the handler. - */ - private ProvidedServiceHandler m_handler; - - /** - * List of Mappings. - */ - private List m_mappings = new ArrayList(); - - /** - * Constructor. - * @param context : bundle context - * @param description : 'provides' element - * @param psh : parent handler - * @param name : name of the composition. - */ - public CompositionMetadata(BundleContext context, Element description, ProvidedServiceHandler psh, String name) { - m_context = context; - m_handler = psh; - // Get the composition name - m_name = description.getAttribute("specification") + name; - - // Get implemented service specification - String spec = description.getAttribute("specification"); - m_specification = new SpecificationMetadata(spec, m_context, false, false, m_handler); - - Element[] mappings = description.getElements("delegation"); - for (int i = 0; mappings != null && i < mappings.length; i++) { - String methodName = mappings[i].getAttribute("method"); - MethodMetadata method = m_specification.getMethodByName(methodName); - if (method == null) { - m_handler.error("The method " + methodName + " does not exist in the specicifation " + spec); - return; - } - - if (mappings[i].getAttribute("policy").equalsIgnoreCase("All")) { - method.setAllPolicy(); - } - } - } - - protected BundleContext getBundleContext() { - return m_context; - } - - public String getName() { - return m_name; - } - - public SpecificationMetadata getSpecificationMetadata() { - return m_specification; - } - - /** - * Build Available Mappings. - * @throws CompositionException : a factory is not available, the composition cannot be checked. - */ - private void buildAvailableMappingList() throws CompositionException { - int index = 0; - - for (int i = 0; i < m_handler.getInstanceType().size(); i++) { - String type = (String) m_handler.getInstanceType().get(i); - try { - ServiceReference[] refs = m_context.getServiceReferences(Factory.class.getName(), "(factory.name=" + type + ")"); - if (refs == null) { - m_handler.error("The factory " + type + " is not available, cannot check the composition"); - throw new CompositionException("The factory " + type + " needs to be available to check the composition"); - } else { - String className = (String) refs[0].getProperty("component.class"); - Class impl = m_context.getBundle().loadClass(className); - SpecificationMetadata spec = new SpecificationMetadata(impl, type, m_handler); - FieldMetadata field = new FieldMetadata(spec); - field.setName("_field" + index); - Mapping map = new Mapping(spec, field); - m_mappings.add(map); - index++; - } - } catch (InvalidSyntaxException e) { - m_handler.error("A LDAP filter is not valid : " + e.getMessage()); - } catch (ClassNotFoundException e) { - m_handler.error("The implementation class of a component cannot be loaded : " + e.getMessage()); - } - } - - for (int i = 0; i < m_handler.getSpecifications().size(); i++) { - SpecificationMetadata spec = (SpecificationMetadata) m_handler.getSpecifications().get(i); - FieldMetadata field = new FieldMetadata(spec); - field.setName("_field" + index); - if (spec.isOptional()) { - field.setOptional(true); - } - if (spec.isAggregate()) { - field.setAggregate(true); - } - Mapping map = new Mapping(spec, field); - m_mappings.add(map); - index++; - } - } - - /** - * Build the delegation mapping. - * @throws CompositionException : occurs when the mapping cannot be inferred correctly - */ - protected void buildMapping() throws CompositionException { - buildAvailableMappingList(); - - // Dependency closure is OK, now look for method delegation - Map/* */svcMethods = new HashMap(); - Map/* */instMethods = new HashMap(); - - for (int i = 0; i < m_mappings.size(); i++) { - Mapping map = (Mapping) m_mappings.get(i); - SpecificationMetadata spec = map.getSpecification(); - for (int j = 0; j < spec.getMethods().size(); j++) { - MethodMetadata method = (MethodMetadata) spec.getMethods().get(j); - if (spec.isInterface()) { - svcMethods.put(method, map); - } else { - instMethods.put(method, map); - } - } - } - - // For each needed method, search if available and store the mapping - for (int j = 0; j < m_specification.getMethods().size(); j++) { - MethodMetadata method = (MethodMetadata) m_specification.getMethods().get(j); - Set keys = instMethods.keySet(); // Look first in methods contained in the glue code. - Iterator iterator = keys.iterator(); - boolean found = false; - while (iterator.hasNext() & !found) { - MethodMetadata met = (MethodMetadata) iterator.next(); - if (met.equals(method)) { - found = true; - FieldMetadata field = ((Mapping) instMethods.get(met)).getField(); - field.setUseful(true); - method.setDelegation(field); - } - } - if (!found) { // If not found looks inside method contained in services. - keys = svcMethods.keySet(); // Look first in methods contained in the glue code - iterator = keys.iterator(); - while (!found && iterator.hasNext()) { - MethodMetadata met = (MethodMetadata) iterator.next(); - if (met.equals(method)) { - found = true; - FieldMetadata field = ((Mapping) svcMethods.get(met)).getField(); - field.setUseful(true); - method.setDelegation(field); - // Test optional - if (field.isOptional() && !method.throwsUnsupportedOperationException()) { - m_handler.warn("The method " + method.getMethod().getName() + " could not be provided correctly : the specification " + field.getSpecification().getName() + " is optional"); - } - } - } - } - if (!found) { throw new CompositionException("Inconsistent composition - the method " + method.getMethod() + " could not be delegated"); } - } - } - - /** - * Build a service implementation. - * @return the byte[] of the POJO. - */ - protected byte[] buildPOJO() { - Class clazz = null; - try { - clazz = getBundleContext().getBundle().loadClass(m_specification.getName()); - } catch (ClassNotFoundException e1) { - // The class has already be loaded. - return null; - } - byte[] pojo = POJOWriter.dump(clazz, m_name, getFieldList(), getMethodList(), m_handler); - Manipulator manipulator = new Manipulator(this.getClass().getClassLoader()); - try { - manipulator.prepare(pojo); - byte[] newclazz = manipulator.manipulate(pojo); - m_manipulation = manipulator.getManipulationMetadata(); - return newclazz; - } catch (IOException e) { - m_handler.error("An error occurs during the composite implementation creation : " + e.getMessage(), e); - } - return null; - } - - /** - * Build service implementation metadata. - * @param name : name of the future instance (used to avoid cycle) - * @return Component Type metadata. - */ - protected Element buildMetadata(String name) { - Element elem = new Element("component", ""); - Attribute className = new Attribute("classname", m_name); - Attribute factory = new Attribute("public", "false"); - elem.addAttribute(className); - elem.addAttribute(factory); - - // Add architecture for debug - elem.addAttribute(new Attribute("architecture", "true")); - - // Provides - Element provides = new Element("provides", ""); - provides.addAttribute(new Attribute("specification", m_specification.getName())); - elem.addElement(provides); - - // Dependencies - List fields = getFieldList(); - for (int i = 0; i < fields.size(); i++) { - FieldMetadata field = (FieldMetadata) fields.get(i); - if (field.isUseful() && field.getSpecification().isInterface()) { - Element dep = new Element("requires", ""); - dep.addAttribute(new Attribute("field", field.getName())); - dep.addAttribute(new Attribute("scope", "composite")); - dep.addAttribute(new Attribute("proxy", "false")); - if (field.getSpecification().isOptional()) { - dep.addAttribute(new Attribute("optional", "true")); - } - dep.addAttribute(new Attribute("filter", "(!(instance.name=" + name + "))")); - elem.addElement(dep); - } - } - - Element properties = new Element("properties", ""); - for (int i = 0; i < fields.size(); i++) { - FieldMetadata field = (FieldMetadata) fields.get(i); - if (field.isUseful() && !field.getSpecification().isInterface()) { - Element prop = new Element("Property", ""); - prop.addAttribute(new Attribute("field", field.getName())); - properties.addElement(prop); - } - } - if (properties.getElements().length != 0) { - elem.addElement(properties); - } - - // Insert information to metadata - elem.addElement(m_manipulation); - - return elem; - } - - /** - * Get the field list to use for the delegation. - * @return the field list. - */ - public List getFieldList() { - List list = new ArrayList(); - for (int i = 0; i < m_mappings.size(); i++) { - Mapping map = (Mapping) m_mappings.get(i); - list.add(map.getField()); - } - return list; - } - - /** - * Get the method list contained in the implemented specification. - * @return the List of implemented method. - */ - private List getMethodList() { - return m_specification.getMethods(); - } - - /** - * Store links between Field and pointed Specification. - */ - private class Mapping { - - /** - * Specification. - */ - private SpecificationMetadata m_spec; - - /** - * Field. - */ - private FieldMetadata m_field; - - /** - * Constructor. - * @param spec : specification metadata. - * @param field : the field. - */ - public Mapping(SpecificationMetadata spec, FieldMetadata field) { - m_spec = spec; - m_field = field; - } - - public SpecificationMetadata getSpecification() { - return m_spec; - } - - public FieldMetadata getField() { - return m_field; - } - - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/FieldMetadata.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/FieldMetadata.java deleted file mode 100644 index 4df41a8581..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/FieldMetadata.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -/** - * Field used inside a composition. - * This class contains all information useful for the generation. - * @author Felix Project Team - */ -public class FieldMetadata { - - /** - * Name of the field. - */ - private String m_name; - - /** - * Is the field an array? - */ - private boolean m_isAggregate = false; - - /** - * Interface of the field. - */ - private SpecificationMetadata m_specification; - - /** - * Is the field useful in this composition. - */ - private boolean m_isUseful; - - /** - * Is the dependency for this field optional. - */ - private boolean m_isOptional = false; - - /** - * Constructor. - * @param specification : interface of the field. - */ - public FieldMetadata(SpecificationMetadata specification) { - super(); - this.m_specification = specification; - if (m_specification.isAggregate()) { - m_isAggregate = true; - } - } - - public boolean isAggregate() { - return m_isAggregate; - } - - public void setAggregate(boolean aggregate) { - m_isAggregate = aggregate; - } - - public String getName() { - return m_name; - } - - public void setName(String name) { - this.m_name = name; - } - - public SpecificationMetadata getSpecification() { - return m_specification; - } - - public void setSpecification(SpecificationMetadata specification) { - this.m_specification = specification; - } - - public boolean isUseful() { - return m_isUseful; - } - - public void setUseful(boolean useful) { - m_isUseful = useful; - } - - public boolean isOptional() { - return m_isOptional; - } - - public void setOptional(boolean opt) { - m_isOptional = opt; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java deleted file mode 100644 index 510514e32a..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/MethodMetadata.java +++ /dev/null @@ -1,138 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.lang.reflect.Method; - -/** - * Information on Method for the composition. - * @author Felix Project Team - */ -public class MethodMetadata { - - /** - * ONE POLICY. - */ - public static final int ONE_POLICY = 1; - - /** - * ALL POLICY. - */ - public static final int ALL_POLICY = 2; - - /** - * Method Object. - */ - private Method m_method; - - /** - * Delegation field. - */ - private FieldMetadata m_delegation; - - /** - * Delegation policy (default = ONE). - */ - private int m_policy = ONE_POLICY; - - /** - * Constructor. - * @param method : method object. - */ - public MethodMetadata(Method method) { - m_method = method; - } - - public Method getMethod() { - return m_method; - } - - public void setDelegation(FieldMetadata field) { - m_delegation = field; - } - - public FieldMetadata getDelegation() { - return m_delegation; - } - - /** - * Equals method. - * This method check if two MethodMetadata are equals or if the current MemethodMetadata is equals with a Method object. - * @param object : object. - * @return true if the current object and the given object are equals. - * @see java.lang.Object#equals(java.lang.Object) - */ - public boolean equals(Object object) { - if (object instanceof MethodMetadata) { - Method met = ((MethodMetadata) object).getMethod(); - return equals(met); - } - - if (object instanceof Method) { - Method met = (Method) object; - if (! met.getName().equals(m_method.getName()) || met.getParameterTypes().length != m_method.getParameterTypes().length) { - return false; - } - - for (int i = 0; i < m_method.getParameterTypes().length; i++) { - if (!m_method.getParameterTypes()[i].getName().equals(met.getParameterTypes()[i].getName())) { - return false; - } - } - - return true; - } - - return false; - } - - /** - * Hash code method. - * @return the parent hash code. - * @see java.lang.Object#hashCode() - */ - public int hashCode() { - return super.hashCode(); - } - - public int getPolicy() { - return m_policy; - } - - /** - * Activate the all policy for this method. - */ - public void setAllPolicy() { - m_policy = ALL_POLICY; - } - - /** - * Check if the method can throw UnsupportedOperationException. - * @return true if the method has declared the UnsupportedOperationException. - */ - protected boolean throwsUnsupportedOperationException() { - for (int i = 0; i < m_method.getExceptionTypes().length; i++) { - if (m_method.getExceptionTypes()[i].getName().equals(UnsupportedOperationException.class.getName())) { - return true; - } - } - return false; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java deleted file mode 100644 index ffca9c8e7d..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/POJOWriter.java +++ /dev/null @@ -1,323 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.lang.reflect.Method; -import java.util.List; - -import org.apache.felix.ipojo.Handler; -import org.objectweb.asm.ClassWriter; -import org.objectweb.asm.Label; -import org.objectweb.asm.MethodVisitor; -import org.objectweb.asm.Opcodes; -import org.objectweb.asm.Type; - -/** - * Create the Proxy class. - * - * @author Felix Project Team - */ -public class POJOWriter implements Opcodes { - - //TODO : merge this class with another class only static methods. - - /** - * Create a class. - * @param cw : class writer - * @param className : class name - * @param spec : implemented specification - */ - private static void createClass(ClassWriter cw, String className, String spec) { - // Create the class - cw.visit(V1_2, ACC_PUBLIC + ACC_SUPER, className, null, "java/lang/Object", new String[] { spec.replace('.', '/') }); - } - - /** - * Inject field in the current class. - * @param cw : class writer. - * @param fields : list of field to inject. - */ - private static void injectFields(ClassWriter cw, List fields) { - // Inject fields - for (int i = 0; i < fields.size(); i++) { - FieldMetadata field = (FieldMetadata) fields.get(i); - if (field.isUseful()) { - SpecificationMetadata spec = field.getSpecification(); - String fieldName = field.getName(); - String desc = ""; - if (field.isAggregate()) { - desc = "[L" + spec.getName().replace('.', '/') + ";"; - } else { - desc = "L" + spec.getName().replace('.', '/') + ";"; - } - - cw.visitField(Opcodes.ACC_PRIVATE, fieldName, desc, null, null); - } - } - } - - /** - * Generates an empty constructor. - * this constructor just call the java.lang.Object constructor. - * @param cw class writer - */ - private static void generateConstructor(ClassWriter cw) { - // Inject a constructor ()V - MethodVisitor cst = cw.visitMethod(ACC_PUBLIC, "", "()V", null, null); - cst.visitVarInsn(ALOAD, 0); - cst.visitMethodInsn(INVOKESPECIAL, "java/lang/Object", "", "()V"); - cst.visitInsn(RETURN); - cst.visitMaxs(0, 0); - cst.visitEnd(); - } - - /** - * Return the proxy 'classname' for the contract 'contractname' by delegating on available service. - * @param clazz : Specification class - * @param className : The class name to create - * @param fields : the list of fields on which delegate - * @param methods : the list of method on which delegate - * @param handler : handler object used to access the logger - * @return byte[] : the build class - */ - public static byte[] dump(Class clazz, String className, List fields, List methods, Handler handler) { - Method[] itfmethods = clazz.getMethods(); - - // Create the class - ClassWriter cw = new ClassWriter(ClassWriter.COMPUTE_MAXS); - className = className.replace('.', '/'); - createClass(cw, className, clazz.getName()); - - // Inject fields inside the POJO - injectFields(cw, fields); - - generateConstructor(cw); - - for (int i = 0; i < itfmethods.length; ++i) { - Method method = itfmethods[i]; - - // Get the field for this method - // 1) find the MethodMetadata - FieldMetadata delegator = null; // field to delegate - MethodMetadata methodDelegator = null; // field to delegate - for (int j = 0; j < methods.size(); j++) { - MethodMetadata methodMeta = (MethodMetadata) methods.get(j); - if (methodMeta.equals(method)) { - delegator = methodMeta.getDelegation(); - methodDelegator = methodMeta; - } - } - - generateMethod(cw, className, methodDelegator, method, delegator, handler); - - } - - // End process - cw.visitEnd(); - return cw.toByteArray(); - } - - /** - * Generate on method. - * @param cw : class writer - * @param className : the current class name - * @param method : the method to generate - * @param sign : method signature to generate - * @param delegator : the field on which delegate - * @param handler : the handler (used to acess the logger) - */ - private static void generateMethod(ClassWriter cw, String className, MethodMetadata method, Method sign, FieldMetadata delegator, Handler handler) { - String desc = Type.getMethodDescriptor(sign); - String name = sign.getName(); - String[] exc = new String[sign.getExceptionTypes().length]; - for (int i = 0; i < sign.getExceptionTypes().length; i++) { - exc[i] = Type.getType(sign.getExceptionTypes()[i]).getInternalName(); - } - - MethodVisitor mv = cw.visitMethod(ACC_PUBLIC, name, desc, null, exc); - - if (delegator.isOptional()) { - if (!delegator.isAggregate()) { - generateOptionalCase(mv, delegator, className); - } - if (delegator.isAggregate() /*&& method.getPolicy() == MethodMetadata.ONE_POLICY*/) { - generateOptionalAggregateCase(mv, delegator, className); - } - } - - if (delegator.isAggregate()) { - if (method.getPolicy() == MethodMetadata.ONE_POLICY) { - // Aggregate and One Policy - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "[L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - mv.visitInsn(ICONST_0); // Use the first one - mv.visitInsn(AALOAD); - - loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc)); - - // Invoke - mv.visitMethodInsn(INVOKEINTERFACE, delegator.getSpecification().getName().replace('.', '/'), name, desc); - - // Return - mv.visitInsn(Type.getReturnType(desc).getOpcode(Opcodes.IRETURN)); - - } else { // All policy - if (Type.getReturnType(desc).getSort() != Type.VOID) { - handler.error("All policy cannot be used on method which does not return void"); - } - - Type[] args = Type.getArgumentTypes(desc); - int index = args.length + 1; - - // Init - mv.visitInsn(ICONST_0); - mv.visitVarInsn(ISTORE, index); - Label l1b = new Label(); - mv.visitLabel(l1b); - Label l2b = new Label(); - mv.visitJumpInsn(GOTO, l2b); - - // Loop - Label l3b = new Label(); - mv.visitLabel(l3b); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "[L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - mv.visitVarInsn(ILOAD, index); - mv.visitInsn(AALOAD); - - loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc)); - - mv.visitMethodInsn(INVOKEINTERFACE, delegator.getSpecification().getName().replace('.', '/'), name, desc); - - Label l4b = new Label(); - mv.visitLabel(l4b); - mv.visitIincInsn(index, 1); // i++; - - // Condition - mv.visitLabel(l2b); - mv.visitVarInsn(ILOAD, index); - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "[L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - mv.visitInsn(ARRAYLENGTH); - mv.visitJumpInsn(IF_ICMPLT, l3b); - - Label l5b = new Label(); - mv.visitLabel(l5b); - mv.visitInsn(RETURN); - } - } else { - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - - loadArgs(mv, ACC_PUBLIC, Type.getArgumentTypes(desc)); - - // Invoke - if (delegator.getSpecification().isInterface()) { - mv.visitMethodInsn(INVOKEINTERFACE, delegator.getSpecification().getName().replace('.', '/'), name, desc); - } else { - mv.visitMethodInsn(INVOKEVIRTUAL, delegator.getSpecification().getName().replace('.', '/'), name, desc); - } - - // Return - mv.visitInsn(Type.getReturnType(desc).getOpcode(IRETURN)); - } - - mv.visitMaxs(0, 0); - mv.visitEnd(); - } - - /** - * Generate Optional Case for aggregate field. - * @param mv : method visitor - * @param delegator : Field on which delegate - * @param className : current class name - */ - private static void generateOptionalAggregateCase(MethodVisitor mv, FieldMetadata delegator, String className) { - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "[L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - mv.visitInsn(ARRAYLENGTH); - Label l1a = new Label(); - mv.visitJumpInsn(IFNE, l1a); - Label l2a = new Label(); - mv.visitLabel(l2a); - mv.visitTypeInsn(NEW, "java/lang/UnsupportedOperationException"); - mv.visitInsn(DUP); - mv.visitLdcInsn("Operation not supported"); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/UnsupportedOperationException", "", "(Ljava/lang/String;)V"); - mv.visitInsn(ATHROW); - mv.visitLabel(l1a); - } - - /** - * Generate Optional case for non aggregate fields. - * - * @param mv : the method visitor - * @param delegator : the field on which delegate. - * @param className : the name of the current class. - */ - private static void generateOptionalCase(MethodVisitor mv, FieldMetadata delegator, String className) { - mv.visitVarInsn(ALOAD, 0); - mv.visitFieldInsn(GETFIELD, className, delegator.getName(), "L" + delegator.getSpecification().getName().replace('.', '/') + ";"); - mv.visitTypeInsn(INSTANCEOF, "org/apache/felix/ipojo/Nullable"); - Label end = new Label(); - mv.visitJumpInsn(IFEQ, end); - Label begin = new Label(); - mv.visitLabel(begin); - mv.visitTypeInsn(NEW, "java/lang/UnsupportedOperationException"); - mv.visitInsn(DUP); - mv.visitLdcInsn("Operation not supported"); - mv.visitMethodInsn(INVOKESPECIAL, "java/lang/UnsupportedOperationException", "", "(Ljava/lang/String;)V"); - mv.visitInsn(ATHROW); - mv.visitLabel(end); - } - - /** - * Load on stack the method arguments. - * @param mv method visitor - * @param access access level of the method - * @param args argument types array - */ - private static void loadArgs(MethodVisitor mv, int access, Type[] args) { - int i = 0; - int j = args.length; - int k = getArgIndex(access, args, i); - for (int l = 0; l < j; l++) { - Type type = args[i + l]; - mv.visitVarInsn(type.getOpcode(ILOAD), k); - k += type.getSize(); - } - } - - /** - * Gets the index of the argument 'i'. - * This method manages double-spaces. - * @param access method access (mostly public) - * @param args argument type array - * @param i wanted index - * @return the real index - */ - private static int getArgIndex(int access, Type[] args, int i) { - int j = (access & 8) != 0 ? 0 : 1; - for (int k = 0; k < i; k++) { - j += args[k].getSize(); - } - return j; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedService.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedService.java deleted file mode 100644 index 05eb854699..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedService.java +++ /dev/null @@ -1,238 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.apache.felix.ipojo.composite.instance.InstanceHandler; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyMetadataHelper; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.DependencyStateListener; -import org.apache.felix.ipojo.util.Logger; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; - -/** - * Composite Provided Service. - * @author Felix Project Team - */ -public class ProvidedService implements DependencyStateListener { - - /** - * Composite Manager. - */ - private CompositeManager m_manager; - - /** - * Composition Model. - */ - private CompositionMetadata m_composition; - - /** - * Internal context. - */ - private ServiceContext m_scope; - - /** - * External context. - */ - private BundleContext m_context; - - /** - * Created Factory. - */ - private ComponentFactory m_factory; - - /** - * Created Instance. - */ - private ComponentInstance m_instance; - - /** - * Exporter. - */ - private ServiceExporter m_exports; - - /** - * Created instance name. - */ - private String m_instanceName; - - /** - * Constructor. - * The delegation mapping is infers in this method. - * @param handler : the handler. - * @param element : 'provides' element. - * @param name : name of this provided service. - */ - public ProvidedService(ProvidedServiceHandler handler, Element element, String name) { - m_manager = handler.getCompositeManager(); - m_scope = m_manager.getServiceContext(); - m_context = m_manager.getContext(); - m_composition = new CompositionMetadata(m_manager.getContext(), element, handler, name); - } - - /** - * Start method. - * Build service implementation type, factory and instance. - * @throws CompositionException if a consistent mapping cannot be discovered. - */ - public void start() throws CompositionException { - m_composition.buildMapping(); - - m_instanceName = m_composition.getSpecificationMetadata().getName() + "Provider-Gen"; - byte[] clazz = m_composition.buildPOJO(); - Element metadata = m_composition.buildMetadata(m_instanceName); - - // Create the factory - try { - m_factory = new ComponentFactory(m_context, clazz, metadata); - m_factory.setUseFactoryClassloader(true); - m_factory.start(); - } catch (ConfigurationException e) { - // Should not happen. - m_manager.getFactory().getLogger().log(Logger.ERROR, "A factory cannot be created", e); - } - - try { - Class spec = DependencyMetadataHelper.loadSpecification(m_composition.getSpecificationMetadata().getName(), m_context); - Filter filter = m_context.createFilter("(instance.name=" + m_instanceName + ")"); - // Create the exports - m_exports = new ServiceExporter(spec, filter, false, false, null, DependencyModel.DYNAMIC_BINDING_POLICY, m_scope, m_context, this, m_manager); - } catch (InvalidSyntaxException e) { - throw new CompositionException("A provided service filter is invalid", e); - } catch (ConfigurationException e) { - throw new CompositionException("The class " + m_composition.getSpecificationMetadata().getName() + " cannot be loaded", e); - } - } - - /** - * Stop the provided service. - * Kill the exporter, the instance and the factory. - */ - public void stop() { - if (m_exports != null) { - m_exports.stop(); - m_exports = null; - } - if (m_instance != null) { - m_instance.dispose(); - m_instance = null; - } - if (m_factory != null) { - m_factory.stop(); - m_factory = null; - } - } - - protected CompositeManager getManager() { - return m_manager; - } - - /** - * The exporter becomes valid. - * @param exporter : the exporter - */ - public void validate(DependencyModel exporter) { - // Nothing to do. - } - - /** - * The exporter becomes invalid. - * @param exporter : the exporter - */ - public void invalidate(DependencyModel exporter) { - // Nothing to do. - } - - /** - * Get an object from the given type. - * @param type : type - * @return an object from an instance of this type or null - */ - private Object getObjectByType(String type) { - InstanceHandler handler = (InstanceHandler) m_manager.getCompositeHandler("org.apache.felix.ipojo.composite.instance.InstanceHandler"); - Object pojo = handler.getObjectFromInstance(type); - if (pojo == null) { - m_manager.getFactory().getLogger().log(Logger.ERROR, "An instance object cannot be found for the type : " + type); - } - return pojo; - } - - public String getSpecification() { - return m_composition.getSpecificationMetadata().getName(); - } - - /** - * Unregister the exposed service. - */ - public void unregister() { - m_exports.stop(); - } - - /** - * Register the exposed service. - */ - public void register() { - Properties props = new Properties(); - props.put("instance.name", m_instanceName); - List fields = m_composition.getFieldList(); - for (int i = 0; i < fields.size(); i++) { - FieldMetadata field = (FieldMetadata) fields.get(i); - if (field.isUseful() && !field.getSpecification().isInterface()) { - String type = field.getSpecification().getComponentType(); - Object pojo = getObjectByType(type); - props.put(field.getName(), pojo); - } - } - - if (m_instance == null) { - // Else we have to create the instance - try { - m_instance = m_factory.createComponentInstance(props, m_manager.getServiceContext()); - } catch (UnacceptableConfiguration e) { - throw new IllegalStateException("Cannot create the service implementation", e); - } catch (MissingHandlerException e) { - throw new IllegalStateException("Cannot create the service implementation", e); - } catch (ConfigurationException e) { - throw new IllegalStateException("Cannot create the service implementation", e); - } - } else { - // We have to reconfigure the instance in order to inject up to date glue component instance. - m_instance.reconfigure(props); - } - - m_exports.start(); - } - - public boolean isRegistered() { - return m_exports.getState() == DependencyModel.RESOLVED; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java deleted file mode 100644 index fa47217bbf..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandler.java +++ /dev/null @@ -1,504 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.lang.reflect.Field; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Dictionary; -import java.util.List; -import java.util.Properties; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.HandlerManager; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.PolicyServiceContext; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.composite.instance.InstanceHandler; -import org.apache.felix.ipojo.composite.service.instantiator.ServiceDependencyHandler; -import org.apache.felix.ipojo.composite.service.instantiator.ServiceImporter; -import org.apache.felix.ipojo.composite.service.instantiator.SvcInstance; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.apache.felix.ipojo.util.DependencyMetadataHelper; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.DependencyStateListener; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -/** - * Composite Provided Service Handler. - * @author Felix Project Team - */ -public class ProvidedServiceHandler extends CompositeHandler implements DependencyStateListener { - - /** - * External context. - */ - private BundleContext m_context; - - /** - * List of "available" services in the internal context. - */ - private List m_services = new ArrayList(); - - /** - * List of exporters. - */ - private List m_exporters = new ArrayList(); - - /** - * List of managed services. - */ - private List m_managedServices = new ArrayList(); - - /** - * List of component type. - */ - private List m_types; - - /** - * Handler description. - */ - private ProvidedServiceHandlerDescription m_description; - - /** - * Initialize the component type. - * @param desc : component type description to populate. - * @param metadata : component type metadata. - * @throws ConfigurationException : metadata are incorrect. - * @see org.apache.felix.ipojo.Handler#initializeComponentFactory(org.apache.felix.ipojo.architecture.ComponentTypeDescription, org.apache.felix.ipojo.metadata.Element) - */ - public void initializeComponentFactory(ComponentTypeDescription desc, Element metadata) throws ConfigurationException { - Element[] provides = metadata.getElements("provides"); - for (int i = 0; i < provides.length; i++) { - String action = provides[i].getAttribute("action"); - if (action == null) { - throw new ConfigurationException("Invalid composition service providing : no specified action"); - } else if (action.equalsIgnoreCase("implement")) { - String spec = provides[i].getAttribute("specification"); - if (spec == null) { - throw new ConfigurationException("Malformed provides : the specification attribute is mandatory"); - } else { - desc.addProvidedServiceSpecification(spec); - } - } else if (action.equalsIgnoreCase("export")) { - String spec = provides[i].getAttribute("specification"); - if (spec == null) { - throw new ConfigurationException("Malformed exports - Missing the specification attribute"); - } else { - desc.addProvidedServiceSpecification(spec); - } - } else { - throw new ConfigurationException("Invalid composition service providing : unknown action " + action); - } - } - } - - /** - * Configure the handler. - * @param metadata : the metadata of the component - * @param configuration : the instance configuration - * @throws ConfigurationException : the exporter cannot be created - * @see CompositeHandler#configure(org.apache.felix.ipojo.metadata.Element, java.util.Dictionary) - */ - public void configure(Element metadata, Dictionary configuration) throws ConfigurationException { - m_context = getCompositeManager().getContext(); - - Element[] provides = metadata.getElements("provides", ""); - for (int i = 0; i < provides.length; i++) { - String action = provides[i].getAttribute("action"); - if (action.equalsIgnoreCase("implement")) { - ProvidedService svc = new ProvidedService(this, provides[i], Integer.toString(i)); - m_managedServices.add(svc); - } else if (action.equalsIgnoreCase("export")) { - boolean optional = false; - boolean aggregate = false; - String specification = provides[i].getAttribute("specification"); - - String filter = "(objectClass=" + specification + ")"; - - String opt = provides[i].getAttribute("optional"); - optional = opt != null && opt.equalsIgnoreCase("true"); - - String agg = provides[i].getAttribute("aggregate"); - aggregate = agg != null && agg.equalsIgnoreCase("true"); - - String givenFilter = provides[i].getAttribute("filter"); - if (givenFilter != null) { - filter = "(&" + filter + givenFilter + ")"; //NOPMD - } - - Filter fil = null; - try { - fil = m_context.createFilter(filter); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("An exporter filter is invalid " + filter, e); - } - - Comparator cmp = DependencyMetadataHelper.getComparator(provides[i], m_context); - int policy = DependencyMetadataHelper.getPolicy(provides[i]); - Class spec = DependencyMetadataHelper.loadSpecification(specification, m_context); - - ServiceExporter imp = new ServiceExporter(spec, fil, aggregate, optional, cmp, policy, getCompositeManager().getServiceContext(), m_context, this, getCompositeManager()); - m_exporters.add(imp); - } // Others case cannot happen. The test was already made during the factory initialization. - } - - m_description = new ProvidedServiceHandlerDescription(this, m_managedServices, m_exporters); - - } - - /** - * Start method. - * Start all managed provided service. - * @see org.apache.felix.ipojo.composite.CompositeHandler#start() - */ - public void start() { - // Compute imports and instances - computeAvailableServices(); - computeAvailableTypes(); - - for (int i = 0; i < m_managedServices.size(); i++) { - ProvidedService svc = (ProvidedService) m_managedServices.get(i); - try { - checkServiceSpecification(svc); - svc.start(); - } catch (CompositionException e) { - error("Cannot start the provided service handler", e); - setValidity(false); - return; - } - } - - for (int i = 0; i < m_exporters.size(); i++) { - ServiceExporter exp = (ServiceExporter) m_exporters.get(i); - exp.start(); - } - - isHandlerValid(); - } - - /** - * Stop method. - * Stop all managed provided service. - * @see org.apache.felix.ipojo.composite.CompositeHandler#stop() - */ - public void stop() { - for (int i = 0; i < m_managedServices.size(); i++) { - ProvidedService svc = (ProvidedService) m_managedServices.get(i); - svc.stop(); - } - - for (int i = 0; i < m_exporters.size(); i++) { - ServiceExporter exp = (ServiceExporter) m_exporters.get(i); - exp.stop(); - } - } - - /** - * Check the handler validity. - * @see org.apache.felix.ipojo.composite.CompositeHandler#isValid() - */ - private void isHandlerValid() { - for (int i = 0; i < m_exporters.size(); i++) { - ServiceExporter exp = (ServiceExporter) m_exporters.get(i); - if (exp.getState() != DependencyModel.RESOLVED) { - setValidity(false); - return; - } - } - - setValidity(true); - } - - /** - * Handler state changed. - * @param state : the new instance state. - * @see CompositeHandler#stateChanged(int) - */ - public void stateChanged(int state) { - if (state == ComponentInstance.INVALID) { - for (int i = 0; i < m_managedServices.size(); i++) { - ProvidedService svc = (ProvidedService) m_managedServices.get(i); - svc.unregister(); - } - return; - } - - // If the new state is VALID => register all the services - if (state == ComponentInstance.VALID) { - for (int i = 0; i < m_managedServices.size(); i++) { - ProvidedService svc = (ProvidedService) m_managedServices.get(i); - svc.register(); - } - return; - } - } - - /** - * Notify the handler that an exporter becomes invalid. - * - * @param exporter : the implicated exporter. - */ - public void invalidate(DependencyModel exporter) { - // An export is no more valid - if (getValidity()) { - setValidity(false); - } - - } - - /** - * Notify the handler that an exporter becomes valid. - * - * @param exporter : the implicated exporter. - */ - public void validate(DependencyModel exporter) { - // An import becomes valid - if (!getValidity()) { - isHandlerValid(); - } - } - - /** - * Build the list of available specification. - * @return the list of available specification. - */ - protected List getSpecifications() { - return m_services; - } - - /** - * Build the list of available specifications. - */ - private void computeAvailableServices() { - // Get instantiated services : - ServiceDependencyHandler handler = (ServiceDependencyHandler) getHandler(HandlerFactory.IPOJO_NAMESPACE + ":subservice"); - - for (int i = 0; handler != null && i < handler.getInstances().size(); i++) { - SvcInstance svc = (SvcInstance) handler.getInstances().get(i); - String itf = svc.getServiceSpecification(); - boolean agg = svc.isAggregate(); - boolean opt = svc.isOptional(); - - SpecificationMetadata specMeta = new SpecificationMetadata(itf, m_context, agg, opt, this); - m_services.add(specMeta); - } - - for (int i = 0; handler != null && i < handler.getRequirements().size(); i++) { - ServiceImporter imp = (ServiceImporter) handler.getRequirements().get(i); - String itf = imp.getSpecification().getName(); - boolean agg = imp.isAggregate(); - boolean opt = imp.isOptional(); - - SpecificationMetadata specMeta = new SpecificationMetadata(itf, m_context, agg, opt, this); - m_services.add(specMeta); - } - } - - /** - * Check composite requirement against service specification requirement is available. - * @param svc : the provided service to check - * @throws CompositionException : occurs if the specification field of the service specification cannot be analyzed correctly. - */ - private void checkServiceSpecification(ProvidedService svc) throws CompositionException { - try { - Class spec = m_context.getBundle().loadClass(svc.getSpecification()); - Field specField = spec.getField("specification"); - Object object = specField.get(null); - if (object instanceof String) { - Element specification = ManifestMetadataParser.parse((String) object); - Element[] reqs = specification.getElements("requires"); - for (int j = 0; reqs != null && j < reqs.length; j++) { - ServiceImporter imp = getAttachedRequirement(reqs[j]); - if (imp != null) { - // Fix service-level dependency flag - imp.setServiceLevelDependency(); - } - checkRequirement(imp, reqs[j]); - } - } else { - error("[" + getCompositeManager().getInstanceName() + "] The specification field of the service specification " + svc.getSpecification() + " needs to be a String"); - throw new CompositionException("Service Specification checking failed : The specification field of the service specification " + svc.getSpecification() + " needs to be a String"); - } - } catch (NoSuchFieldException e) { - return; // No specification field - } catch (ClassNotFoundException e) { - error("[" + getCompositeManager().getInstanceName() + "] The service specification " + svc.getSpecification() + " cannot be load"); - throw new CompositionException("The service specification " + svc.getSpecification() + " cannot be loaded", e); - } catch (IllegalArgumentException e) { - error("[" + getCompositeManager().getInstanceName() + "] The field 'specification' of the service specification " + svc.getSpecification() + " is not accessible : " + e.getMessage()); - throw new CompositionException("The field 'specification' of the service specification " + svc.getSpecification() + " is not accessible", e); - } catch (IllegalAccessException e) { - error("[" + getCompositeManager().getInstanceName() + "] The field 'specification' of the service specification " + svc.getSpecification() + " is not accessible : " + e.getMessage()); - throw new CompositionException("The field 'specification' of the service specification " + svc.getSpecification() + " is not accessible", e); - } catch (ParseException e) { - error("[" + getCompositeManager().getInstanceName() + "] The field 'specification' of the service specification " + svc.getSpecification() + " does not contain a valid String : " + e.getMessage()); - throw new CompositionException("The field 'specification' of the service specification " + svc.getSpecification() + " does not contain a valid String", e); - } - } - - /** - * Look for the implementation (i.e. composite) requirement for the given service-level requirement metadata. - * @param element : the service-level requirement metadata - * @return the ServiceImporter object, null if not found or if the DependencyHandler is not plugged to the instance - */ - private ServiceImporter getAttachedRequirement(Element element) { - ServiceDependencyHandler handler = (ServiceDependencyHandler) getHandler(HandlerFactory.IPOJO_NAMESPACE + ":subservice"); - if (handler == null) { return null; } - - String identity = element.getAttribute("id"); - if (identity != null) { - // Look for dependency Id - for (int i = 0; i < handler.getRequirements().size(); i++) { - ServiceImporter imp = (ServiceImporter) handler.getRequirements().get(i); - if (imp.getId().equals(identity)) { return imp; } - } - } - - // If not found or no id, look for a dependency with the same specification - String requirement = element.getAttribute("specification"); - for (int i = 0; i < handler.getRequirements().size(); i++) { - ServiceImporter imp = (ServiceImporter) handler.getRequirements().get(i); - if (imp.getId().equals(requirement) || imp.getSpecification().getName().equals(requirement)) { return imp; } - } - return null; - } - - /** - * Check the correctness of the composite requirement against the service level dependency. - * @param imp : requirement to check - * @param elem : service-level dependency metadata - * @throws CompositionException : occurs if the requirement does not match with service-level specification requirement - */ - private void checkRequirement(ServiceImporter imp, Element elem) throws CompositionException { - String optional = elem.getAttribute("optional"); - boolean opt = optional != null && optional.equalsIgnoreCase("true"); - - String aggregate = elem.getAttribute("aggregate"); - boolean agg = aggregate != null && aggregate.equalsIgnoreCase("true"); - - if (imp == null) { - // Add the missing requirement - ServiceDependencyHandler handler = (ServiceDependencyHandler) getHandler(HandlerFactory.IPOJO_NAMESPACE + ":subservice"); - if (handler == null) { - // Look for the ServiceDependencyHandler factory - HandlerManager handlerManager = null; - try { - ServiceReference[] refs = m_context.getServiceReferences(Factory.class.getName(), "(&(handler.name=subservice)(handler.namespace=" + HandlerFactory.IPOJO_NAMESPACE + ")(handler.type=composite))"); - Factory factory = (Factory) m_context.getService(refs[0]); - handlerManager = (HandlerManager) factory.createComponentInstance(null, getCompositeManager().getServiceContext()); - } catch (InvalidSyntaxException e) { - // Should not happen - } catch (UnacceptableConfiguration e) { - // Should not happen - } catch (MissingHandlerException e) { - // Should not happen - } catch (ConfigurationException e) { - // Should not happen - } - - // Add the required handler - try { - handlerManager.init(getCompositeManager(), new Element("composite", ""), new Properties()); - } catch (ConfigurationException e) { - error("Internal error : cannot configure the Import Handler : " + e.getMessage()); - throw new CompositionException("Internal error : cannot configure the Import Handler", e); - } - handler = (ServiceDependencyHandler) handlerManager.getHandler(); - getCompositeManager().addCompositeHandler(handlerManager); - } - - String spec = elem.getAttribute("specification"); - String filter = "(&(objectClass=" + spec + ")(!(instance.name=" + getCompositeManager().getInstanceName() + ")))"; // Cannot import yourself - String givenFilter = elem.getAttribute("filter"); - if (givenFilter != null) { - filter = "(&" + filter + givenFilter + ")"; //NOPMD - } - - BundleContext context = new PolicyServiceContext(getCompositeManager().getGlobalContext(), getCompositeManager().getParentServiceContext(), PolicyServiceContext.GLOBAL); - - Filter fil = null; - try { - fil = getCompositeManager().getGlobalContext().createFilter(filter); - } catch (InvalidSyntaxException e) { - throw new CompositionException("A required filter " + filter + " is malformed", e); - } - - Class specToImport = null; - try { - specToImport = getCompositeManager().getGlobalContext().getBundle().loadClass(spec); - } catch (ClassNotFoundException e) { - throw new CompositionException("A required specification cannot be loaded : " + spec, e); - } - - ServiceImporter importer = new ServiceImporter(specToImport, fil, agg, opt, null, DependencyModel.DYNAMIC_BINDING_POLICY, context, null, handler); - - handler.getRequirements().add(importer); - SpecificationMetadata specMeta = new SpecificationMetadata(spec, m_context, agg, opt, this); - m_services.add(specMeta); // Update the available types - return; - } - - if (imp.isAggregate() && !agg) { - error("[" + getCompositeManager().getInstanceName() + "] The requirement " + elem.getAttribute("specification") + " is aggregate in the implementation and is declared as a simple service-level requirement"); - throw new CompositionException("The requirement " + elem.getAttribute("specification") + " is aggregate in the implementation and is declared as a simple service-level requirement"); - } - - String filter = elem.getAttribute("filter"); - if (filter != null) { - String filter2 = imp.getFilter(); - if (filter2 == null || !filter2.equalsIgnoreCase(filter)) { - error("[" + getCompositeManager().getInstanceName() + "] The specification requirement " + elem.getAttribute("specification") + " as not the same filter as declared in the service-level requirement"); - throw new CompositionException("The specification requirement " + elem.getAttribute("specification") + " as not the same filter as declared in the service-level requirement"); - } - } - } - - public HandlerDescription getDescription() { - return m_description; - } - - /** - * Build available instance types. - */ - private void computeAvailableTypes() { - InstanceHandler handler = (InstanceHandler) getHandler(HandlerFactory.IPOJO_NAMESPACE + ":instance"); - if (handler == null) { - m_types = new ArrayList(); - } else { - m_types = handler.getUsedType(); - } - } - - public List getInstanceType() { - return m_types; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandlerDescription.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandlerDescription.java deleted file mode 100644 index 5c22246174..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ProvidedServiceHandlerDescription.java +++ /dev/null @@ -1,96 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.util.ArrayList; -import java.util.List; - -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.composite.CompositeHandler; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.util.DependencyModel; - -/** - * Provided Service Handler Description for composite. - * - * @author Felix Project Team - */ -public class ProvidedServiceHandlerDescription extends HandlerDescription { - - /** - * Provided Service Description list. - */ - private List m_services = new ArrayList(); - - /** - * List of exports. - */ - private List m_exports; - - /** - * Constructor. - * - * @param handler : composite handler. - * @param services : The list of Provided Service. - * @param exporters : list of managed exports - */ - public ProvidedServiceHandlerDescription(CompositeHandler handler, List services, List exporters) { - super(handler); - m_services = services; - m_exports = exporters; - } - - /** - * Get the handler description. - * @return the provided service handler description - * @see org.apache.felix.ipojo.architecture.HandlerDescription#getHandlerInfo() - */ - public Element getHandlerInfo() { - Element services = super.getHandlerInfo(); - for (int i = 0; i < m_services.size(); i++) { - ProvidedService svc = (ProvidedService) m_services.get(i); - Element service = new Element("service", ""); - String state = "unregistered"; - if (svc.isRegistered()) { - state = "registered"; - } - String spec = "[" + svc.getSpecification() + "]"; - service.addAttribute(new Attribute("Specification", spec)); - service.addAttribute(new Attribute("State", state)); - services.addElement(service); - } - - for (int i = 0; i < m_exports.size(); i++) { - ServiceExporter exp = (ServiceExporter) m_exports.get(i); - Element expo = new Element("Exports", ""); - expo.addAttribute(new Attribute("Specification", exp.getSpecification().getName())); - expo.addAttribute(new Attribute("Filter", exp.getFilter())); - if (exp.getState() == DependencyModel.RESOLVED) { - expo.addAttribute(new Attribute("State", "resolved")); - } else { - expo.addAttribute(new Attribute("State", "unresolved")); - } - services.addElement(expo); - } - - return services; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ServiceExporter.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ServiceExporter.java deleted file mode 100644 index bb0b14f406..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/ServiceExporter.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.util.Comparator; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Properties; -import java.util.Set; - -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.DependencyStateListener; -import org.apache.felix.ipojo.util.SecurityHelper; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Filter; -import org.osgi.framework.ServiceReference; -import org.osgi.framework.ServiceRegistration; - -/** - * Export an service from the scope to the parent context. - * @author Felix Project Team - */ -public class ServiceExporter extends DependencyModel { - - /** - * Destination context. - */ - private BundleContext m_destination; - - /** - * Composite Manager. - */ - private CompositeManager m_manager; - - /** - * Map of service reference - service registration storing exported services. - */ - private Map/**/m_registrations = new HashMap(); - - /** - * Constructor. - * - * @param specification : exported service specification. - * @param filter : LDAP filter - * @param multiple : is the export an aggregate export? - * @param optional : is the export optional? - * @param cmp : comparator to use in the dependency - * @param policy : binding policy. - * @param from : internal service context - * @param dest : parent bundle context - * @param listener : dependency lifecycle listener to notify when the dependency state change. - * @param manager : composite manager - */ - public ServiceExporter(Class specification, Filter filter, boolean multiple, boolean optional, Comparator cmp, int policy, ServiceContext from, BundleContext dest, DependencyStateListener listener, CompositeManager manager) { - super(specification, multiple, optional, filter, cmp, policy, from, listener, manager); - - m_destination = dest; - - m_manager = manager; - - } - - /** - * Transform service reference property in a dictionary. - * instance.name and factory.name are injected too. - * @param ref : the service reference. - * @return the dictionary containing all property of the given service reference. - */ - private Dictionary getProps(ServiceReference ref) { - Properties prop = new Properties(); - String[] keys = ref.getPropertyKeys(); - for (int i = 0; i < keys.length; i++) { - prop.put(keys[i], ref.getProperty(keys[i])); - } - - prop.put("instance.name", m_manager.getInstanceName()); - prop.put("factory.name", m_manager.getFactory().getName()); - - return prop; - } - - /** - * Stop an exporter. - * Remove the service listener - * Unregister all exported services. - */ - public void stop() { - super.stop(); - Set refs = m_registrations.keySet(); - Iterator iterator = refs.iterator(); - while (iterator.hasNext()) { - ServiceReference ref = (ServiceReference) iterator.next(); - ServiceRegistration reg = (ServiceRegistration) m_registrations.get(ref); - try { - reg.unregister(); - } catch (IllegalStateException e) { - // The service is already unregistered - // Do nothing silently - } - } - m_registrations.clear(); - } - - /** - * A service has been injected. Register it. - * @param reference : the new reference. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference) - */ - public void onServiceArrival(ServiceReference reference) { - Object svc = getService(reference); - // Security Check - if (SecurityHelper.hasPermissionToRegisterService(getSpecification().getName(), m_destination)) { - ServiceRegistration reg = m_destination - .registerService(getSpecification().getName(), svc, getProps(reference)); - m_registrations.put(reference, reg); - } else { - throw new SecurityException("The bundle " + m_destination.getBundle().getBundleId() + " does not have the " - + "permission to register the service " + getSpecification().getName()); - } - } - - /** - * An exported service was modified. - * @param reference : modified reference - * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void onServiceModification(ServiceReference reference) { - ServiceRegistration reg = (ServiceRegistration) m_registrations.get(reference); - if (reg != null) { - reg.setProperties(getProps(reference)); - } - } - - /** - * An exported service disappears. - * @param reference : service reference - * @see org.apache.felix.ipojo.util.TrackerCustomizer#removedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void onServiceDeparture(ServiceReference reference) { - ServiceRegistration reg = (ServiceRegistration) m_registrations.get(reference); - if (reg != null) { - reg.unregister(); - } - m_registrations.remove(reference); - } - - /** - * On Dependency Reconfiguration notification method. - * @param departs : leaving service references. - * @param arrivals : new injected service references. - * @see org.apache.felix.ipojo.util.DependencyModel#onDependencyReconfiguration(org.osgi.framework.ServiceReference[], org.osgi.framework.ServiceReference[]) - */ - public void onDependencyReconfiguration(ServiceReference[] departs, ServiceReference[] arrivals) { - throw new UnsupportedOperationException("Dynamic dependency reconfiguration is not supported by service exporter"); - } -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java deleted file mode 100644 index 392de877da..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/service/provides/SpecificationMetadata.java +++ /dev/null @@ -1,158 +0,0 @@ -/* - * 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.ipojo.composite.service.provides; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.List; - -import org.osgi.framework.BundleContext; - -/** - * Represent a service specification. - * @author Felix Project Team - */ -public class SpecificationMetadata { - - /** - * Name of the specification, i.e. name of the interface. - */ - private String m_name; - - /** - * List of the method contained in the specification. - */ - private List/* */m_methods = new ArrayList/* */(); - - /** - * Is the specification an aggregate? - */ - private boolean m_isAggregate; - - /** - * Is the specification optional? - */ - private boolean m_isOptional = false; - - /** - * Is the specification an interface? - */ - private boolean m_isInterface = true; - - /** - * Component Type. - */ - private String m_componentType = null; - - /** - * Reference on the handler. - */ - private ProvidedServiceHandler m_handler; - - /** - * Constructor. - * @param name : specification name. - * @param context : bundle context. - * @param isAggregate : is the specification aggregate. - * @param isOptional : is the specification optional. - * @param psd : the handler. - */ - public SpecificationMetadata(String name, BundleContext context, boolean isAggregate, boolean isOptional, ProvidedServiceHandler psd) { - m_name = name; - m_handler = psd; - - // Populate methods : - try { - Class clazz = context.getBundle().loadClass(name); - Method[] methods = clazz.getMethods(); - for (int i = 0; i < methods.length; i++) { - MethodMetadata method = new MethodMetadata(methods[i]); - m_methods.add(method); - } - } catch (ClassNotFoundException e) { - m_handler.error("Cannot open " + name + " : " + e.getMessage()); - return; - } - - m_isAggregate = isAggregate; - m_isOptional = isOptional; - } - - /** - * Constructor. - * @param clazz : class - * @param type : component type - * @param psd : the parent handler - */ - public SpecificationMetadata(Class clazz, String type, ProvidedServiceHandler psd) { - m_handler = psd; - m_isAggregate = false; - m_isOptional = false; - m_componentType = type; - m_name = clazz.getName(); - Method[] methods = clazz.getMethods(); - for (int i = 0; i < methods.length; i++) { - MethodMetadata method = new MethodMetadata(methods[i]); - m_methods.add(method); - } - m_isInterface = false; - } - - public String getName() { - return m_name; - } - - public List/* */getMethods() { - return m_methods; - } - - /** - * Get a method by its name. - * @param name : method name - * @return the method metadata contained in the current specification with the given name. Null if the method is not found. - */ - public MethodMetadata getMethodByName(String name) { - for (int i = 0; i < m_methods.size(); i++) { - MethodMetadata met = (MethodMetadata) m_methods.get(i); - if (met.getMethod().getName().equals(name)) { return met; } - } - return null; - } - - public boolean isAggregate() { - return m_isAggregate; - } - - public boolean isOptional() { - return m_isOptional; - } - - public boolean isInterface() { - return m_isInterface; - } - - public void setIsOptional(boolean optional) { - m_isOptional = optional; - } - - public String getComponentType() { - return m_componentType; - } - -} diff --git a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/util/SourceManager.java b/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/util/SourceManager.java deleted file mode 100644 index b04b2dff6e..0000000000 --- a/ipojo/runtime/composite/src/main/java/org/apache/felix/ipojo/composite/util/SourceManager.java +++ /dev/null @@ -1,376 +0,0 @@ -/* - * 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.ipojo.composite.util; - -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.List; - -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.ContextListener; -import org.apache.felix.ipojo.ContextSource; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.apache.felix.ipojo.util.DependencyModel; -import org.apache.felix.ipojo.util.Tracker; -import org.apache.felix.ipojo.util.TrackerCustomizer; -import org.osgi.framework.BundleContext; -import org.osgi.framework.Constants; -import org.osgi.framework.Filter; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -/** - * This class manages context-source management. - * @author Felix Project Team - */ -public class SourceManager implements ContextListener { - - /** - * Source Name service property. - */ - public static final String SOURCE_NAME = "source.name"; - - /** - * Managed dependency. - */ - private DependencyModel m_dependency; - - /** - * List of monitored context sources. - */ - private List/* */m_sources = new ArrayList(1); - - /** - * PRoperties contained in the original filter. - */ - private String[] m_properties; - - /** - * Original filter (containing variables). - */ - private String m_filter; - - /** - * Bundle context. - */ - private BundleContext m_context; - - /** - * Service Tracker List. - */ - private List/**/m_trackers = new ArrayList(1); - - /** - * Constructor. - * @param sources : context-source attribute from the dependency metadata - * @param depfilter : original dependency filter - * @param dependency : dependency object - * @param manager : composite manager - * @throws ConfigurationException : the sources are incorrect. - */ - public SourceManager(String sources, String depfilter, DependencyModel dependency, CompositeManager manager) throws ConfigurationException { - m_filter = depfilter; - m_properties = getProperties(depfilter); - m_dependency = dependency; - m_context = manager.getGlobalContext(); - if (manager.getParentServiceContext() == null) { - // The parent is the global context - parseSources(sources, manager.getGlobalContext(), manager.getGlobalContext(), manager.getServiceContext()); - } else { - parseSources(sources, manager.getGlobalContext(), manager.getParentServiceContext(), manager.getServiceContext()); - } - } - - /** - * Start the context management. - */ - public void start() { - for (int i = 0; i < m_trackers.size(); i++) { - ((SourceTracker) m_trackers.get(i)).open(); - } - computeFilter(); - } - - /** - * Stop the context management. - */ - public void stop() { - for (int i = 0; i < m_trackers.size(); i++) { - ((SourceTracker) m_trackers.get(i)).close(); - } - setFilter(m_filter); - m_sources.clear(); - } - - /** - * Get the state of this source manager. - * @return the state of this source manager. - */ - public int getState() { - if (m_sources.isEmpty()) { - return DependencyModel.UNRESOLVED; - } else { - return DependencyModel.RESOLVED; - } - } - - /** - * Set the filter of the managed dependency. - * @param filter : the new filter to apply - */ - private void setFilter(String filter) { - if (!filter.equals(m_dependency.getFilter())) { - // Reconfigure - try { - m_dependency.setFilter(m_context.createFilter(filter)); - } catch (InvalidSyntaxException e) { - throw new IllegalStateException("A context filter is invalid : " + filter, e); - } - } - } - - /** - * Compute the new filter. - */ - private void computeFilter() { - String fil = m_filter; - synchronized (this) { - for (int i = 0; i < m_sources.size(); i++) { - Dictionary props = ((ContextSource) m_sources.get(i)).getContext(); - fil = substitute(fil, props); //NOPMD - } - } - if (!fil.equals(m_dependency.getFilter())) { - setFilter(fil); - } - } - - /** - * This method substitute ${var} substring by values stored in a map. - * @param str : string with variables - * @param values : dictionary containing the variable name and the value. - * @return resulted string - */ - public static String substitute(String str, Dictionary values) { - int len = str.length(); - StringBuffer buffer = new StringBuffer(len); - - int prev = 0; - int start = str.indexOf("${"); - int end = str.indexOf('}', start); - while (start != -1 && end != -1) { - String key = str.substring(start + 2, end); - Object value = values.get(key); - if (value == null) { - buffer.append(str.substring(prev, end + 1)); - } else { - buffer.append(str.substring(prev, start)); - buffer.append(value); - } - prev = end + 1; - if (prev >= str.length()) { - break; - } - - start = str.indexOf("${", prev); - if (start != -1) { - end = str.indexOf('}', start); - } - } - - buffer.append(str.substring(prev)); - - return buffer.toString(); - } - - /** - * Compute the properties (${name}) from the given filter. - * @param str : string form of the filter. - * @return the list of found properties. - */ - public static String[] getProperties(String str) { - List list = new ArrayList(); - int prev = 0; - int start = str.indexOf("${"); - int end = str.indexOf('}', start); - while (start != -1 && end != -1) { - String key = str.substring(start + 2, end); - list.add(key); - prev = end + 1; - if (prev >= str.length()) { - break; - } - - start = str.indexOf("${", prev); - if (start != -1) { - end = str.indexOf('}', start); - } - } - - return (String[]) list.toArray(new String[list.size()]); - } - - /** - * A context source has modified a monitored property. - * @param source : source - * @param property : modified property - * @param value : new value. - * @see org.apache.felix.ipojo.ContextListener#update(org.apache.felix.ipojo.ContextSource, java.lang.String, java.lang.Object) - */ - public synchronized void update(ContextSource source, String property, Object value) { - computeFilter(); - } - - /** - * Parse the context-source attribute in order to create source tracker object. - * @param sourceAtt : context-source attribute. - * @param global : global bundle context. - * @param parent : parent bundle context. - * @param local : local bundle context. - * @throws ConfigurationException : the context-source attribute is invalid. - */ - private void parseSources(String sourceAtt, BundleContext global, BundleContext parent, BundleContext local) throws ConfigurationException { - String[] sources = ParseUtils.split(sourceAtt, ","); - for (int i = 0; i < sources.length; i++) { - String[] srcs = ParseUtils.split(sources[i], ":"); - if (srcs.length == 1) { - // No prefix use local. //TODO choose default case. - SourceTracker tracker = new SourceTracker(srcs[0], local); - m_trackers.add(tracker); - } else if (srcs.length == 2) { - // According to prefix add the source in the good list. - if (srcs[0].equalsIgnoreCase("parent")) { - SourceTracker tracker = new SourceTracker(srcs[1], parent); - m_trackers.add(tracker); - } else if (srcs[0].equalsIgnoreCase("local")) { - SourceTracker tracker = new SourceTracker(srcs[1], local); - m_trackers.add(tracker); - } else if (srcs[0].equalsIgnoreCase("global")) { - SourceTracker tracker = new SourceTracker(srcs[1], global); - m_trackers.add(tracker); - } else { - throw new ConfigurationException("Unknowns context scope : " + srcs[0]); - } - } else { - throw new ConfigurationException("Malformed context source : " + sources[i]); - } - } - } - - /** - * A context source appears. - * @param source : new context source. - */ - private void addContextSource(ContextSource source) { - m_sources.add(source); - computeFilter(); - source.registerContextListener(this, m_properties); - } - - /** - * A context source disappears. - * @param source : leaving context source. - */ - private void removeContextSource(ContextSource source) { - m_sources.remove(source); - computeFilter(); - } - - private class SourceTracker implements TrackerCustomizer { - - /** - * Service tracker. - */ - private Tracker m_tracker; - - /** - * Constructor. - * @param name : name of the required context-source. - * @param countext : bundle context to use. - * @throws ConfigurationException : the context-source name is invalid. - */ - public SourceTracker(String name, BundleContext countext) throws ConfigurationException { - String fil = "(&(" + Constants.OBJECTCLASS + "=" + ContextSource.class.getName() + ")(" + SOURCE_NAME + "=" + name + "))"; - try { - Filter filter = countext.createFilter(fil); - m_tracker = new Tracker(countext, filter, this); - } catch (InvalidSyntaxException e) { - throw new ConfigurationException("A Context source filter is invalid " + fil, e); - } - } - - /** - * Open the tracker. - */ - public void open() { - m_tracker.open(); - } - - /** - * Close the tracker. - */ - public void close() { - m_tracker.close(); - } - - /** - * A new context-source was added. - * This method inject the context-source object in the source manager. - * @param reference : service reference. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addedService(org.osgi.framework.ServiceReference) - */ - public void addedService(ServiceReference reference) { - addContextSource((ContextSource) m_tracker.getService(reference)); - } - - /** - * A new context-source is adding in the tracker.. - * @param reference : service reference - * @return true. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#addingService(org.osgi.framework.ServiceReference) - */ - public boolean addingService(ServiceReference reference) { - return true; - } - - /** - * A used context-source is modified. - * @param reference : service reference. - * @param service : service object. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void modifiedService(ServiceReference reference, Object service) { - // Nothing to do. - } - - /** - * A used context-source disappears. - * This method notify the Source Manager in order to manage this departure. - * @param reference : service reference. - * @param service : service object. - * @see org.apache.felix.ipojo.util.TrackerCustomizer#modifiedService(org.osgi.framework.ServiceReference, java.lang.Object) - */ - public void removedService(ServiceReference reference, Object service) { - removeContextSource((ContextSource) service); - } - - } - -} diff --git a/ipojo/runtime/composite/src/main/resources/composite.xsd b/ipojo/runtime/composite/src/main/resources/composite.xsd deleted file mode 100644 index 2d01df1ced..0000000000 --- a/ipojo/runtime/composite/src/main/resources/composite.xsd +++ /dev/null @@ -1,147 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/composite/src/main/resources/metadata.xml b/ipojo/runtime/composite/src/main/resources/metadata.xml deleted file mode 100644 index 13b21639a2..0000000000 --- a/ipojo/runtime/composite/src/main/resources/metadata.xml +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-api-test/pom.xml b/ipojo/runtime/core-it/ipojo-api-test/pom.xml deleted file mode 100644 index a29cc85df3..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - ../pom.xml - - - 4.0.0 - - ipojo-api-test - - ${project.artifactId} - - - - org.apache.felix - org.apache.felix.ipojo.composite - 1.12.2-SNAPSHOT - - - - org.apache.felix - org.apache.felix.ipojo.api - 1.12.2-SNAPSHOT - - - - org.apache.felix - org.apache.felix.ipojo.handler.whiteboard - 1.4.0 - test - - - org.apache.felix - org.osgi.core - - - org.apache.felix - org.apache.felix.ipojo - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/FooImpl.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/FooImpl.java deleted file mode 100644 index 8e396d6a5b..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/FooImpl.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.components; - -import org.apache.felix.ipojo.runtime.core.api.services.Foo; - -public class FooImpl implements Foo { - - // private List m_list = new ArrayList(); - - public void doSomething() { - // Do something... - System.out.println("Hello World !"); - } - - public FooImpl(String s) { - _setIM(s); - } - - public void _setIM(String s) { - - } - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/HostImpl.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/HostImpl.java deleted file mode 100644 index ab75f87a87..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/HostImpl.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.components; - -import org.osgi.framework.ServiceReference; - -public class HostImpl { - - public void arrival(ServiceReference ref) { - - } - - public void departure(ServiceReference ref) { - - } - - public void modification(ServiceReference ref) { - - } - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyComponentImpl.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyComponentImpl.java deleted file mode 100644 index a07feb8950..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyComponentImpl.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.runtime.core.api.services.Foo; - -/** - * This class is marked as a component to be manipulated. - */ -@Component(name="do-not-use-this-factory", public_factory = false) -public class MyComponentImpl { - - private Foo myFoo; - - private int anInt; - - public MyComponentImpl() { - anInt = 2; - } - - public MyComponentImpl(int i) { - anInt = i; - } - - public void start() { - myFoo.doSomething(); - if (anInt > 0) { - System.out.println("Set int to " + anInt); - } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyServiceImpl.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyServiceImpl.java deleted file mode 100644 index 7973ed7cb0..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/MyServiceImpl.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.components; - -import org.apache.felix.ipojo.runtime.core.api.services.MyService; - -public class MyServiceImpl implements MyService { - public double compute(double value) { - return Math.exp(value * Math.cosh(value)); - } -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/PlainHelloImpl.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/PlainHelloImpl.java deleted file mode 100755 index 79f29bc30f..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/components/PlainHelloImpl.java +++ /dev/null @@ -1,46 +0,0 @@ -/* -* 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.ipojo.runtime.core.api.components; - -import org.apache.felix.ipojo.runtime.core.api.services.PlainHello; - - -public class PlainHelloImpl implements PlainHello { - - public void sayHello() { - System.out.println("Plainly Hello :D"); - - } - - public PlainHelloImpl() { - System.out.println("in constructor"); - } - - - public void start() { - - System.out.println("Hello, this is the plain hello component start method"); - } - - public void stop() { - System.out.println("Bye, this is the plain hello component stop method"); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/BarService.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/BarService.java deleted file mode 100644 index faa9f38f86..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/BarService.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.services; - -public interface BarService { - - public void doSomethingWithBar(); - - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/Foo.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/Foo.java deleted file mode 100644 index 719b2fdb78..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/Foo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.services; - -public interface Foo { - - - public void doSomething(); - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/MyService.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/MyService.java deleted file mode 100644 index ed24f45727..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/MyService.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.ipojo.runtime.core.api.services; - -public interface MyService { - double compute(double value); -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/PlainHello.java b/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/PlainHello.java deleted file mode 100755 index 1f07468de9..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/main/java/org/apache/felix/ipojo/runtime/core/api/services/PlainHello.java +++ /dev/null @@ -1,24 +0,0 @@ -/* -* 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.ipojo.runtime.core.api.services; - -public interface PlainHello { - public void sayHello(); - -} \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Common.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Common.java deleted file mode 100644 index df7c11590f..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Common.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ServiceContext; -import org.apache.felix.ipojo.composite.CompositeManager; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; - -/** - * Bootstrap the test from this project - */ -@ExamReactorStrategy(PerMethod.class) -public class Common extends BaseTest { - - public static ServiceContext getServiceContext(ComponentInstance ci) { - if (ci instanceof CompositeManager) { - return ((CompositeManager) ci).getServiceContext(); - } else { - throw new RuntimeException("Cannot get the service context from a non composite instance"); - } - } - - @Override - public boolean deployiPOJOComposite() { - return true; - } - - @Override - public boolean deployConfigAdmin() { - return true; - } - - @Override - protected Option[] getCustomOptions() { - return new Option[]{ - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.whiteboard").versionAsInProject(), - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.api").versionAsInProject() - }; - } - - @Override - protected List getExtraExports() { - return Arrays.asList( - "org.apache.felix.ipojo.runtime.core.api.components" - ); - } -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/CompositeTest.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/CompositeTest.java deleted file mode 100644 index 6fa187ac22..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/CompositeTest.java +++ /dev/null @@ -1,247 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.api.Dependency; -import org.apache.felix.ipojo.api.PrimitiveComponentType; -import org.apache.felix.ipojo.api.Service; -import org.apache.felix.ipojo.api.composite.*; -import org.apache.felix.ipojo.runtime.core.api.components.FooImpl; -import org.apache.felix.ipojo.runtime.core.api.components.MyComponentImpl; -import org.apache.felix.ipojo.runtime.core.api.services.Foo; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.not; -import static org.junit.Assert.assertThat; - - -public class CompositeTest extends Common { - - private BundleContext context; - - @Before - public void setUp() { - context = getContext(); - } - - @Test - public void createACompositeWithcontainedInstance() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - PrimitiveComponentType cons = createAConsumer(); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("comp1") - .addInstance(new Instance(prov.getFactory().getName())) - .addInstance(new Instance(cons.getFactory().getName())); - - ComponentInstance ci = type.createInstance(); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - - // Stop cons - cons.stop(); - assertThat("ci is invalid", ci.getState(), is(ComponentInstance.INVALID)); - - // Restart cons - cons.start(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createACompositeWithAnInstantiatedService() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - prov.start(); - PrimitiveComponentType cons = createAConsumer(); - - ServiceReference[] refs = osgiHelper.getServiceReferences(Factory.class.getName(), - "(component.providedServiceSpecifications=" + Foo.class.getName() + ")"); - assertThat(refs.length, is(not(0))); - - Factory factory = (Factory) osgiHelper.getRawServiceObject(refs[0]); - System.out.println(factory.getComponentDescription().getDescription()); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("comp2") - .addSubService(new InstantiatedService().setSpecification(Foo.class.getName())) - .addInstance(new Instance(cons.getFactory().getName())); - - ComponentInstance ci = type.createInstance(); - - System.out.println(ci.getInstanceDescription().getDescription()); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - - // Stop prov - prov.stop(); - assertThat("ci is invalid", ci.getState(), is(ComponentInstance.INVALID)); - - // Restart prov - prov.start(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createACompositeWithAnOptionalInstantiatedService() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - prov.start(); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("comp3") - .addSubService(new InstantiatedService().setSpecification(Foo.class.getName()).setOptional(true)); - - ComponentInstance ci = type.createInstance(); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - - // Stop prov - prov.stop(); - assertThat("ci is valid - 1", ci.getState(), is(ComponentInstance.VALID)); - - // Restart prov - prov.start(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createACompositeWithAnImportedService() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - prov.createInstance(); - PrimitiveComponentType cons = createAConsumer(); - - ServiceReference[] refs = osgiHelper.getServiceReferences(Factory.class.getName(), - "(component.providedServiceSpecifications=" + Foo.class.getName() + ")"); - assertThat(refs.length, is(not(0))); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("comp2") - .addSubService(new ImportedService().setSpecification(Foo.class.getName())) - .addInstance(new Instance(cons.getFactory().getName())); - - ComponentInstance ci = type.createInstance(); - - System.out.println(ci.getInstanceDescription().getDescription()); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - - // Stop prov - prov.stop(); - assertThat("ci is invalid", ci.getState(), is(ComponentInstance.INVALID)); - - // Restart prov - prov.start(); - prov.createInstance(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createACompositeWithAnOptionalImportedService() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - prov.createInstance(); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("comp3") - .addSubService(new ImportedService().setSpecification(Foo.class.getName()).setOptional(true)); - - ComponentInstance ci = type.createInstance(); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - - // Stop prov - prov.stop(); - assertThat("ci is valid - 1", ci.getState(), is(ComponentInstance.VALID)); - - // Restart prov - prov.start(); - prov.createInstance(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createACompositeWithExportingAService() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - // Define the component types - PrimitiveComponentType prov = createAProvider(); - prov.start(); - PrimitiveComponentType cons = createAConsumer(); - ComponentInstance c = cons.createInstance(); - - CompositeComponentType type = new CompositeComponentType() - .setBundleContext(context) - .setComponentTypeName("compExport") - .addSubService(new InstantiatedService().setSpecification(Foo.class.getName())) - .addService(new ExportedService().setSpecification(Foo.class.getName())); - - ComponentInstance ci = type.createInstance(); - - assertThat("ci is valid", ci.getState(), is(ComponentInstance.VALID)); - assertThat("c is valid", c.getState(), is(ComponentInstance.VALID)); - - - // Stop prov - prov.stop(); - assertThat("ci is invalid", ci.getState(), is(ComponentInstance.INVALID)); - assertThat("c is invalid", c.getState(), is(ComponentInstance.INVALID)); - - - // Restart prov - prov.start(); - assertThat("ci is valid - 2", ci.getState(), is(ComponentInstance.VALID)); - assertThat("c is valid - 2", c.getState(), is(ComponentInstance.VALID)); - - - } - - private PrimitiveComponentType createAProvider() { - return new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(FooImpl.class.getName()) - .setPublic(true) - .addService(new Service()); // Provide the FooService - } - - private PrimitiveComponentType createAConsumer() { - return new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(MyComponentImpl.class.getName()) - .addDependency(new Dependency().setField("myFoo")) - .setValidateMethod("start"); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/ExternalHandlerTest.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/ExternalHandlerTest.java deleted file mode 100644 index e478c79ff7..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/ExternalHandlerTest.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.api.PrimitiveComponentType; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.runtime.core.api.components.HostImpl; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.notNullValue; -import static org.junit.Assert.assertThat; - - -public class ExternalHandlerTest extends Common { - - - private BundleContext context; - - @Before - public void setUp() { - context = getContext(); - } - - @Test - public void createAHost() throws Exception { - PrimitiveComponentType type = createAWhiteboardHost(); - ComponentInstance ci = type.createInstance(); - assertThat(ci.getState(), is(ComponentInstance.VALID)); - HandlerDescription hd = ci.getInstanceDescription().getHandlerDescription(Whiteboard.NAMESPACE + ":" + Whiteboard.NAME); - assertThat(hd, is(notNullValue())); - } - - @Test - public void createDoubleHost() throws Exception { - PrimitiveComponentType type = createASecondWhiteboardHost(); - ComponentInstance ci = type.createInstance(); - assertThat(ci.getState(), is(ComponentInstance.VALID)); - HandlerDescription hd = ci.getInstanceDescription().getHandlerDescription(Whiteboard.NAMESPACE + ":" + Whiteboard.NAME); - assertThat(hd, is(notNullValue())); - } - - private PrimitiveComponentType createAWhiteboardHost() { - return new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(HostImpl.class.getName()) - .addHandler(new Whiteboard() - .onArrival("arrival") - .onDeparture("departure") - .setFilter("(foo=foo)") - ); - } - - private PrimitiveComponentType createASecondWhiteboardHost() { - return new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(HostImpl.class.getName()) - .addHandler(new Whiteboard() - .onArrival("arrival") - .onDeparture("departure") - .setFilter("(foo=foo)") - ) - .addHandler(new Whiteboard() - .onArrival("arrival") - .onDeparture("departure") - .setFilter("(foo=bar)") - .onModification("modification") - ); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/PrimitiveComponentTest.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/PrimitiveComponentTest.java deleted file mode 100644 index e9b7b225b2..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/PrimitiveComponentTest.java +++ /dev/null @@ -1,181 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.api.Dependency; -import org.apache.felix.ipojo.api.PrimitiveComponentType; -import org.apache.felix.ipojo.api.Service; -import org.apache.felix.ipojo.api.SingletonComponentType; -import org.apache.felix.ipojo.runtime.core.api.components.FooImpl; -import org.apache.felix.ipojo.runtime.core.api.components.MyComponentImpl; -import org.apache.felix.ipojo.runtime.core.api.components.PlainHelloImpl; -import org.apache.felix.ipojo.runtime.core.api.services.Foo; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -import java.io.IOException; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.assertThat; - - -public class PrimitiveComponentTest extends Common { - - private BundleContext context; - - @Before - public void setUp() { - context = getContext(); - } - - @Configuration - public Option[] config() throws IOException { - return super.config(); - } - - @Test - public void createAServiceProvider() throws Exception { - assertThat(context, is(notNullValue())); - ComponentInstance ci; - - PrimitiveComponentType type = createAProvider(); - ci = type.createInstance(); - assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID)); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Foo.class - .getName(), ci.getInstanceName()); - assertThat(ref, is(notNullValue())); - - } - - @Test - public void killTheFactory() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - assertThat(context, is(notNullValue())); - ComponentInstance ci = null; - - PrimitiveComponentType type = createAProvider(); - ci = type.createInstance(); - assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID)); - assertThat(ipojoHelper.isServiceAvailableByName(Foo.class.getName(), ci - .getInstanceName()), is(true)); - type.stop(); - assertThat("Ci is disposed", ci.getState(), - is(ComponentInstance.DISPOSED)); - assertThat(ipojoHelper.isServiceAvailableByName(Foo.class.getName(), ci - .getInstanceName()), is(false)); - - } - - @Test - public void createAServiceCons() throws Exception { - assertThat(context, is(notNullValue())); - ComponentInstance ci = null; - - PrimitiveComponentType type = createAConsumer(); - ci = type.createInstance(); - assertThat("Ci is invalid", ci.getState(), - is(ComponentInstance.INVALID)); - - } - - @Test - public void createBoth() throws Exception { - ComponentInstance cons = createAConsumer().createInstance(); - // cons is invalid - assertThat("cons is invalid", cons.getState(), is(ComponentInstance.INVALID)); - - ComponentInstance prov = createAProvider().createInstance(); - assertThat("prov is valid", prov.getState(), is(ComponentInstance.VALID)); - assertThat("cons is valid", cons.getState(), is(ComponentInstance.VALID)); - - } - - @Test - public void createTwoCons() throws Exception { - ComponentInstance cons1 = createAConsumer().createInstance(); - // cons is invalid - assertThat("cons is invalid", cons1.getState(), is(ComponentInstance.INVALID)); - - ComponentInstance prov = createAProvider().createInstance(); - assertThat("prov is valid", prov.getState(), is(ComponentInstance.VALID)); - assertThat("cons is valid", cons1.getState(), is(ComponentInstance.VALID)); - - ComponentInstance cons2 = createAnOptionalConsumer().createInstance(); - - assertThat("cons2 is valid", cons2.getState(), is(ComponentInstance.VALID)); - - prov.stop(); - assertThat("cons is invalid", cons1.getState(), is(ComponentInstance.INVALID)); - assertThat("cons2 is valid", cons2.getState(), is(ComponentInstance.VALID)); - } - - @Test - public void notManipulatedComponent() throws Exception { - assertThat(context, is(notNullValue())); - ComponentInstance ci; - - PrimitiveComponentType x= new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(PlainHelloImpl.class.getName()) - .setValidateMethod("start") - .setInvalidateMethod("stop"); - - x.start(); - - assertThat(x, is(notNullValue())); - assertThat(x.getFactory().getState(), is(Factory.VALID)); - - ci = x.createInstance(); - ci.start(); - assertThat(ci.getState(), is(ComponentInstance.VALID)); - - x.stop(); - } - - private PrimitiveComponentType createAProvider() { - return new PrimitiveComponentType() - .setBundleContext(context) - .setClassName(FooImpl.class.getName()) - .addService(new Service()); // Provide the FooService - } - - private PrimitiveComponentType createAConsumer() { - return new SingletonComponentType() - .setBundleContext(context) - .setClassName(MyComponentImpl.class.getName()) - .addDependency(new Dependency().setField("myFoo")) - .setValidateMethod("start"); - } - - private PrimitiveComponentType createAnOptionalConsumer() { - return new SingletonComponentType() - .setBundleContext(context) - .setComponentTypeName("cons.optional") - .setClassName(MyComponentImpl.class.getName()) - .addDependency(new Dependency().setField("myFoo").setOptional(true)) - .setValidateMethod("start"); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/SingletonComponentTest.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/SingletonComponentTest.java deleted file mode 100644 index 9c5f8f8c8a..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/SingletonComponentTest.java +++ /dev/null @@ -1,177 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.apache.felix.ipojo.api.Dependency; -import org.apache.felix.ipojo.api.PrimitiveComponentType; -import org.apache.felix.ipojo.api.Service; -import org.apache.felix.ipojo.api.SingletonComponentType; -import org.apache.felix.ipojo.runtime.core.api.components.FooImpl; -import org.apache.felix.ipojo.runtime.core.api.components.MyComponentImpl; -import org.apache.felix.ipojo.runtime.core.api.services.Foo; -import org.junit.Before; -import org.junit.Ignore; -import org.junit.Test; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -import static org.hamcrest.CoreMatchers.*; -import static org.junit.Assert.assertThat; - - -public class SingletonComponentTest extends Common { - - private BundleContext context; - - @Before - public void setUp() { - context = getContext(); - } - - @Test - public void createAServiceProvider() throws UnacceptableConfiguration, MissingHandlerException, ConfigurationException { - assertThat(context, is(notNullValue())); - ComponentInstance ci = null; - - SingletonComponentType type = createAProvider(); - ci = type.create(); - assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID)); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Foo.class - .getName(), ci.getInstanceName()); - assertThat(ref, is(notNullValue())); - type.disposeInstance(ci); - - } - - @Test - public void killTheFactory() throws Exception { - assertThat(context, is(notNullValue())); - ComponentInstance ci = null; - SingletonComponentType type = createAProvider(); - ci = type.create(); - assertThat("Ci is valid", ci.getState(), is(ComponentInstance.VALID)); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(Foo.class - .getName(), ci.getInstanceName()); - assertThat(ref, is(notNullValue())); - type.stop(); - assertThat("Ci is disposed", ci.getState(), - is(ComponentInstance.DISPOSED)); - assertThat(ipojoHelper.isServiceAvailableByName(Foo.class.getName(), ci - .getInstanceName()), is(false)); - } - - @Test - public void createAServiceCons() throws Exception { - assertThat(context, is(notNullValue())); - ComponentInstance ci = null; - - SingletonComponentType type = createAConsumer(); - ci = type.create(); - assertThat("Ci is invalid", ci.getState(), - is(ComponentInstance.INVALID)); - type.stop(); - } - - @Test - public void createBoth() throws Exception { - SingletonComponentType consFactory = createAConsumer(); - ComponentInstance cons = consFactory.create(); - // cons is invalid - assertThat("cons is invalid", cons.getState(), is(ComponentInstance.INVALID)); - - SingletonComponentType provFactory = createAProvider(); - ComponentInstance prov = provFactory.create(); - assertThat("prov is valid", prov.getState(), is(ComponentInstance.VALID)); - assertThat("cons is valid", cons.getState(), is(ComponentInstance.VALID)); - consFactory.stop(); - provFactory.stop(); - } - - @Test - public void createTwoCons() throws Exception { - SingletonComponentType consFactory = createAConsumer(); - ComponentInstance cons1 = createAConsumer().create(); - // cons is invalid - assertThat("cons is invalid", cons1.getState(), is(ComponentInstance.INVALID)); - - ComponentInstance prov = createAProvider().create(); - assertThat("prov is valid", prov.getState(), is(ComponentInstance.VALID)); - assertThat("cons is valid", cons1.getState(), is(ComponentInstance.VALID)); - - ComponentInstance cons2 = createAnOptionalConsumer().create(); - - assertThat("cons2 is valid", cons2.getState(), is(ComponentInstance.VALID)); - - prov.stop(); - assertThat("cons is invalid", cons1.getState(), is(ComponentInstance.INVALID)); - assertThat("cons2 is valid", cons2.getState(), is(ComponentInstance.VALID)); - } - - @Test - // @Ignore("We can't test as the MyComponentImpl must be manipulated before creating the object") - public void setObject() throws Exception { - ComponentInstance cons = createAConsumer().setObject(new MyComponentImpl(5)).create(); - // cons is invalid - assertThat("cons is invalid", cons.getState(), is(ComponentInstance.INVALID)); - - ComponentInstance prov = createAProvider().create(); - assertThat("prov is valid", prov.getState(), is(ComponentInstance.VALID)); - assertThat("cons is valid", cons.getState(), is(ComponentInstance.VALID)); - - } - - private SingletonComponentType createAProvider() { - PrimitiveComponentType type = new SingletonComponentType() - .setBundleContext(context) - .setClassName(FooImpl.class.getName()) - .addService(new Service()); // Provide the FooService - - return (SingletonComponentType) type; - } - - private SingletonComponentType createAConsumer() { - PrimitiveComponentType type = new SingletonComponentType() - .setBundleContext(context) - .setClassName(MyComponentImpl.class.getName()) - .setComponentTypeName("singleton.cons") - .addDependency(new Dependency().setField("myFoo")) - .setValidateMethod("start"); - - return (SingletonComponentType) type; - } - - private SingletonComponentType createAnOptionalConsumer() { - PrimitiveComponentType type = new SingletonComponentType() - .setBundleContext(context) - .setClassName(MyComponentImpl.class.getName()) - .addDependency(new Dependency().setField("myFoo").setOptional(true)) - .setComponentTypeName("singleton.optional.consumer") - .setValidateMethod("start"); - - return (SingletonComponentType) type; - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Whiteboard.java b/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Whiteboard.java deleted file mode 100644 index 77caf6b56c..0000000000 --- a/ipojo/runtime/core-it/ipojo-api-test/src/test/java/org/apache/felix/ipojo/runtime/core/api/Whiteboard.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * 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.ipojo.runtime.core.api; - -import org.apache.felix.ipojo.api.HandlerConfiguration; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -public class Whiteboard implements HandlerConfiguration { - - public static final String NAME = "wbp"; - - public static final String NAMESPACE = "org.apache.felix.ipojo.whiteboard"; - - private String arrival; - - private String departure; - - private String modification; - - private String filter; - - public Whiteboard onArrival(String method) { - arrival = method; - return this; - } - - public Whiteboard onDeparture(String method) { - departure = method; - return this; - } - - public Whiteboard onModification(String method) { - modification = method; - return this; - } - - public Whiteboard setFilter(String fil) { - filter = fil; - return this; - } - - public Element getElement() { - ensureValidity(); - // Create the root element. - Element element = new Element(NAME, NAMESPACE); - // Mandatory attributes - element.addAttribute(new Attribute("onArrival", arrival)); - element.addAttribute(new Attribute("onDeparture", departure)); - element.addAttribute(new Attribute("filter", filter)); - - // Optional attribute - if (modification != null) { - element.addAttribute(new Attribute("onModification", modification)); - } - - return element; - } - - private void ensureValidity() { - if (arrival == null) { - throw new IllegalStateException("The whiteboard pattern configuration must have a onArrival method"); - } - if (departure == null) { - throw new IllegalStateException("The whiteboard pattern configuration must have a onDeparture method"); - } - if (filter == null) { - throw new IllegalStateException("The whiteboard pattern configuration must have a filter"); - } - - } - -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/pom.xml b/ipojo/runtime/core-it/ipojo-compatibility-test/pom.xml deleted file mode 100644 index 471cf75286..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - 4.0.0 - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - ipojo-compatibility-test - 1.12.2-SNAPSHOT - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceConsumer.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceConsumer.java deleted file mode 100644 index a6a7b95d51..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceConsumer.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.test.compatibility.ipojo; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.apache.felix.ipojo.test.compatibility.service.HelloService; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Hello Service Provider with iPOJO. - */ -@Component -@Provides -@Instantiate -public class HelloServiceConsumer implements CheckService { - - @Requires - private HelloService hello; - - @Override - public Map data() { - Map map = new LinkedHashMap(); - map.put("result", hello.hello("john doe")); - map.put("object", hello); - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceProvider.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceProvider.java deleted file mode 100644 index 11f4f49bb3..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/ipojo/HelloServiceProvider.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.test.compatibility.ipojo; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.test.compatibility.service.HelloService; - -/** - * Hello Service Provider with iPOJO. - */ -@Component -@Provides -@Instantiate -public class HelloServiceProvider implements HelloService { - - /** - * A very original implementation. - * @param name the name - * @return hello $name - */ - @Override - public String hello(String name) { - return "hello " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceConsumer.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceConsumer.java deleted file mode 100644 index 36e05d8673..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceConsumer.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * 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.ipojo.test.compatibility.scr; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.apache.felix.ipojo.test.compatibility.service.HelloService; - -import java.util.LinkedHashMap; -import java.util.Map; - -/** - * Hello Service Provider with SCR. - */ -public class HelloServiceConsumer implements CheckService { - - private HelloService hello; - - @Override - public Map data() { - synchronized (this) { - Map map = new LinkedHashMap(); - if (hello != null) { - map.put("result", hello.hello("john doe")); - map.put("object", hello); - } - return map; - } - } - - public void bindHello(HelloService h) { - synchronized (this) { - hello = h; - } - } - - public void unbindHello(HelloService h) { - synchronized (this) { - hello = null; - } - } - - /** - * Used by blueprint... - * - * @param h the hello service instance. - */ - public void setHello(HelloService h) { - hello = h; - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceProvider.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceProvider.java deleted file mode 100644 index 93579ea429..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/scr/HelloServiceProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.test.compatibility.scr; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.test.compatibility.service.HelloService; - -/** - * Hello Service Provider with SCR. - */ -public class HelloServiceProvider implements HelloService { - - /** - * A very original implementation. - * @param name the name - * @return hello $name - */ - @Override - public String hello(String name) { - return "hello " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/CheckService.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/CheckService.java deleted file mode 100644 index 08131ba89c..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.test.compatibility.service; - -import java.util.Map; - -/** - * A service used to check the correct invocation. - */ -public interface CheckService { - - public Map data(); - -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/HelloService.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/HelloService.java deleted file mode 100644 index 50c4781287..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/java/org/apache/felix/ipojo/test/compatibility/service/HelloService.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.test.compatibility.service; - -/** - * A simple service that will be implemented with several technology. - */ -public interface HelloService { - - public String hello(String name); -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloConsumer.xml b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloConsumer.xml deleted file mode 100644 index 4f86166636..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloConsumer.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloProvider.xml b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloProvider.xml deleted file mode 100644 index 9aa5be95f7..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/blueprint/HelloProvider.xml +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloConsumer.xml b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloConsumer.xml deleted file mode 100644 index d71b6ab49a..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloConsumer.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloProvider.xml b/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloProvider.xml deleted file mode 100644 index a8e048aa37..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/main/resources/scr/HelloProvider.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java deleted file mode 100644 index 9e26d3d991..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/Common.java +++ /dev/null @@ -1,307 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.commons.io.FileUtils; -import org.apache.felix.ipojo.test.compatibility.ipojo.HelloServiceConsumer; -import org.apache.felix.ipojo.test.compatibility.ipojo.HelloServiceProvider; -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.apache.felix.ipojo.test.compatibility.service.HelloService; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundle; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.helpers.FrameworkHelper; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.*; -import java.net.MalformedURLException; - -import static org.ops4j.pax.exam.CoreOptions.*; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Configure the tests. - */ -public abstract class Common extends BaseTest { - - @Override - public boolean deployTestBundle() { - return false; - } - - @Override - protected Option[] getCustomOptions() { - Option[] options = new Option[] { - service(), - wrappedBundle(maven("org.easytesting", "fest-assert").versionAsInProject()), - wrappedBundle(maven("org.easytesting", "fest-util").versionAsInProject()) - }; - - return OptionUtils.combine(options, bundles()); - } - - public abstract Option[] bundles(); - - /** - * Package the service interfaces. - */ - public Option service() { - File out = new File("target/bundles/service.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(CheckService.class); - bundle.add(HelloService.class); - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "services") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.test.compatibility.service") - .build(withBnd()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /** - * iPOJO Hello Service Provider. - */ - public Option iPOJOHelloProvider() { - File out = new File("target/bundles/hello-provider-ipojo.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(HelloServiceProvider.class); - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "iPOJO-Hello-Provider") - //.set(Constants.IMPORT_PACKAGE, "*") - .build(IPOJOStrategy.withiPOJO()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /** - * iPOJO Hello Service Provider. - */ - public Option iPOJOHelloConsumer() { - File out = new File("target/bundles/hello-consumer-ipojo.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(HelloServiceConsumer.class); - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "iPOJO-Hello-Consumer") - //.set(Constants.IMPORT_PACKAGE, "*") - .build(IPOJOStrategy.withiPOJO()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /** - * Package the SCR Hello Service Provider. - */ - public Option SCRHelloProvider() { - File out = new File("target/bundles/hello-provider-scr.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - File metadata = new File("src/main/resources/scr", "HelloProvider.xml"); - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceProvider.class); - try { - bundle.add("scr/provider.xml", new FileInputStream(metadata)); - } catch (FileNotFoundException e) { - throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath()); - } - - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "hello-provider-scr") - //.set(Constants.IMPORT_PACKAGE, "*") - .set("Service-Component", "scr/provider.xml") - .build(withBnd()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public Option SCRHelloConsumer() { - File out = new File("target/bundles/hello-consumer-scr.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - File metadata = new File("src/main/resources/scr", "HelloConsumer.xml"); - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceConsumer.class); - try { - bundle.add("scr/consumer.xml", new FileInputStream(metadata)); - } catch (FileNotFoundException e) { - throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath()); - } - - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "hello-consumer-scr") - // .set(Constants.IMPORT_PACKAGE, "*") - .set("Service-Component", "scr/consumer.xml") - .build(withBnd()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - /** - * Package the Blueprint Hello Service Provider. - */ - public Option BPHelloProvider() { - File out = new File("target/bundles/hello-provider-blueprint.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - File metadata = new File("src/main/resources/blueprint", "HelloProvider.xml"); - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceProvider.class); - try { - bundle.add("blueprint/provider.xml", new FileInputStream(metadata)); - } catch (FileNotFoundException e) { - throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath()); - } - - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "hello-provider-blueprint") - // .set(Constants.IMPORT_PACKAGE, "*") - .set("Bundle-Blueprint", "blueprint/provider.xml") - .build(withBnd()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public Option BPHelloConsumer() { - File out = new File("target/bundles/hello-consumer-blueprint.jar"); - if (out.exists()) { - try { - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - // Ignore it. - } - } - - File metadata = new File("src/main/resources/blueprint", "HelloConsumer.xml"); - - TinyBundle bundle = TinyBundles.bundle(); - bundle.add(org.apache.felix.ipojo.test.compatibility.scr.HelloServiceConsumer.class); - try { - bundle.add("blueprint/consumer.xml", new FileInputStream(metadata)); - } catch (FileNotFoundException e) { - throw new IllegalArgumentException("Cannot find XML metadata : " + metadata.getAbsolutePath()); - } - - InputStream inputStream = bundle - .set(Constants.BUNDLE_SYMBOLICNAME, "hello-consumer-blueprint") - // .set(Constants.IMPORT_PACKAGE, "*") - .set("Bundle-Blueprint", "blueprint/consumer.xml") - .build(withBnd()); - - try { - FileUtils.copyInputStreamToFile(inputStream, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (IOException e) { - e.printStackTrace(); - return null; - } - } - - public boolean isEquinox() { - if (context != null) { - return FrameworkHelper.isEquinox(context) || context.toString().contains("eclipse"); - } else { - String pf = System.getProperty("pax.exam.framework"); - return pf != null && pf.equalsIgnoreCase("equinox"); - } - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByAriesBlueprint1_1_0.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByAriesBlueprint1_1_0.java deleted file mode 100644 index 36d41d8934..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByAriesBlueprint1_1_0.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Aries Blueprint 1.0.1 - * iPOJO provider is consumed by a component using Blueprint. - * - * This test is intended to pass on Felix, KF and Equinox - */ -public class TestBeingConsumedByAriesBlueprint1_1_0 extends Common { - - public static final String BP_ARTIFACTID = "org.apache.aries.blueprint"; - public static final String BP_VERSION = "1.1.0"; - public static final String BP_GROUPID = "org.apache.aries.blueprint"; - - - @Override - public Option[] bundles() { - return new Option[] { - bundle(maven(BP_GROUPID, BP_ARTIFACTID, BP_VERSION).getURL()), - bundle(maven("org.apache.aries.proxy", "org.apache.aries.proxy", "1.0.1").getURL()), - bundle(maven("org.apache.aries", "org.apache.aries.util", "1.1.0").getURL()), - BPHelloConsumer(), - iPOJOHelloProvider() - }; - } - - @Test - public void test() { - CheckService checker = osgiHelper.waitForService(CheckService.class, null, 5000, false); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java deleted file mode 100644 index 34d3177c30..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByEquinoxSCR1_4_100.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; - -/** - * Check a configuration using Equinox SCR 1.4.100 (Declarative Services). - * iPOJO provider is consumed by a component using SCR. - * - * - * This test is intended to pass on Equinox only. - */ -public class TestBeingConsumedByEquinoxSCR1_4_100 extends Common { - - public static String DS_URL = "http://people.apache.org/~clement/ipojo/bundle4tests/org.eclipse.equinox.ds_1.4.101.v20130813-1853.jar"; - - public static String UTILS_URL = "http://people.apache.org/~clement/ipojo/bundle4tests/org.eclipse.equinox.util_1.0.500.v20130404-1337.jar"; - - @Override - public Option[] bundles() { - // We must not deploy the Equinox DS on Felix and KF - if (! isEquinox()) { - return new Option[0]; - } - return new Option[] { - bundle(DS_URL), - bundle(UTILS_URL), - iPOJOHelloProvider(), - SCRHelloConsumer() - }; - } - - @Test - public void test() { - if (! isEquinox()) { - System.out.println("Test executed on Equinox only"); - return; - } - CheckService checker = osgiHelper.waitForService(CheckService.class, null, 1000); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByFelixSCR1_6_2.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByFelixSCR1_6_2.java deleted file mode 100644 index 7cf850152c..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByFelixSCR1_6_2.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Felix SCR 1.6.2. - * iPOJO provider is consumed by a component using SCR. - * - * This test is intended to pass on Felix, KF and Equinox - */ -public class TestBeingConsumedByFelixSCR1_6_2 extends Common { - - public static final String SCR_ARTIFACTID = "org.apache.felix.scr"; - public static final String SCR_VERSION = "1.6.2"; - public static final String SCR_GROUPID = "org.apache.felix"; - - @Override - public Option[] bundles() { - return new Option[] { - bundle(maven(SCR_GROUPID, SCR_ARTIFACTID, SCR_VERSION).getURL()), - SCRHelloConsumer(), - iPOJOHelloProvider() - }; - } - - @Test - public void test() { - CheckService checker = osgiHelper.waitForService(CheckService.class, null, 1000); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByKnopflerfishSCR4_0_2.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByKnopflerfishSCR4_0_2.java deleted file mode 100644 index 90befb6398..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestBeingConsumedByKnopflerfishSCR4_0_2.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Knopflerfish SCR 4.0.2 - * iPOJO provider is consumed by a component using SCR. - * - * This test is intended to pass on KF only - */ -public class TestBeingConsumedByKnopflerfishSCR4_0_2 extends Common { - - public static final String SCR_URL = "http://www.knopflerfish.org/releases/4.0" + - ".0/maven2/org/knopflerfish/bundle/component/4.0.2/component-4.0.2.jar"; - - @Override - public Option[] bundles() { - return new Option[] { - bundle(SCR_URL), - bundle("http://www.knopflerfish.org/releases/4.0.0/maven2/org/knopflerfish/bundle/cm-API/4.0" + - ".1/cm-API-4.0.1.jar"), - bundle("http://www.knopflerfish.org/releases/4.0.0/maven2/org/knopflerfish/bundle/kxml-LIB/2.3.0" + - ".kf4-001/kxml-LIB-2.3.0.kf4-001.jar"), - SCRHelloConsumer(), - iPOJOHelloProvider() - }; - } - - @Test - public void test() { - if (! isKnopflerfish()) { - System.out.println("Test ignored - running only on Knopflerfish"); - return; - } - - CheckService checker = osgiHelper.getServiceObject(CheckService.class); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingAriesBlueprint1_1_0.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingAriesBlueprint1_1_0.java deleted file mode 100644 index 298df42800..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingAriesBlueprint1_1_0.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Aries Blueprint 1.1.0 - * iPOJO consumer is bound to a Hello Service implementation using Blueprint. - * - * This test is intended to pass on Felix, KF and Equinox - */ -public class TestConsumingProviderUsingAriesBlueprint1_1_0 extends Common { - - public static final String BP_ARTIFACTID = "org.apache.aries.blueprint"; - public static final String BP_VERSION = "1.1.0"; - public static final String BP_GROUPID = "org.apache.aries.blueprint"; - - - @Override - public Option[] bundles() { - return new Option[] { - bundle(maven(BP_GROUPID, BP_ARTIFACTID, BP_VERSION).getURL()), - bundle(maven("org.apache.aries.proxy", "org.apache.aries.proxy", "1.0.1").getURL()), - bundle(maven("org.apache.aries", "org.apache.aries.util", "1.1.0").getURL()), - BPHelloProvider(), - iPOJOHelloConsumer() - }; - } - - @Test - public void test() { - osgiHelper.waitForService(CheckService.class, null, 10000); - CheckService checker = osgiHelper.getServiceObject(CheckService.class); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java deleted file mode 100644 index b7287eefb4..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingEquinoxSCR1_4_100.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; -import org.osgi.framework.Bundle; -import org.ow2.chameleon.testing.helpers.Dumps; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Equinox SCR 1.4.100 (Declarative Services). - * iPOJO consumer is bound to a Hello Service implementation using SCR. - * - * - * This test is intended to pass on Equinox only. - */ -public class TestConsumingProviderUsingEquinoxSCR1_4_100 extends Common { - - public static String DS_URL = "http://people.apache.org/~clement/ipojo/bundle4tests/org.eclipse.equinox.ds_1.4.101.v20130813-1853.jar"; - - public static String UTILS_URL = "http://people.apache.org/~clement/ipojo/bundle4tests/org.eclipse.equinox.util_1.0.500.v20130404-1337.jar"; - - @Override - public Option[] bundles() { - if (! isEquinox()) { - return new Option[0]; - } - return new Option[] { - bundle(DS_URL), - bundle(UTILS_URL), - SCRHelloProvider(), - iPOJOHelloConsumer() - }; - } - - @Test - public void test() { - if (! isEquinox()) { - System.out.println("Test executed on Equinox only"); - return; - } - CheckService checker = osgiHelper.waitForService(CheckService.class, null, 1000); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingFelixSCR1_6_2.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingFelixSCR1_6_2.java deleted file mode 100644 index 639c06f7df..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingFelixSCR1_6_2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.exam.CoreOptions.maven; - -/** - * Check a configuration using Felix SCR 1.6.2. - * iPOJO consumer is bound to a Hello Service implementation using SCR. - * - * - * This test is intended to pass on Felix, KF and Equinox - */ -public class TestConsumingProviderUsingFelixSCR1_6_2 extends Common { - - public static final String SCR_ARTIFACTID = "org.apache.felix.scr"; - public static final String SCR_VERSION = "1.6.2"; - public static final String SCR_GROUPID = "org.apache.felix"; - - @Override - public Option[] bundles() { - return new Option[] { - bundle(maven(SCR_GROUPID, SCR_ARTIFACTID, SCR_VERSION).getURL()), - SCRHelloProvider(), - iPOJOHelloConsumer() - }; - } - - @Test - public void test() { - CheckService checker = osgiHelper.getServiceObject(CheckService.class); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingKnopflerfishSCR4_0_2.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingKnopflerfishSCR4_0_2.java deleted file mode 100644 index 19324152a0..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestConsumingProviderUsingKnopflerfishSCR4_0_2.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; -import static org.ops4j.pax.exam.CoreOptions.bundle; - -/** - * Check a configuration using Knopflerfish SCR 4.0.2 - * iPOJO consumer is bound to a Hello Service implementation using SCR. - * - * - * This test is intended to pass on KF only - */ -public class TestConsumingProviderUsingKnopflerfishSCR4_0_2 extends Common { - - public static final String SCR_URL = "http://www.knopflerfish.org/releases/4.0" + - ".0/maven2/org/knopflerfish/bundle/component/4.0.2/component-4.0.2.jar"; - - @Override - public Option[] bundles() { - return new Option[] { - bundle(SCR_URL), - bundle("http://www.knopflerfish.org/releases/4.0.0/maven2/org/knopflerfish/bundle/cm-API/4.0" + - ".1/cm-API-4.0.1.jar"), - bundle("http://www.knopflerfish.org/releases/4.0.0/maven2/org/knopflerfish/bundle/kxml-LIB/2.3.0" + - ".kf4-001/kxml-LIB-2.3.0.kf4-001.jar"), - SCRHelloProvider(), - iPOJOHelloConsumer() - }; - } - - @Test - public void test() { - if (! isKnopflerfish()) { - System.out.println("Test ignored - running only on Knopflerfish"); - return; - } - CheckService checker = osgiHelper.getServiceObject(CheckService.class); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestiPOJOOnly.java b/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestiPOJOOnly.java deleted file mode 100644 index beb36234b4..0000000000 --- a/ipojo/runtime/core-it/ipojo-compatibility-test/src/test/java/org/apache/felix/ipojo/test/compatibility/TestiPOJOOnly.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.test.compatibility; - -import org.apache.felix.ipojo.test.compatibility.service.CheckService; -import org.junit.Test; -import org.ops4j.pax.exam.Option; - -import static org.fest.assertions.Assertions.assertThat; - -/** - * Check a configuration with iPOJO used for the provider and consumer. - * - * This test is intended to pass on Felix, KF and Equinox - */ -public class TestiPOJOOnly extends Common { - - @Override - public Option[] bundles() { - return new Option[] { - iPOJOHelloConsumer(), - iPOJOHelloProvider(), - }; - } - - @Test - public void test() { - CheckService checker = osgiHelper.getServiceObject(CheckService.class); - assertThat(checker).isNotNull(); - assertThat(checker.data().get("result")).isEqualTo("hello john doe"); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-annotations-test/pom.xml deleted file mode 100644 index 644a5dce96..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-annotations-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/Foo.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/Foo.java deleted file mode 100644 index 4556678936..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/Foo.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 foo; - - -/** - * Creates a simple annotation to create the processing of non-matching - * annotations - */ -public @interface Foo { - String bar(); -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/RGB.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/RGB.java deleted file mode 100644 index 77a1631945..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/RGB.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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 foo; - -/** - * Checks the enum support in custom handler. - */ -public enum RGB { - - RED, GREEN, BLUE -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java deleted file mode 100644 index b2f365fe31..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/foo/ipojo/IPOJOFoo.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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 foo.ipojo; - - -import foo.RGB; - -/** - * Creates a simple annotation to create the processing of matching - * annotations - */ -public @interface IPOJOFoo { - String bar(); - - RGB rgb() default RGB.BLUE; - - RGB[] colors() default {}; -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java deleted file mode 100644 index cd6fbc75bc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/AggregateDependency.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Unbind; - -@Component -public class AggregateDependency { - - @Unbind(aggregate=true) - public void unbindBar() { } - @Bind - public void bindBar() { } - - @Unbind - public void unbindBaz() { } - @Bind(aggregate=true) - public void bindBaz() { } - - @Unbind(aggregate=true, id="unbindonly") - public void unbind() { } - - @Bind(aggregate=true, id="bindonly") - public void bind() { } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java deleted file mode 100644 index b3709794e5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Arch.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(architecture=true) -public class Arch { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java deleted file mode 100644 index 2fea5783c0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ComponentTypeVersion.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - - -@Component(version="1.0.0") -public class ComponentTypeVersion { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java deleted file mode 100644 index 174b42abdc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/CustomAnnotationWithEnum.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import foo.RGB; -import foo.ipojo.IPOJOFoo; -import org.apache.felix.ipojo.annotations.Component; - -@Component -@IPOJOFoo(bar="bar", rgb = RGB.RED, colors = {RGB.BLUE, RGB.RED}) -public class CustomAnnotationWithEnum { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java deleted file mode 100644 index cf3a0984e2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DefaultImplementationDependency.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class DefaultImplementationDependency { - - @Requires(defaultimplementation=ProvidesSimple.class, optional=true) - public FooService fs; -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java deleted file mode 100644 index b34ad68cc1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Dependency.java +++ /dev/null @@ -1,103 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Modified; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class Dependency { - - @Requires - public FooService fs; - - @Unbind - public void unbindBar() { - - } - - @Bind - public void bindBar() { - - } - - @Unbind - public void unbindBaz() { - - } - - @Bind - public void bindBaz() { - - } - - - @Requires - public FooService fs2; - - @Bind(id="fs2") - public void bindFS2() { - - } - - @Unbind(id="fs2") - public void unbindFS2() { - - } - - @Requires(id="inv") - public FooService fs2inv; - - @Bind(id="inv") - public void bindFS2Inv() { - - } - - @Unbind(id="inv") - public void unbindFS2Inv() { - - } - - @Bind(id="mod") - public void bindMod() { - - } - - @Unbind(id="mod") - public void unbindMod() { - - } - - @Modified(id="mod") - public void modifiedMod() { - - } - - - @Requires(proxy=false, id="notproxied") - FooService myFoo; - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DependencyUsingSpecification.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DependencyUsingSpecification.java deleted file mode 100644 index 42d6bb9d8a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/DependencyUsingSpecification.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.*; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -import java.util.*; -import java.util.Properties; - -@Component -@Provides -public class DependencyUsingSpecification implements CheckService { - - private boolean bound = false; - - @Unbind - public synchronized void unbindBar() { - bound = false; - } - - @Bind(specification = BarService.class, optional = true) - public synchronized void bindBar() { - bound = true; - } - - @Override - public boolean check() { - return bound; - } - - @Override - public Properties getProps() { - return null; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java deleted file mode 100644 index 097c325bd0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Factory.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(name="factory", publicFactory=true) -public class Factory { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java deleted file mode 100644 index 013e5a93b1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryDeprecated.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(public_factory=true) -public class FactoryDeprecated { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java deleted file mode 100644 index 5072fbc24b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethod.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(factoryMethod="create") -public class FactoryMethod { - - public static FactoryMethod create() { - return new FactoryMethod(); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java deleted file mode 100644 index 5d060efa1f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FactoryMethodDeprecated.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(factory_method="create") -public class FactoryMethodDeprecated { - - public static FactoryMethodDeprecated create() { - return new FactoryMethodDeprecated(); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java deleted file mode 100644 index f94a90c3f7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FilteredDependency.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class FilteredDependency { - - @Requires(filter="(foo=bar)") - public FooService fs; - - @Unbind(filter="(foo=bar)") - public void unbindBar() { } - @Bind - public void bindBar() { } - - @Unbind - public void unbindBaz() { } - @Bind(filter="(foo=bar)") - public void bindBaz() { } - - @Requires(id="inv") - public FooService fs2inv; - @Bind(id="inv", filter="(foo=bar)") - public void bindFS2Inv() { } - @Unbind(id="inv") - public void unbindFS2Inv() { } - - @Unbind(filter="(foo=bar)", id="unbindonly") - public void unbind() { } - - @Bind(filter="(foo=bar)", id="bindonly") - public void bind() { } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java deleted file mode 100644 index d1002f7e4e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FromDependency.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class FromDependency { - - @Requires(from="X") - public FooService fs; - - @Unbind - public void unbindBar() { - - } - - @Bind - public void bindBar() { - - } - - @Unbind(from="both") - public void unbindBaz() { - - } - - @Bind(from="both") - public void bindBaz() { - - } - - - @Requires - public FooService fs2; - - @Bind(id="fs2", from="X") - public void bindFS2() { - - } - - @Unbind(id="fs2") - public void unbindFS2() { - - } - - @Requires(id="inv") - public FooService fs2inv; - - @Bind(id="inv") - public void bindFS2Inv() { - - } - - @Unbind(id="inv", from="X") - public void unbindFS2Inv() { - - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java deleted file mode 100644 index c23ce4a887..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Immediate.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(immediate=true) -public class Immediate { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java deleted file mode 100644 index c054f33f3b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateSimple.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; - - -@Instantiate -@Component -public class InstantiateSimple { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java deleted file mode 100644 index a0f46045de..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/InstantiateWithName.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; - - -@Instantiate(name="myInstantiatedInstance") -@Component -public class InstantiateWithName { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java deleted file mode 100644 index ecae824050..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Lifecycle.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Controller; -import org.apache.felix.ipojo.annotations.Invalidate; -import org.apache.felix.ipojo.annotations.Validate; - -@Component -public class Lifecycle { - @Controller - boolean lfc; - - @Validate - public void start() { - - } - - @Invalidate - public void stop() { - - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java deleted file mode 100644 index a3ea391472..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ManagedServicePID.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(managedservice="MyPID") -public class ManagedServicePID implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java deleted file mode 100644 index 9e0b6cfe61..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/MyComparator.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Comparator; - -public class MyComparator implements Comparator { - - public int compare(Object o1, Object o2) { - return 0; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java deleted file mode 100644 index a4fd669eee..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoAnnotation.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -public class NoAnnotation { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java deleted file mode 100644 index f93bf9105b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoArch.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(architecture=false) -public class NoArch { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java deleted file mode 100644 index 612d1c0a73..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(name="nofactory", public_factory=false) -public class NoFactory { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java deleted file mode 100644 index 83981955e6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoImmediate.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; - -@Component(immediate=false) -public class NoImmediate { -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java deleted file mode 100644 index d47cf235b2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NoPropagation.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(propagation=false) -public class NoPropagation implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java deleted file mode 100644 index 9b46855cc0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/NullableDependency.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class NullableDependency { - - @Requires(nullable=true) - public FooService fs; - - @Requires(nullable=false) - public FooService fs2; - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java deleted file mode 100644 index b726e8cb38..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyFoo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import foo.Foo; - -@Foo(bar="bar") -public class OnlyFoo { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java deleted file mode 100644 index 2d85be2ff6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OnlyiPOJOFoo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import foo.ipojo.IPOJOFoo; - -@IPOJOFoo(bar="bar") -public class OnlyiPOJOFoo { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java deleted file mode 100644 index c58e179e4d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/OptionalDependency.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class OptionalDependency { - - @Requires(optional=true) - public FooService fs; - - @Requires(optional=false) - public FooService fs2; - - @Unbind(optional=true) - public void unbindBar() { } - @Bind - public void bindBar() { } - - @Unbind - public void unbindBaz() { } - @Bind(optional=true) - public void bindBaz() { } - - @Requires(id="inv") - public FooService fs2inv; - @Bind(id="inv", optional=true) - public void bindFS2Inv() { } - @Unbind(id="inv") - public void unbindFS2Inv() { } - - @Unbind(optional=true, id="unbindonly") - public void unbind() { } - - @Bind(optional=true, id="bindonly") - public void bind() { } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java deleted file mode 100644 index 6cfc7c6d88..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PIDandPropagation.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(managedservice="MyPID", propagation=true) -public class PIDandPropagation implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java deleted file mode 100644 index 7c667a12e0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceController.java +++ /dev/null @@ -1,75 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.ServiceController; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {FooService.class, BarService.class}) -public class PSServiceController implements FooService, BarService { - - @ServiceController(value=false) - public boolean controller; - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java deleted file mode 100644 index e020f54645..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PSServiceControllerSpec.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.ServiceController; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {FooService.class, BarService.class}) -public class PSServiceControllerSpec implements FooService, BarService { - - @ServiceController(value=false, specification=FooService.class) - public boolean controller1; - - @ServiceController(value=true) - public boolean controller2; - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java deleted file mode 100644 index 318cb5fe5a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PolicyDependency.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.*; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class PolicyDependency { - - @Requires(policy= BindingPolicy.STATIC) - public FooService fs; - - @Requires(policy=BindingPolicy.DYNAMIC_PRIORITY) - public FooService fs2; - - @Unbind(policy=BindingPolicy.STATIC) - public void unbindBar() { } - @Bind - public void bindBar() { } - - @Unbind - public void unbindBaz() { } - @Bind(policy=BindingPolicy.STATIC) - public void bindBaz() { } - - @Requires(id="inv", specification = FooService.class) - public FooService fs2inv; - @Bind(id="inv", policy=BindingPolicy.STATIC) - public void bindFS2Inv() { } - @Unbind(id="inv") - public void unbindFS2Inv() { } - - @Unbind(policy=BindingPolicy.STATIC, id="unbindonly") - public void unbind() { } - - @Bind(policy=BindingPolicy.STATIC, id="bindonly") - public void bind() { } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java deleted file mode 100644 index afc3a97cb8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Propagation.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(propagation=true) -public class Propagation implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java deleted file mode 100644 index a2430338e1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/PropagationandPID.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(managedservice="MyPID", propagation=true) -public class PropagationandPID implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java deleted file mode 100644 index a174a0ad26..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/Properties.java +++ /dev/null @@ -1,93 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class Properties implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5", mandatory=true) - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java deleted file mode 100644 index 92fccfa401..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesDouble.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides -public class ProvidesDouble implements FooService { - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java deleted file mode 100644 index cde8d34f1c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesProperties.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.ServiceProperty; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {FooService.class, BarService.class}) -public class ProvidesProperties implements FooService, BarService { - - @ServiceProperty(name = "foo") - public int m_foo = 0; - - @ServiceProperty(value = "4", mandatory=true) - public int bar; - - @ServiceProperty(name="baz") - int m_baz; - - @ServiceProperty - public int boo; - - @ServiceProperty(name="baa", value="5") - public int m_baa; - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java deleted file mode 100644 index dea26540e0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesQuatro.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {FooService.class, CheckService.class}) -public class ProvidesQuatro implements FooService, BarService, CheckService { - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - - public boolean check() { - return false; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java deleted file mode 100644 index 8513589416..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesSimple.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {FooService.class, BarService.class}) -public class ProvidesSimple implements FooService, BarService { - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java deleted file mode 100644 index 7e44f30309..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesStaticProperties.java +++ /dev/null @@ -1,94 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.ServiceProperty; -import org.apache.felix.ipojo.annotations.StaticServiceProperty; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides( - specifications= {FooService.class, BarService.class}, - properties= { - @StaticServiceProperty(name="prop1", value="prop1", type="java.lang.String"), - @StaticServiceProperty(name="prop2", type="java.lang.String"), - @StaticServiceProperty(name="props", value="{prop1, prop2}", type="string[]"), - @StaticServiceProperty(name="mandatory1", mandatory=true, type="string") - }) -public class ProvidesStaticProperties implements FooService, BarService { - - @ServiceProperty(name = "foo") - public int m_foo = 0; - - @ServiceProperty(value = "4", mandatory=true) - public int bar; - - @ServiceProperty(name="baz") - int m_baz; - - @ServiceProperty - public int boo; - - @ServiceProperty(name="baa", value="5") - public int m_baa; - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java deleted file mode 100644 index 30b4dc9bb7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/ProvidesTriple.java +++ /dev/null @@ -1,76 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Properties; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -@Provides(specifications= {CheckService.class}) -public class ProvidesTriple implements FooService, BarService, CheckService { - - public boolean foo() { - return false; - } - - public Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public Properties getProps() { - return null; - } - - public boolean check() { - return false; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java deleted file mode 100644 index 1997570bab..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/RankedDependency.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Bind; -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Requires; -import org.apache.felix.ipojo.annotations.Unbind; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class RankedDependency { - - @Requires(comparator = MyComparator.class) - public FooService fs; - - @Unbind(comparator = MyComparator.class) - public void unbindBar() { - } - - @Bind - public void bindBar() { - } - - @Unbind - public void unbindBaz() { - } - - @Bind(comparator = MyComparator.class) - public void bindBaz() { - } - - @Requires(id = "inv") - public FooService fs2inv; - - @Bind(id = "inv", comparator = MyComparator.class) - public void bindFS2Inv() { - } - - @Unbind(id = "inv") - public void unbindFS2Inv() { - } - - @Unbind(comparator = MyComparator.class, id = "unbindonly") - public void unbind() { - } - - @Bind(comparator = MyComparator.class, id = "bindonly") - public void bind() { - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java deleted file mode 100644 index af1441f28d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithManagedService.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Dictionary; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Updated; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component(managedservice="MyPID") -public class UpdatedWithManagedService implements FooService, BarService { - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5") - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - - @Updated - public void after(Dictionary conf) { - // ... - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java deleted file mode 100644 index 7ad0e9967c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/UpdatedWithProperties.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import java.util.Dictionary; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Updated; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.BarService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - - -@Component -public class UpdatedWithProperties implements FooService, BarService { - - @Updated - public void after(Dictionary dict) { - // ... - } - - @Property(name= "foo") - public int m_foo = 0; - - @Property(value = "4") - public int bar; - - @Property - public void setboo(int boo) { - - } - - @Property - public void setbaz(int baz) { - - } - - @Property - public int boo; - - @Property(name="baa") - public int m_baa; - - @Property(value="5", mandatory=true) - public void setbaa(int baa) { - - } - - public boolean foo() { - return false; - } - - public java.util.Properties fooProps() { - return null; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - - public boolean bar() { - return false; - } - - public java.util.Properties getProps() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/ComponentWithProperties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/ComponentWithProperties.java deleted file mode 100644 index 247809b68e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/ComponentWithProperties.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.StaticServiceProperty; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -import java.util.Properties; - -/** - * A component publishing a service with a static service property. - */ -@Component -@Provides(properties = { - @StaticServiceProperty(name="property", value="value", type = "java.lang.String") -}) -@Instantiate(name="instanceWithProperties") -// We must avoid having such static properties: -// Fixed in https://issues.apache.org/jira/browse/FELIX-4053 -//@StaticServiceProperty(name="property", value="value", type = "java.lang.String") -public class ComponentWithProperties implements FooService{ - - // The implementation is meaningless. - - @Override - public boolean foo() { - return false; - } - - @Override - public Properties fooProps() { - return null; - } - - @Override - public Boolean getObject() { - return null; - } - - @Override - public boolean getBoolean() { - return false; - } - - @Override - public int getInt() { - return 0; - } - - @Override - public long getLong() { - return 0; - } - - @Override - public double getDouble() { - return 0; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/InstantiatedComponent.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/InstantiatedComponent.java deleted file mode 100644 index 8d6d02db32..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/components/InstantiatedComponent.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Instantiate; - -/** - * A component using factory name and instantiate. - */ -@Component(name = "MyInstantiatedComponent") -@Instantiate -public class InstantiatedComponent { - - // Do nothing. -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/ComponentUsingContext.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/ComponentUsingContext.java deleted file mode 100644 index 25ea647f40..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/context/ComponentUsingContext.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.context; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Property; -import org.osgi.framework.BundleContext; - -/** - * A component using the @Context annotation - */ -@Component -public class ComponentUsingContext { - - @Context - private BundleContext field; - - public ComponentUsingContext(@Property String property, - @Context(Context.Source.COMPONENT) BundleContext ctxt) { - - } - - @Context(Context.Source.INSTANCE) - public void setContext(BundleContext context) { - - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java deleted file mode 100644 index 0a4132dc90..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/error/AbstractClass.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.error; - -import org.apache.felix.ipojo.annotations.Requires; - -public abstract class AbstractClass { - - @Requires - private Runnable run; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java deleted file mode 100644 index d2ffcc6d61..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSub.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.event; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.event.Subscriber; -import org.osgi.service.event.Event; - - -@Component -public class PubSub { - @org.apache.felix.ipojo.handlers.event.Publisher(name="p1", synchronous=true) - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1; - - @org.apache.felix.ipojo.handlers.event.Publisher(name="p2", synchronous=false, topics="foo,bar", dataKey="data") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2; - - @org.apache.felix.ipojo.handlers.event.Publisher(name="p3", synchronous=true, topics="bar") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3; - - @Subscriber(name="s1", dataKey="data") - public void receive1(Object foo) { - // Nothing - } - - @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)") - public void receive2(Event foo) { - // Nothing - } - - - @Subscriber(name="s3", topics= "foo", dataKey="data", dataType="java.lang.String") - public void receive3(String foo) { - // Nothing - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java deleted file mode 100644 index 0eb4fe3a05..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubDeprecated.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.event; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.event.Subscriber; -import org.osgi.service.event.Event; - - -@Component -public class PubSubDeprecated { - @org.apache.felix.ipojo.handlers.event.Publisher(name="p1", synchronous=true) - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1; - - @org.apache.felix.ipojo.handlers.event.Publisher(name="p2", synchronous=false, topics="foo,bar", data_key="data") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2; - - @org.apache.felix.ipojo.handlers.event.Publisher(name="p3", synchronous=true, topics="bar") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3; - - @Subscriber(name="s1", data_key="data") - public void receive1(Object foo) { - // Nothing - } - - @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)") - public void receive2(Event foo) { - // Nothing - } - - - @Subscriber(name="s3", topics= "foo", data_key="data", data_type="java.lang.String") - public void receive3(String foo) { - // Nothing - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java deleted file mode 100644 index 76749c1a58..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/event/PubSubWithPublishes.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.event; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.event.Publishes; -import org.apache.felix.ipojo.handlers.event.Subscriber; -import org.osgi.service.event.Event; - - -@Component -public class PubSubWithPublishes { - @Publishes(name="p1", synchronous=true) - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher1; - - @Publishes(name="p2", synchronous=false, topics="foo,bar", dataKey="data") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher2; - - @Publishes(name="p3", synchronous=true, topics="bar") - org.apache.felix.ipojo.handlers.event.publisher.Publisher publisher3; - - @Subscriber(name="s1", dataKey="data") - public void receive1(Object foo) { - // Nothing - } - - @Subscriber(name="s2", topics="foo,bar", filter="(foo=true)") - public void receive2(Event foo) { - // Nothing - } - - - @Subscriber(name="s3", topics= "foo", dataKey="data", dataType="java.lang.String") - public void receive3(String foo) { - // Nothing - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java deleted file mode 100644 index 30ce4c64cc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/extender/Extender.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.extender; - -import org.apache.felix.ipojo.annotations.Component; -import org.osgi.framework.Bundle; - - -@Component -@org.apache.felix.ipojo.extender.Extender(extension= "foo", onArrival="onArrival", onDeparture="onDeparture") -public class Extender { - - public void onArrival(Bundle bundle, String foo) { - // nothing - } - - public void onDeparture(Bundle bundle) { - // nothing - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java deleted file mode 100644 index f5be907d93..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXDeprecated.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.jmx; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.jmx.Config; -import org.apache.felix.ipojo.handlers.jmx.Method; -import org.apache.felix.ipojo.handlers.jmx.Property; - -@Component -@Config(domain="my-domain", usesMOSGi=false) -public class JMXDeprecated { - - @Property(name="prop", notification=true, rights="w") - String m_foo; - - @Method(description="set the foo prop") - public void setFoo(String mes) { - System.out.println("Set foo to " + mes); - m_foo = mes; - } - - @Method(description="get the foo prop") - public String getFoo() { - return m_foo; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java deleted file mode 100644 index a350797c29..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/jmx/JMXSimple.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.jmx; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handlers.jmx.Config; -import org.apache.felix.ipojo.handlers.jmx.JMXMethod; -import org.apache.felix.ipojo.handlers.jmx.JMXProperty; - -@Component -@Config(domain="my-domain", usesMOSGi=false) -public class JMXSimple { - - @JMXProperty(name="prop", notification=true, rights="w") - String m_foo; - - @JMXMethod(description="set the foo prop") - public void setFoo(String mes) { - System.out.println("Set foo to " + mes); - m_foo = mes; - } - - @JMXMethod(description="get the foo prop") - public String getFoo() { - return m_foo; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java deleted file mode 100644 index 0825101619..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/Temporal.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class Temporal { - - @org.apache.felix.ipojo.handler.temporal.Temporal - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java deleted file mode 100644 index d0cb5cd94d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalCollection.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import java.util.Collection; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; - -@Component -public class TemporalCollection { - - @Requires(specification="org.apache.felix.ipojo.runtime.core.test.services.FooService") - private Collection fs1; - - @Requires(specification="org.apache.felix.ipojo.runtime.core.test.services.FooService", timeout=300) - private Collection fs2; - - @Requires(onTimeout="empty", specification="org.apache.felix.ipojo.runtime.core.test.services.FooService") - private Collection fs3; - - @Requires(proxy=true, specification="org.apache.felix.ipojo.runtime.core.test.services.FooService") - private Collection fs4; - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java deleted file mode 100644 index 9e5f016455..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalSimple.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalSimple { - - @Requires - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java deleted file mode 100644 index 9fd4de5bb6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithDI.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithDI { - - @Requires(onTimeout="org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple") - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java deleted file mode 100644 index 7c90920616..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithEmptyArray.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithEmptyArray { - - @Requires(onTimeout="empty-array") - private FooService fs[]; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java deleted file mode 100644 index 3bce2018f5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithFilter.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithFilter { - - @Requires(filter="(vendor=clement)") - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java deleted file mode 100644 index fb566b6ab5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNull.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithNull { - - @Requires(onTimeout="null") - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java deleted file mode 100644 index 456e388df4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithNullable.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithNullable { - - @Requires(onTimeout="nullable") - private FooService fs; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java deleted file mode 100644 index fab510f631..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/temporal/TemporalWithTimeout.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.temporal; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.handler.temporal.Requires; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; - -@Component -public class TemporalWithTimeout { - - @Requires(timeout=100) - private FooService fs; - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java deleted file mode 100644 index 18da7965ea..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWIModification.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.whiteboard; - -import org.apache.felix.ipojo.annotations.Component; -import org.osgi.framework.ServiceReference; - -@Component -@org.apache.felix.ipojo.whiteboard.Wbp(filter="(foo=true)", - onArrival="onArrival", - onDeparture="onDeparture", - onModification="onModification") -public class WhiteBoardWIModification { - - public void onArrival(ServiceReference ref) { - // nothing - } - - public void onDeparture(ServiceReference ref) { - // nothing - } - - public void onModification(ServiceReference ref) { - // nothing - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java deleted file mode 100644 index fd6e9b59af..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoardWOModification.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.whiteboard; - -import org.apache.felix.ipojo.annotations.Component; -import org.osgi.framework.ServiceReference; - -@Component -@org.apache.felix.ipojo.whiteboard.Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture") -public class WhiteBoardWOModification { - - public void onArrival(ServiceReference ref) { - // nothing - } - - public void onDeparture(ServiceReference ref) { - // nothing - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java deleted file mode 100644 index b6c675ca9b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/whiteboard/WhiteBoards.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components.whiteboard; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.whiteboard.Whiteboards; -import org.apache.felix.ipojo.whiteboard.Wbp; -import org.osgi.framework.ServiceReference; - -@Component -@Whiteboards(whiteboards={ - @Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture"), - @Wbp(filter="(foo=true)", onArrival="onArrival", onDeparture="onDeparture", onModification="onModification") - }) -public class WhiteBoards { - - public void onArrival(ServiceReference ref) { - // nothing - } - - public void onDeparture(ServiceReference ref) { - // nothing - } - - public void onModification(ServiceReference ref) { - // nothing - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java deleted file mode 100644 index 9afc463f96..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java deleted file mode 100644 index e4366ab2b4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java deleted file mode 100644 index 6a17326cb1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ChildInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -public interface ChildInterface extends ParentInterface1, ParentInterface2 { - - public void processChild(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java deleted file mode 100644 index 9b8e12bdcd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java deleted file mode 100644 index a2669784f7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface1.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -public interface ParentInterface1 extends ParentParentInterface { - - public void processParent1(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java deleted file mode 100644 index fbf2ac4849..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentInterface2.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -public interface ParentInterface2 { - - public void processParent2(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java deleted file mode 100644 index f95d384ccb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/ParentParentInterface.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -public interface ParentParentInterface { - - public void processParentParent(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java deleted file mode 100644 index ea494fe93e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/Common.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.options.CompositeOption; -import org.ops4j.pax.exam.options.DefaultCompositeOption; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import static org.ops4j.pax.exam.CoreOptions.mavenBundle; -import static org.ow2.chameleon.testing.helpers.FestAssertOption.festAssertAsInProject; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - @Override - protected Option[] getCustomOptions() { - return new Option[] { - eventadmin(), - festAssertAsInProject() - }; - } - - public CompositeOption eventadmin() { - return new DefaultCompositeOption( - mavenBundle("org.apache.felix", "org.apache.felix.eventadmin", "1.2.10"), - mavenBundle("org.apache.felix", "org.apache.felix.ipojo.handler.eventadmin").versionAsInProject()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java deleted file mode 100644 index 9172c4b8ac..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestAggregateDependency.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.fail; - -public class TestAggregateDependency extends Common { - - private Element[] deps; - - @Before - public void setUp() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components" + - ".AggregateDependency"); - deps = meta.getElements("requires"); - } - - @Test - public void testCallbackBind() { - Element dep = getDependencyById(deps, "Bar"); - String opt = dep.getAttribute("aggregate"); - assertEquals("Check aggregate", "true", opt); - } - - @Test - public void testCallbackUnbind() { - Element dep = getDependencyById(deps, "Baz"); - String opt = dep.getAttribute("aggregate"); - assertEquals("Check aggregate", "true", opt); - } - - @Test - public void testBindOnly() { - Element dep = getDependencyById(deps, "bindonly"); - String opt = dep.getAttribute("aggregate"); - assertEquals("Check aggregate", "true", opt); - } - - @Test - public void testUnbindOnly() { - Element dep = getDependencyById(deps, "unbindonly"); - String opt = dep.getAttribute("aggregate"); - assertEquals("Check aggregate", "true", opt); - } - - private Element getDependencyById(Element[] deps, String name) { - for (int i = 0; i < deps.length; i++) { - String na = deps[i].getAttribute("id"); - String field = deps[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return deps[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return deps[i]; - } - } - fail("Dependency " + name + " not found"); - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java deleted file mode 100644 index 0eab45e2dd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestArchitecture.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestArchitecture extends Common { - - @Test - public void testArch() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components" + - ".Arch"); - String arch = meta.getAttribute("architecture"); - assertNotNull("Architecture exists ", arch); - assertEquals("Architecture value", "true", arch); - } - - @Test - public void testNoArch() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components" + - ".NoArch"); - String arch = meta.getAttribute("architecture"); - assertNotNull("Architecture exists ", arch); - assertEquals("Architecture value", "false", arch); - } - - -} - diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestContext.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestContext.java deleted file mode 100644 index 40ca96fb1a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestContext.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Before; -import org.junit.Test; -import org.ow2.chameleon.testing.helpers.MetadataHelper; - -import static junit.framework.Assert.assertEquals; -import static org.fest.assertions.Assertions.assertThat; - -/** - * Checks the parsing of the @Context annotation. - */ -public class TestContext extends Common { - - private Element[] contexts; - - - - @Before - public void setUp() { - Element meta = MetadataHelper.getMetadata(getTestBundle(), - "org.apache.felix.ipojo.runtime.core.test.components.context.ComponentUsingContext"); - contexts = meta.getElements("context"); - } - - @Test - public void testFieldInjection() { - Element tested = null; - for (Element element : contexts) { - if (element.containsAttribute("field")) { - tested = element; - } - } - assertThat(tested).isNotNull(); - - assertThat(tested.getAttribute("field")).isEqualToIgnoringCase("field"); - assertThat(tested.getAttribute("constructor-parameter")).isNull(); - assertThat(tested.getAttribute("method")).isNull(); - assertThat(tested.getAttribute("value")).isNull(); // Not set - } - - @Test - public void testConstructorInjection() { - Element tested = null; - for (Element element : contexts) { - if (element.containsAttribute("constructor-parameter")) { - tested = element; - } - } - assertThat(tested).isNotNull(); - - assertThat(tested.getAttribute("field")).isNull(); - assertThat(tested.getAttribute("method")).isNull(); - // 0 : Property, 1 context - assertThat(tested.getAttribute("constructor-parameter")).isEqualToIgnoringCase("1"); - assertThat(tested.getAttribute("value")).isEqualToIgnoringCase("COMPONENT"); - } - - @Test - public void testMethodInjection() { - Element tested = null; - for (Element element : contexts) { - if (element.containsAttribute("method")) { - tested = element; - } - } - assertThat(tested).isNotNull(); - - assertThat(tested.getAttribute("field")).isNull(); - assertThat(tested.getAttribute("parameter-index")).isNull(); - assertThat(tested.getAttribute("method")).isEqualToIgnoringCase("setContext"); - assertThat(tested.getAttribute("value")).isEqualToIgnoringCase("INSTANCE"); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java deleted file mode 100644 index 5cd3368363..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestCustomAnnotations.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -/** - * Checks the support of the custom annotation handlinig. - */ -public class TestCustomAnnotations extends Common { - - - @Test - public void testThatCustomAnnotationAreCorrectlyAdded() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.CustomAnnotationWithEnum"); - Element[] ann = meta.getElements("IPOJOFoo", "foo.ipojo"); - assertNotNull("Annotation exists ", ann); - } - - @Test - public void testThatCustomAnnotationAreSupportingEnums() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.CustomAnnotationWithEnum"); - Element[] ann = meta.getElements("IPOJOFoo", "foo.ipojo"); - assertNotNull("Annotation exists ", ann); - Element element = ann[0]; - // Simple value - assertEquals("RED", element.getAttribute("rgb")); - // Array (FELIX-3508). - assertEquals("{BLUE,RED}", element.getAttribute("colors")); - } - - -} - diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java deleted file mode 100644 index 7a26f230c5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependency.java +++ /dev/null @@ -1,187 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.*; - -public class TestDependency extends Common { - - - @Test - public void testDependencyDeclaration() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), - "org.apache.felix.ipojo.runtime.core.test.components.Dependency"); - Element[] deps = meta.getElements("requires"); - - // Check fs - Element dep = getDependencyById(deps, "fs"); - String field = dep.getAttribute("field"); - String id = dep.getAttribute("id"); - String bind = getBind(dep); - String unbind = getUnbind(dep); - assertNotNull("Check fs field", field); - assertEquals("Check fs field", "fs", field); - assertNull("Check fs bind", bind); - assertNull("Check fs unbind", unbind); - assertNull("Check fs id", id); - - // Check bar - dep = getDependencyById(deps, "Bar"); - field = dep.getAttribute("field"); - id = dep.getAttribute("id"); - bind = getBind(dep); - unbind = getUnbind(dep); - assertNull("Check bar field", field); - assertEquals("Check bar bind", "bindBar", bind); - assertEquals("Check bar unbind", "unbindBar", unbind); - assertEquals("Check bar id", "Bar", id); - - // Check baz - dep = getDependencyById(deps, "Baz"); - field = dep.getAttribute("field"); - id = dep.getAttribute("id"); - bind = getBind(dep); - unbind = getUnbind(dep); - assertNull("Check baz field", field); - assertEquals("Check baz bind", "bindBaz", bind); - assertEquals("Check baz unbind", "unbindBaz", unbind); - assertEquals("Check baz id", "Baz", id); - - // Check fs2 - dep = getDependencyById(deps, "fs2"); - field = dep.getAttribute("field"); - id = dep.getAttribute("id"); - bind = getBind(dep); - unbind = getUnbind(dep); - assertNotNull("Check fs2 field", field); - assertEquals("Check fs2 field", "fs2", field); - assertEquals("Check fs2 bind", "bindFS2", bind); - assertEquals("Check fs2 unbind", "unbindFS2", unbind); - - // Check fs2inv - dep = getDependencyById(deps, "fs2inv"); - field = dep.getAttribute("field"); - id = dep.getAttribute("id"); - bind = getBind(dep); - unbind = getUnbind(dep); - assertNotNull("Check fs2inv field", field); - assertEquals("Check fs2 field", "fs2inv", field); - assertEquals("Check fs2 bind", "bindFS2Inv", bind); - assertEquals("Check fs2 unbind", "unbindFS2Inv", unbind); - assertEquals("Check fs2 id", "inv", id); - - // Check mod - dep = getDependencyById(deps, "mod"); - id = dep.getAttribute("id"); - bind = getBind(dep); - unbind = getUnbind(dep); - String mod = getModified(dep); - assertEquals("Check mod bind", "bindMod", bind); - assertEquals("Check mod unbind", "unbindMod", unbind); - assertEquals("Check mod modified", "modifiedMod", mod); - assertEquals("Check mod id", "mod", id); - - // Check not proxied - dep = getDependencyById(deps, "notproxied"); - assertEquals("Check not proxied", "false", dep.getAttribute("proxy")); - } - - /** - * Reproduce https://issues.apache.org/jira/browse/FELIX-4380. - */ - @Test - public void testDependencyUsingSpecification() { - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.test" + - ".components.DependencyUsingSpecification"); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), - instance.getInstanceName()); - - assertNotNull(ref); - - CheckService svc = (CheckService) osgiHelper.getRawServiceObject(ref); - assertFalse(svc.check()); - - // The following instantiation exposes the BarService required by instance. - ComponentInstance bar = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core.test" + - ".components.ProvidesSimple"); - - assertTrue(svc.check()); - - bar.dispose(); - assertFalse(svc.check()); - } - - private Element getDependencyById(Element[] deps, String name) { - for (int i = 0; i < deps.length; i++) { - String na = deps[i].getAttribute("id"); - String field = deps[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return deps[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return deps[i]; - } - } - fail("Dependency " + name + " not found"); - return null; - } - - private String getBind(Element dep) { - Element[] elem = dep.getElements("callback"); - for (int i = 0; elem != null && i < elem.length; i++) { - if (elem[i].getAttribute("type").equalsIgnoreCase("bind")) { - return elem[i].getAttribute("method"); - } - } - return null; - } - - private String getUnbind(Element dep) { - Element[] elem = dep.getElements("callback"); - for (int i = 0; elem != null && i < elem.length; i++) { - if (elem[i].getAttribute("type").equalsIgnoreCase("unbind")) { - return elem[i].getAttribute("method"); - } - } - return null; - } - - private String getModified(Element dep) { - Element[] elem = dep.getElements("callback"); - for (int i = 0; elem != null && i < elem.length; i++) { - if (elem[i].getAttribute("type").equalsIgnoreCase("modified")) { - return elem[i].getAttribute("method"); - } - } - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java deleted file mode 100644 index e726a3f439..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestDependencyPolicy.java +++ /dev/null @@ -1,104 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.fail; - -public class TestDependencyPolicy extends Common { - - private Element[] deps; - - @Before - public void setUp() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.PolicyDependency"); - deps = meta.getElements("requires"); - } - - @Test - public void testField() { - Element dep = getDependencyById(deps, "fs"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - @Test - public void testFieldDPpolicy() { - Element dep = getDependencyById(deps, "fs2"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "dynamic-priority", opt); - } - - @Test - public void testCallbackBind() { - Element dep = getDependencyById(deps, "Bar"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - @Test - public void testCallbackUnbind() { - Element dep = getDependencyById(deps, "Baz"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - @Test - public void testBoth() { - Element dep = getDependencyById(deps, "inv"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - @Test - public void testBindOnly() { - Element dep = getDependencyById(deps, "bindonly"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - @Test - public void testUnbindOnly() { - Element dep = getDependencyById(deps, "unbindonly"); - String opt = dep.getAttribute("policy"); - assertEquals("Check policy", "static", opt); - } - - - private Element getDependencyById(Element[] deps, String name) { - for (Element dep : deps) { - String na = dep.getAttribute("id"); - String field = dep.getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return dep; - } - if (field != null && field.equalsIgnoreCase(name)) { - return dep; - } - } - fail("Dependency " + name + " not found"); - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java deleted file mode 100644 index acad7e8b28..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestEventAdmin.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class TestEventAdmin extends Common { - String type = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSub"; - String deprecated = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSubDeprecated"; - String publishes = "org.apache.felix.ipojo.runtime.core.test.components.event.PubSubWithPublishes"; - - String namespace = "org.apache.felix.ipojo.handlers.event"; - - Element component; - Element componentDeprecated; - Element componentWithPublishes; - - @Before - public void setUp() { - component = ipojoHelper.getMetadata(getTestBundle(), type); - componentDeprecated = ipojoHelper.getMetadata(getTestBundle(), deprecated); - componentWithPublishes = ipojoHelper.getMetadata(getTestBundle(), publishes); - assertNotNull("Check component", component); - assertNotNull("Check deprecated", componentDeprecated); - assertNotNull("Check publishes", componentWithPublishes); - - } - - @After - public void tearDown() { - component = null; - componentDeprecated = null; - componentWithPublishes = null; - } - - @Test - public void testP1() { - //P1, synchronous - Element elem = getElementByName("p1"); - checkPublisher(elem); - assertNull("Check topics", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher1", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("dataKey")); - } - - @Test - public void testP1WithPublishes() { - //P1, synchronous - Element elem = getPublishesByName("p1"); - checkPublishes(elem); - assertNull("Check topics", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher1", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("dataKey")); - } - - @Test - public void testP1Deprecated() { - //P1, synchronous - Element elem = getDeprecatedElementByName("p1"); - checkPublisher(elem); - assertNull("Check topics", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher1", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("data_key")); - } - - @Test - public void testP2() { - //name="p2", synchronous=false, topics="foo,bar", data_key="data" - Element elem = getElementByName("p2"); - checkPublisher(elem); - assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "false", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher2", elem.getAttribute("field")); - assertEquals("Check data_key", "data", elem.getAttribute("dataKey")); - } - - @Test - public void testP2WithPublishes() { - //name="p2", synchronous=false, topics="foo,bar", data_key="data" - Element elem = getPublishesByName("p2"); - checkPublishes(elem); - assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "false", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher2", elem.getAttribute("field")); - assertEquals("Check data_key", "data", elem.getAttribute("dataKey")); - } - - @Test - public void testP2Deprecated() { - //name="p2", synchronous=false, topics="foo,bar", data_key="data" - Element elem = getDeprecatedElementByName("p2"); - checkPublisher(elem); - assertEquals("Check topics (" + elem.getAttribute("topics") + ")", "foo,bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "false", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher2", elem.getAttribute("field")); - assertEquals("Check data_key", "data", elem.getAttribute("data_key")); - } - - @Test - public void testP3() { - //name="p3", synchronous=true, topics="bar" - Element elem = getElementByName("p3"); - checkPublisher(elem); - assertEquals("Check topics", "bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher3", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("dataKey")); - } - - @Test - public void testWithPublishesP3() { - //name="p3", synchronous=true, topics="bar" - Element elem = getPublishesByName("p3"); - checkPublishes(elem); - assertEquals("Check topics", "bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher3", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("dataKey")); - } - - @Test - public void testP3Deprecated() { - //name="p3", synchronous=true, topics="bar" - Element elem = getDeprecatedElementByName("p3"); - checkPublisher(elem); - assertEquals("Check topics", "bar", elem.getAttribute("topics")); - assertEquals("Check synchronous", "true", elem.getAttribute("synchronous")); - assertEquals("Check field", "publisher3", elem.getAttribute("field")); - assertNull("Check data_key", elem.getAttribute("data_key")); - } - - @Test - public void testS1() { - //name="s1", data_key="data" - Element elem = getElementByName("s1"); - checkSubscriber(elem); - assertNull("Check topics", elem.getAttribute("topics")); - assertEquals("Check method", "receive1", elem.getAttribute("method")); - assertEquals("Check data_key", "data", elem.getAttribute("dataKey")); - assertNull("Check data_type", elem.getAttribute("dataType")); - assertNull("Check filter", elem.getAttribute("filter")); - } - - @Test - public void testS1Deprecated() { - //name="s1", data_key="data" - Element elem = getDeprecatedElementByName("s1"); - checkSubscriber(elem); - assertNull("Check topics", elem.getAttribute("topics")); - assertEquals("Check method", "receive1", elem.getAttribute("method")); - assertEquals("Check data_key", "data", elem.getAttribute("data_key")); - assertNull("Check data_type", elem.getAttribute("data_type")); - assertNull("Check filter", elem.getAttribute("filter")); - } - - @Test - public void testS2() { - //name="s2", topics="foo,bar", filter="(foo=true)" - Element elem = getElementByName("s2"); - checkSubscriber(elem); - assertEquals("Check topics", "foo,bar", elem.getAttribute("topics")); - assertEquals("Check method", "receive2", elem.getAttribute("method")); - assertNull("Check data_key", elem.getAttribute("dataKey")); - assertNull("Check data_type", elem.getAttribute("dataType")); - assertEquals("Check filter", "(foo=true)", elem.getAttribute("filter")); - } - - @Test - public void testS2Deprecated() { - //name="s2", topics="foo,bar", filter="(foo=true)" - Element elem = getDeprecatedElementByName("s2"); - checkSubscriber(elem); - assertEquals("Check topics", "foo,bar", elem.getAttribute("topics")); - assertEquals("Check method", "receive2", elem.getAttribute("method")); - assertNull("Check data_key", elem.getAttribute("data_key")); - assertNull("Check data_type", elem.getAttribute("data_type")); - assertEquals("Check filter", "(foo=true)", elem.getAttribute("filter")); - } - - @Test - public void testS3() { - //name="s3", topics="foo", data_key="data", data_type="java.lang.String" - Element elem = getElementByName("s3"); - checkSubscriber(elem); - assertEquals("Check topics", "foo", elem.getAttribute("topics")); - assertEquals("Check method", "receive3", elem.getAttribute("method")); - assertEquals("Check data_key", "data", elem.getAttribute("dataKey")); - assertEquals("Check data_type", "java.lang.String", elem.getAttribute("dataType")); - assertNull("Check filter", elem.getAttribute("filter")); - } - - @Test - public void testS3Deprecated() { - //name="s3", topics="foo", data_key="data", data_type="java.lang.String" - Element elem = getDeprecatedElementByName("s3"); - checkSubscriber(elem); - assertEquals("Check topics", "foo", elem.getAttribute("topics")); - assertEquals("Check method", "receive3", elem.getAttribute("method")); - assertEquals("Check data_key", "data", elem.getAttribute("data_key")); - assertEquals("Check data_type", "java.lang.String", elem.getAttribute("data_type")); - assertNull("Check filter", elem.getAttribute("filter")); - } - - - public Element getElementByName(String name) { - Element[] elems = component.getElements(); - for (int i = 0; i < elems.length; i++) { - if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) { - return elems[i]; - } - } - return null; - } - - public Element getPublishesByName(String name) { - Element[] elems = componentWithPublishes.getElements(); - for (int i = 0; i < elems.length; i++) { - if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) { - return elems[i]; - } - } - return null; - } - - public Element getDeprecatedElementByName(String name) { - Element[] elems = componentDeprecated.getElements(); - for (int i = 0; i < elems.length; i++) { - if (elems[i].containsAttribute("name") && elems[i].getAttribute("name").equals(name)) { - return elems[i]; - } - } - return null; - } - - public void checkSubscriber(Element elem) { - assertNotNull("Can't check subscriber : null element", elem); - String ns = elem.getNameSpace(); - String nm = elem.getName(); - assertEquals("Elem is not a subscriber : bad namespace", namespace, ns); - assertEquals("Elem is not a subscriber : bad name", "subscriber", nm); - - } - - public void checkPublisher(Element elem) { - assertNotNull("Can't check publisher : null element", elem); - String ns = elem.getNameSpace(); - String nm = elem.getName(); - assertEquals("Elem is not a publisher : bad namespace", namespace, ns); - assertEquals("Elem is not a publisher : bad name", "publisher", nm); - } - - public void checkPublishes(Element elem) { - assertNotNull("Can't check publisher : null element", elem); - String ns = elem.getNameSpace(); - String nm = elem.getName(); - assertEquals("Elem is not a publisher : bad namespace", namespace, ns); - assertEquals("Elem is not a publisher : bad name", "publishes", nm); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java deleted file mode 100644 index 62ca1b1ef8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestExtender.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestExtender extends Common { - - String type = "org.apache.felix.ipojo.runtime.core.test.components.extender.Extender"; - String namespace = "org.apache.felix.ipojo.extender"; - - - @Test - public void testMetadata() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), type); - assertNotNull("Check meta", meta); - Element[] ext = meta.getElements("extender", namespace); - assertEquals("Check size", 1, ext.length); - String extension = ext[0].getAttribute("extension"); - String onArr = ext[0].getAttribute("onArrival"); - String onDep = ext[0].getAttribute("onDeparture"); - - assertEquals("Check extension", "foo", extension); - assertEquals("Check onArrival", "onArrival", onArr); - assertEquals("Check onDeparture", "onDeparture", onDep); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java deleted file mode 100644 index c00313826c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFactory.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class TestFactory extends Common { - - - @Test - public void testArchDeprecated() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FactoryDeprecated"); - String fact = meta.getAttribute("public"); - String name = meta.getAttribute("name"); - assertNotNull("Factory exists ", fact); - assertEquals("Factory value", "true", fact); - assertNotNull("Name exists ", name); - assertEquals("Name value", "org.apache.felix.ipojo.runtime.core.test.components.FactoryDeprecated", name); - } - - @Test - public void testArch() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Factory"); - String fact = meta.getAttribute("public"); - String name = meta.getAttribute("name"); - assertNotNull("Factory exists ", fact); - assertEquals("Factory value", "true", fact); - assertNotNull("Name exists ", name); - assertEquals("Name value", "factory", name); - } - - @Test - public void testNoArch() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.NoFactory"); - String fact = meta.getAttribute("public"); - String name = meta.getAttribute("name"); - assertNotNull("Factory exists ", fact); - assertEquals("Factory value", "false", fact); - assertNotNull("Name exists ", name); - assertEquals("Name value", "nofactory", name); - } - - @Test - public void testFactoryMethod() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethod"); - String method = meta.getAttribute("factory-method"); - assertNotNull("Method exists ", method); - assertEquals("Method value", "create", method); - } - - @Test - public void testFactoryMethodDeprecated() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethodDeprecated"); - String method = meta.getAttribute("factory-method"); - assertNotNull("Method exists ", method); - assertEquals("Method value", "create", method); - } - - @Test - public void testVersion() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ComponentTypeVersion"); - String version = meta.getAttribute("version"); - assertNotNull("Version exist", version); - assertEquals("Version value", "1.0.0", version); - } - - @Test - public void testNoVersion() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FactoryMethod"); - String version = meta.getAttribute("version"); - assertNull("No Version", version); - } - - -} - diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java deleted file mode 100644 index 27aee56796..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestFilteredDependency.java +++ /dev/null @@ -1,132 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -public class TestFilteredDependency extends Common { - - private Element[] deps; - private Element[] froms; - - - @Before - public void setUp() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FilteredDependency"); - deps = meta.getElements("requires"); - - Element meta2 = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.FromDependency"); - froms = meta2.getElements("requires"); - } - - @Test - public void testField() { - Element dep = getDependencyById(deps, "fs"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testCallbackBind() { - Element dep = getDependencyById(deps, "Bar"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testCallbackUnbind() { - Element dep = getDependencyById(deps, "Baz"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testBoth() { - Element dep = getDependencyById(deps, "inv"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testBindOnly() { - Element dep = getDependencyById(deps, "bindonly"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testUnbindOnly() { - Element dep = getDependencyById(deps, "unbindonly"); - String opt = dep.getAttribute("filter"); - assertEquals("Check filter", "(foo=bar)", opt); - } - - @Test - public void testFromField() { - Element dep = getDependencyById(froms, "fs"); - String from = dep.getAttribute("from"); - assertEquals("Check from", "X", from); - } - - @Test - public void testFromBind() { - Element dep = getDependencyById(froms, "fs2"); - String from = dep.getAttribute("from"); - assertEquals("Check from", "X", from); - } - - @Test - public void testFromUnbind() { - Element dep = getDependencyById(froms, "inv"); - String from = dep.getAttribute("from"); - assertEquals("Check from", "X", from); - } - - @Test - public void testNoFrom() { - Element dep = getDependencyById(froms, "Bar"); - String from = dep.getAttribute("from"); - assertNull("Check from", from); - } - - - private Element getDependencyById(Element[] deps, String name) { - for (int i = 0; i < deps.length; i++) { - String na = deps[i].getAttribute("id"); - String field = deps[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return deps[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return deps[i]; - } - } - fail("Dependency " + name + " not found"); - return null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java deleted file mode 100644 index aed4e2560b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiate.java +++ /dev/null @@ -1,128 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.junit.Test; -import org.osgi.framework.Bundle; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; - -import java.util.ArrayList; -import java.util.List; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class TestInstantiate extends Common { - - - @Test - public void testInstantiateSimple() { - Element[] meta = getInstanceMetadata(getTestBundle(), - "org.apache.felix.ipojo.runtime.core.test" + - ".components" + - ".InstantiateSimple"); - assertNotNull(meta); - assertEquals(1, meta.length); - assertNull(meta[0].getAttribute("name")); - assertEquals(0, meta[0].getElements().length); - } - - @Test - public void testInstantiateWithName() { - // Check instance tag - Element[] meta = getInstanceMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components" + - ".InstantiateWithName"); - assertNotNull(meta); - assertEquals(1, meta.length); - assertNotNull(meta[0].getAttribute("name")); - assertEquals("myInstantiatedInstance", meta[0].getAttribute("name")); - assertEquals(0, meta[0].getElements().length); - } - - @Test - public void testInstanceCreation() throws InvalidSyntaxException { - String in = "org.apache.felix.ipojo.runtime.core.test.components.InstantiateSimple-0"; - ServiceReference ref = ipojoHelper.getServiceReferenceByName(org.apache.felix.ipojo.architecture.Architecture.class.getName(), - in); - assertNotNull(ref); - } - - @Test - public void testInstanceCreationWithName() { - String in = "myInstantiatedInstance"; - ServiceReference ref = ipojoHelper.getServiceReferenceByName(org.apache.felix.ipojo.architecture.Architecture.class.getName(), - in); - assertNotNull(ref); - } - - /** - * Returns the instance metadatas of the component with the given name, - * defined in the given bundle. - * - * @param bundle the bundle from which the component is defined. - * @param component the name of the defined component. - * @return the list of instance metadata of the component with the given name, - * defined in the given bundle, or {@code null} if not found. - */ - public static Element[] getInstanceMetadata(Bundle bundle, String component) { - - // Retrieves the component description from the bundle's manifest. - String elem = (String) bundle.getHeaders().get("iPOJO-Components"); - if (elem == null) { - throw new IllegalArgumentException( - "Cannot find iPOJO-Components descriptor in the specified bundle (" - + bundle.getSymbolicName() - + "). Not an iPOJO bundle."); - } - - // Parses the retrieved description and find the component with the - // given name. - List list = new ArrayList(); - try { - Element element = ManifestMetadataParser.parseHeaderMetadata(elem); - Element[] childs = element.getElements("instance"); - for (int i = 0; i < childs.length; i++) { - String name = childs[i].getAttribute("component"); - if (name != null && name.equalsIgnoreCase(component)) { - list.add(childs[i]); - } - } - - if (list.isEmpty()) { - // Component not found... - return null; - } else { - return (Element[]) list.toArray(new Element[list.size()]); - } - - } catch (ParseException e) { - throw new IllegalStateException( - "Cannot parse the components from specified bundle (" - + bundle.getSymbolicName() + "): " + e.getMessage()); - } - } - -} - diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiatedComponent.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiatedComponent.java deleted file mode 100644 index f0b4fad7a7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestInstantiatedComponent.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.Architecture; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNotNull; - -/** - * Checks that a component setting a name and using the @Instantiate annotation creates the instance correctly. - * It reproduce {@link https://issues.apache.org/jira/browse/FELIX-4052} - */ -public class TestInstantiatedComponent extends Common { - - @Test - public void testInstanceCreation() { - // This is the expected name. - Architecture architecture = osgiHelper.getServiceObject(Architecture.class, - "(architecture.instance=MyInstantiatedComponent-0)"); - - assertNotNull(architecture); - assertEquals(ComponentInstance.VALID, architecture.getInstanceDescription().getState()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java deleted file mode 100644 index 074a600ea0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestJMX.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestJMX extends Common { - - - @Test - public void testDeprecated() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.jmx.JMXDeprecated"); - /* - * org.apache.felix.ipojo.handlers.jmx:config domain="my-domain" usesmosgi="false" - org.apache.felix.ipojo.handlers.jmx:property field="m_foo" name="prop" rights="w" notification="true" - org.apache.felix.ipojo.handlers.jmx:method description="get the foo prop" method="getFoo" - org.apache.felix.ipojo.handlers.jmx:method description="set the foo prop" method="setFoo" - */ - - Element[] ele = meta.getElements("config", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("ele not null", ele); - assertEquals("Ele size", 1, ele.length); - String domain = ele[0].getAttribute("domain"); - String mosgi = ele[0].getAttribute("usesmosgi"); - assertEquals("domain", "my-domain", domain); - assertEquals("mosgi", "false", mosgi); - - Element[] props = ele[0].getElements("property", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("props not null", props); - assertEquals("props size", 1, props.length); - - Element[] methods = ele[0].getElements("method", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("methods not null", methods); - assertEquals("methods size", 2, methods.length); - } - - @Test - public void test() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.jmx.JMXSimple"); - /* - * org.apache.felix.ipojo.handlers.jmx:config domain="my-domain" usesmosgi="false" - org.apache.felix.ipojo.handlers.jmx:property field="m_foo" name="prop" rights="w" notification="true" - org.apache.felix.ipojo.handlers.jmx:method description="get the foo prop" method="getFoo" - org.apache.felix.ipojo.handlers.jmx:method description="set the foo prop" method="setFoo" - */ - - Element[] ele = meta.getElements("config", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("ele not null", ele); - assertEquals("Ele size", 1, ele.length); - String domain = ele[0].getAttribute("domain"); - String mosgi = ele[0].getAttribute("usesmosgi"); - assertEquals("domain", "my-domain", domain); - assertEquals("mosgi", "false", mosgi); - - Element[] props = ele[0].getElements("JMXProperty", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("props not null", props); - assertEquals("props size", 1, props.length); - - Element[] methods = ele[0].getElements("JMXMethod", "org.apache.felix.ipojo.handlers.jmx"); - assertNotNull("methods not null", methods); - assertEquals("methods size", 2, methods.length); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java deleted file mode 100644 index 458e7081e6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleCallbacks.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestLifecycleCallbacks extends Common { - - - @Test - public void testCallbacks() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Lifecycle"); - Element[] cbs = meta.getElements("callback"); - assertNotNull("Callbacks exists ", cbs); - assertEquals("Callbacks count ", 2, cbs.length); - - Element elem = getCallbackByMethodName(cbs, "start"); - assertEquals("Check start method", "start", elem.getAttribute("method")); - assertEquals("Check start transition", "validate", elem.getAttribute("transition")); - - elem = getCallbackByMethodName(cbs, "stop"); - assertEquals("Check stop method", "stop", elem.getAttribute("method")); - assertEquals("Check stop transition", "invalidate", elem.getAttribute("transition")); - } - - @Test - public void testImmediate() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Immediate"); - assertNotNull("Immediate attribute", meta.getAttribute("immediate")); - assertEquals("Immediate attribute value", "true", meta.getAttribute("immediate")); - } - - @Test - public void testNoImmediate() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.NoImmediate"); - assertNotNull("Immediate attribute", meta.getAttribute("immediate")); - assertEquals("Immediate attribute value", "false", meta.getAttribute("immediate")); - } - - private Element getCallbackByMethodName(Element[] cbs, String method) { - for (int i = 0; i < cbs.length; i++) { - String met = cbs[i].getAttribute("method"); - if (met != null && met.equalsIgnoreCase(method)) { - return cbs[i]; - } - } - fail("Cannot found the callback with the method " + method); - return null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java deleted file mode 100644 index 928ecf43fd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestLifecycleController.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - -public class TestLifecycleController extends Common { - - @Test - public void testLFC() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Lifecycle"); - Element[] ctrls = meta.getElements("controller"); - assertNotNull("Controller exists ", ctrls); - Element ctrl = ctrls[0]; - assertNotNull("Field", ctrl.getAttribute("field")); - assertEquals("Field", "lfc", ctrl.getAttribute("field")); - } - - -} - diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java deleted file mode 100644 index 0a58108380..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestOptionalDependency.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestOptionalDependency extends Common { - - private Element[] deps; - - @Before - public void setUp() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.OptionalDependency"); - deps = meta.getElements("requires"); - } - - @Test - public void testField() { - Element dep = getDependencyById(deps, "fs"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testFieldNoOptional() { - Element dep = getDependencyById(deps, "fs2"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "false", opt); - } - - @Test - public void testCallbackBind() { - Element dep = getDependencyById(deps, "Bar"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testCallbackUnbind() { - Element dep = getDependencyById(deps, "Baz"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testBoth() { - Element dep = getDependencyById(deps, "inv"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testBindOnly() { - Element dep = getDependencyById(deps, "bindonly"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testUnbindOnly() { - Element dep = getDependencyById(deps, "unbindonly"); - String opt = dep.getAttribute("optional"); - assertEquals("Check optionality", "true", opt); - } - - @Test - public void testNullable() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.NullableDependency"); - Element[] deps = meta.getElements("requires"); - Element fs = getDependencyById(deps, "fs"); - String nullable = fs.getAttribute("nullable"); - assertNotNull("Check nullable", nullable); - assertEquals("Check nullable value", "true", nullable); - } - - @Test - public void testNoNullable() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.NullableDependency"); - Element[] deps = meta.getElements("requires"); - Element fs = getDependencyById(deps, "fs2"); - String nullable = fs.getAttribute("nullable"); - assertNotNull("Check nullable", nullable); - assertEquals("Check nullable value", "false", nullable); - } - - @Test - public void testDefaultImplementation() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.DefaultImplementationDependency"); - Element[] deps = meta.getElements("requires"); - Element fs = getDependencyById(deps, "fs"); - String di = fs.getAttribute("default-implementation"); - assertNotNull("Check DI", di); - assertEquals("Check DI value", "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple", di); - } - - - private Element getDependencyById(Element[] deps, String name) { - for (int i = 0; i < deps.length; i++) { - String na = deps[i].getAttribute("id"); - String field = deps[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return deps[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return deps[i]; - } - } - fail("Dependency " + name + " not found"); - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java deleted file mode 100644 index 3f54706b8c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestProperties.java +++ /dev/null @@ -1,189 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.*; - -public class TestProperties extends Common { - - @Test - public void testProperties() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Properties"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - Element[] props = prov.getElements("property"); - assertEquals("Number of properties", props.length, 5); - //Foo - Element foo = getPropertyByName(props, "foo"); - assertEquals("Check foo field", "m_foo", foo.getAttribute("field")); - assertEquals("Check foo name", "foo", foo.getAttribute("name")); - //Bar - Element bar = getPropertyByName(props, "bar"); - assertEquals("Check bar field", "bar", bar.getAttribute("field")); - assertEquals("Check bar value", "4", bar.getAttribute("value")); - //Boo - Element boo = getPropertyByName(props, "boo"); - assertEquals("Check boo field", "boo", boo.getAttribute("field")); - assertEquals("Check boo method", "setboo", boo.getAttribute("method")); - //Baa - Element baa = getPropertyByName(props, "baa"); - assertEquals("Check baa field", "m_baa", baa.getAttribute("field")); - assertEquals("Check baa name", "baa", baa.getAttribute("name")); - assertEquals("Check baa method", "setbaa", baa.getAttribute("method")); - assertEquals("Check mandatory", "true", baa.getAttribute("mandatory")); - - - //Bar - Element baz = getPropertyByName(props, "baz"); - assertEquals("Check baz method", "setbaz", baz.getAttribute("method")); - assertEquals("Check baz name", "baz", baz.getAttribute("name")); - } - - @Test - public void testAbsentPropagation() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Properties"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("propagation"); - assertNull("Propagation", att); - } - - @Test - public void testPropagation() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Propagation"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("propagation"); - assertNotNull("Propagation", att); - assertEquals("Propagation value", "true", att); - } - - @Test - public void testNoPropagation() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.NoPropagation"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("propagation"); - assertNotNull("Propagation", att); - assertEquals("Propagation value", "false", att); - } - - @Test - public void testPID() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ManagedServicePID"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNotNull("PID", att); - assertEquals("PID Value", "MyPID", att); - } - - @Test - public void testAbsentPID() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.Properties"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNull("PID", att); - } - - @Test - public void testPropagationAndPID() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.PropagationandPID"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNotNull("PID", att); - assertEquals("PID Value", "MyPID", att); - att = prov.getAttribute("propagation"); - assertNotNull("Propagation", att); - assertEquals("Propagation value", "true", att); - } - - @Test - public void testPIDAndPropagation() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.PIDandPropagation"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNotNull("PID", att); - assertEquals("PID Value", "MyPID", att); - att = prov.getAttribute("propagation"); - assertNotNull("Propagation", att); - assertEquals("Propagation value", "true", att); - } - - @Test - public void testUpdatedAndPID() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.UpdatedWithManagedService"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNotNull("PID", att); - assertEquals("PID Value", "MyPID", att); - - att = prov.getAttribute("updated"); - assertNotNull("att", att); - assertEquals("Updated Value", "after", att); - } - - @Test - public void testUpdatedAndProperties() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.UpdatedWithProperties"); - Element[] provs = meta.getElements("properties"); - assertNotNull("Properties exists ", provs); - Element prov = provs[0]; - String att = prov.getAttribute("pid"); - assertNull("PID", att); - - att = prov.getAttribute("updated"); - assertNotNull("att", att); - assertEquals("Updated Value", "after", att); - } - - private Element getPropertyByName(Element[] props, String name) { - for (int i = 0; i < props.length; i++) { - String na = props[i].getAttribute("name"); - String field = props[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return props[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return props[i]; - } - } - fail("Property " + name + " not found"); - return null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java deleted file mode 100644 index b1fa4c7986..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestRankedDependency.java +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.test.components.MyComparator; -import org.junit.Before; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.fail; - -public class TestRankedDependency extends Common { - - private Element[] deps; - - @Before - public void setUp() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.RankedDependency"); - deps = meta.getElements("requires"); - } - - @Test - public void testField() { - Element dep = getDependencyById(deps, "fs"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - @Test - public void testCallbackBind() { - Element dep = getDependencyById(deps, "Bar"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - @Test - public void testCallbackUnbind() { - Element dep = getDependencyById(deps, "Baz"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - @Test - public void testBoth() { - Element dep = getDependencyById(deps, "inv"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - @Test - public void testBindOnly() { - Element dep = getDependencyById(deps, "bindonly"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - @Test - public void testUnbindOnly() { - Element dep = getDependencyById(deps, "unbindonly"); - String opt = dep.getAttribute("comparator"); - assertEquals("Check comparator", "org.apache.felix.ipojo.runtime.core.test.components.MyComparator", opt); - } - - - private Element getDependencyById(Element[] deps, String name) { - for (int i = 0; i < deps.length; i++) { - String na = deps[i].getAttribute("id"); - String field = deps[i].getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return deps[i]; - } - if (field != null && field.equalsIgnoreCase(name)) { - return deps[i]; - } - } - fail("Dependency " + name + " not found"); - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProviding.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProviding.java deleted file mode 100644 index c92393976d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestServiceProviding.java +++ /dev/null @@ -1,204 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ParseUtils; -import org.apache.felix.ipojo.runtime.core.test.services.CheckService; -import org.apache.felix.ipojo.runtime.core.test.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; - -import java.util.List; - -import static junit.framework.Assert.*; - -public class TestServiceProviding extends Common { - - @Test - public void testProvidesSimple() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - } - - @Test - public void testProvidesDouble() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesDouble"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - } - - @Test - public void testProvidesTriple() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesTriple"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - Element prov = provs[0]; - String itfs = prov.getAttribute("specifications"); - List list = ParseUtils.parseArraysAsList(itfs); - assertTrue("Provides CS ", list.contains(CheckService.class.getName())); - } - - @Test - public void testProvidesQuatro() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesQuatro"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - Element prov = provs[0]; - String itfs = prov.getAttribute("specifications"); - List list = ParseUtils.parseArraysAsList(itfs); - assertTrue("Provides CS ", list.contains(CheckService.class.getName())); - assertTrue("Provides Foo ", list.contains(FooService.class.getName())); - } - - @Test - public void testProperties() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesProperties"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - Element prov = provs[0]; - Element[] props = prov.getElements("property"); - assertEquals("Number of properties", props.length, 5); - //Foo - Element foo = getPropertyByName(props, "foo"); - assertEquals("Check foo field", "m_foo", foo.getAttribute("field")); - assertEquals("Check foo name", "foo", foo.getAttribute("name")); - //Bar - Element bar = getPropertyByName(props, "bar"); - assertEquals("Check bar field", "bar", bar.getAttribute("field")); - assertEquals("Check bar value", "4", bar.getAttribute("value")); - assertEquals("Check mandatory value", "true", bar.getAttribute("mandatory")); - //Boo - Element boo = getPropertyByName(props, "boo"); - assertEquals("Check boo field", "boo", boo.getAttribute("field")); - //Baa - Element baa = getPropertyByName(props, "baa"); - assertEquals("Check baa field", "m_baa", baa.getAttribute("field")); - assertEquals("Check baa name", "baa", baa.getAttribute("name")); - - //Bar - Element baz = getPropertyByName(props, "baz"); - assertEquals("Check baz field", "m_baz", baz.getAttribute("field")); - assertEquals("Check baz name", "baz", baz.getAttribute("name")); - } - - @Test - public void testStaticProperties() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.ProvidesStaticProperties"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - Element prov = provs[0]; - Element[] props = prov.getElements("property"); - assertEquals("Number of properties", props.length, 9); - //Prop1 - Element foo = getPropertyByName(props, "prop1"); - assertNull(foo.getAttribute("field")); - assertEquals("prop1", foo.getAttribute("value")); - - //Prop2 - Element prop2 = getPropertyByName(props, "prop2"); - assertNull(prop2.getAttribute("field")); - assertNull(prop2.getAttribute("value")); - - // Props - Element prop = getPropertyByName(props, "props"); - assertNull(prop.getAttribute("field")); - assertEquals("{prop1, prop2}", prop.getAttribute("value")); - - // Mandatory - Element mandatory = getPropertyByName(props, "mandatory1"); - assertNull(mandatory.getAttribute("field")); - assertNull(mandatory.getAttribute("value")); - assertEquals("true", mandatory.getAttribute("mandatory")); - - //Bar - Element bar = getPropertyByName(props, "bar"); - assertEquals("Check bar field", "bar", bar.getAttribute("field")); - assertEquals("Check bar value", "4", bar.getAttribute("value")); - assertEquals("Check mandatory value", "true", bar.getAttribute("mandatory")); - //Boo - Element boo = getPropertyByName(props, "boo"); - assertEquals("Check boo field", "boo", boo.getAttribute("field")); - //Baa - Element baa = getPropertyByName(props, "baa"); - assertEquals("Check baa field", "m_baa", baa.getAttribute("field")); - assertEquals("Check baa name", "baa", baa.getAttribute("name")); - - //Bar - Element baz = getPropertyByName(props, "baz"); - assertEquals("Check baz field", "m_baz", baz.getAttribute("field")); - assertEquals("Check baz name", "baz", baz.getAttribute("name")); - } - - @Test - public void testServiceController() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.PSServiceController"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - System.out.println(provs[0].toString()); - assertNotNull(provs[0].getElements("controller")); - assertEquals(1, provs[0].getElements("controller").length); - assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value")); - } - - @Test - public void testServiceControllerWithSpecification() { - Element meta = IPOJOHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.PSServiceControllerSpec"); - Element[] provs = meta.getElements("provides"); - assertNotNull("Provides exists ", provs); - System.out.println(provs[0].toString()); - assertNotNull(provs[0].getElements("controller")); - assertEquals(2, provs[0].getElements("controller").length); - assertEquals("false", provs[0].getElements("controller")[0].getAttribute("value")); - assertEquals(FooService.class.getName(), provs[0].getElements("controller")[0].getAttribute("specification")); - } - - /** - * Checks that declared static properties. - * It used 'org.apache.felix.ipojo.runtime.core.test.components.components.ComponentWithProperties' - * This test is related to : https://issues.apache.org/jira/browse/FELIX-4053 - */ - @Test - public void testPublishedStaticProperties() { - ServiceReference reference = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), - "instanceWithProperties"); - assertNotNull(reference); - } - - private Element getPropertyByName(Element[] props, String name) { - for (Element prop : props) { - String na = prop.getAttribute("name"); - String field = prop.getAttribute("field"); - if (na != null && na.equalsIgnoreCase(name)) { - return prop; - } - if (field != null && field.equalsIgnoreCase(name)) { - return prop; - } - } - fail("Property " + name + " not found"); - return null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java deleted file mode 100644 index 31dc546e7f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestTemporalDependencies.java +++ /dev/null @@ -1,197 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; -import static org.junit.Assert.assertNotNull; - -public class TestTemporalDependencies extends Common { - - - @Test - public void testSimple() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalSimple"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - String to = provs[0].getAttribute("timeout"); - assertNull("No timeout", to); - String oto = provs[0].getAttribute("onTimeout"); - assertNull("No onTimeout", oto); - } - - @Test - public void testTemporal() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.Temporal"); - Element[] provs = meta.getElements("temporal", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - String to = provs[0].getAttribute("timeout"); - assertNull("No timeout", to); - String oto = provs[0].getAttribute("onTimeout"); - assertNull("No onTimeout", oto); - } - - @Test - public void testDI() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithDI"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String oto = provs[0].getAttribute("onTimeout"); - assertEquals("onTimeout is the DI", "org.apache.felix.ipojo.runtime.core.test.components.ProvidesSimple", oto); - - } - - @Test - public void testEmptyArray() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithEmptyArray"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String oto = provs[0].getAttribute("onTimeout"); - assertEquals("onTimeout is empty-array", "empty-array", oto); - - } - - @Test - public void testNull() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithNull"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String oto = provs[0].getAttribute("onTimeout"); - assertEquals("onTimeout is null", "null", oto); - - } - - @Test - public void testNullable() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithNullable"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String oto = provs[0].getAttribute("onTimeout"); - assertEquals("onTimeout is nullable", "nullable", oto); - - } - - @Test - public void testFilter() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithFilter"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String filter = provs[0].getAttribute("filter"); - assertEquals("Filter", "(vendor=clement)", filter); - - } - - @Test - public void testTimeout() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalWithTimeout"); - Element[] provs = meta.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - String field = provs[0].getAttribute("field"); - assertNotNull("Field not null", field); - assertEquals("Field is fs", "fs", field); - - String to = provs[0].getAttribute("timeout"); - assertEquals("Check timeout", "100", to); - - } - - @Test - public void testSimpleCollection() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection"); - Element dep = getElementPerField(meta, "fs1"); - String spec = dep.getAttribute("specification"); - assertNotNull("Specification not null", spec); - assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec); - } - - @Test - public void testCollectionWithTimeout() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection"); - Element dep = getElementPerField(meta, "fs2"); - String spec = dep.getAttribute("specification"); - assertNotNull("Specification not null", spec); - assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec); - String to = dep.getAttribute("timeout"); - assertEquals("Check timeout", "300", to); - } - - @Test - public void testCollectionWithPolicy() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection"); - Element dep = getElementPerField(meta, "fs3"); - String spec = dep.getAttribute("specification"); - assertNotNull("Specification not null", spec); - assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec); - String to = dep.getAttribute("ontimeout"); - assertEquals("Check policy", "empty", to); - } - - @Test - public void testCollectionWithProxy() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), "org.apache.felix.ipojo.runtime.core.test.components.temporal.TemporalCollection"); - Element dep = getElementPerField(meta, "fs4"); - String spec = dep.getAttribute("specification"); - assertNotNull("Specification not null", spec); - assertEquals("Check specification", "org.apache.felix.ipojo.runtime.core.test.services.FooService", spec); - String proxy = dep.getAttribute("proxy"); - assertEquals("Check proxy", "true", proxy); - } - - private Element getElementPerField(Element elem, String field) { - Element[] provs = elem.getElements("requires", "org.apache.felix.ipojo.handler.temporal"); - assertNotNull("Temporal exists ", provs); - for (int i = 0; i < provs.length; i++) { - if (provs[i].getAttribute("field").equals(field)) { - return provs[i]; - } - } - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java b/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java deleted file mode 100644 index 097ba9c6d0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-annotations-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/annotations/TestWhiteBoard.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.annotations; - -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class TestWhiteBoard extends Common { - - String typeWI = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoardWIModification"; - String typeWO = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoardWOModification"; - String typeWhiteboards = "org.apache.felix.ipojo.runtime.core.test.components.whiteboard.WhiteBoards"; - String namespace = "org.apache.felix.ipojo.whiteboard"; - - - @Test - public void testMetadataWithOnModification() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), typeWI); - assertNotNull("Check meta", meta); - Element[] ext = meta.getElements("wbp", namespace); - assertEquals("Check size", 1, ext.length); - String filter = ext[0].getAttribute("filter"); - String onArr = ext[0].getAttribute("onArrival"); - String onDep = ext[0].getAttribute("onDeparture"); - String onMod = ext[0].getAttribute("onModification"); - - - assertEquals("Check filter", "(foo=true)", filter); - assertEquals("Check onArrival", "onArrival", onArr); - assertEquals("Check onDeparture", "onDeparture", onDep); - assertEquals("Check onModification", "onModification", onMod); - - } - - @Test - public void testMetadataWithoutOnModification() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), typeWO); - assertNotNull("Check meta", meta); - Element[] ext = meta.getElements("wbp", namespace); - assertEquals("Check size", 1, ext.length); - String filter = ext[0].getAttribute("filter"); - String onArr = ext[0].getAttribute("onArrival"); - String onDep = ext[0].getAttribute("onDeparture"); - String onMod = ext[0].getAttribute("onModification"); - - - assertEquals("Check filter", "(foo=true)", filter); - assertEquals("Check onArrival", "onArrival", onArr); - assertEquals("Check onDeparture", "onDeparture", onDep); - assertNull("Check onModification", onMod); - - } - - @Test - public void testWhiteboards() { - Element meta = ipojoHelper.getMetadata(getTestBundle(), typeWhiteboards); - assertNotNull("Check meta", meta); - Element[] ext = meta.getElements("whiteboards", namespace); - assertEquals("Check size", 1, ext.length); - - // Two sub-element - Element[] wbps = ext[0].getElements("wbp", namespace); - assertEquals("Check size", 2, wbps.length); - - String filter = wbps[0].getAttribute("filter"); - String onArr = wbps[0].getAttribute("onArrival"); - String onDep = wbps[0].getAttribute("onDeparture"); - String onMod = wbps[0].getAttribute("onModification"); - - assertEquals("Check filter", "(foo=true)", filter); - assertEquals("Check onArrival", "onArrival", onArr); - assertEquals("Check onDeparture", "onDeparture", onDep); - assertNull("Check onModification", onMod); - - filter = wbps[1].getAttribute("filter"); - onArr = wbps[1].getAttribute("onArrival"); - onDep = wbps[1].getAttribute("onDeparture"); - onMod = wbps[1].getAttribute("onModification"); - - assertEquals("Check filter", "(foo=true)", filter); - assertEquals("Check onArrival", "onArrival", onArr); - assertEquals("Check onDeparture", "onDeparture", onDep); - assertEquals("Check onModification", "onModification", onMod); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/pom.xml deleted file mode 100644 index 53edfc0da1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-bad-configuration-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java deleted file mode 100644 index 54b3c2d137..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/BadConstructors.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -public class BadConstructors { - - public BadConstructors() { - throw new Error("BAD"); - } - - public BadConstructors(int i) { - // DO NOTHING - } - - public static BadConstructors createBad() { - throw new RuntimeException("BAD"); - } - - public static BadConstructors createBad2(int o) { - return new BadConstructors(o); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java deleted file mode 100644 index b768a00f07..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CallbackCheckService.java +++ /dev/null @@ -1,68 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -import org.apache.felix.ipojo.runtime.bad.services.CheckService; -import org.apache.felix.ipojo.runtime.bad.services.FooService; - -import java.util.Properties; - -public class CallbackCheckService extends ParentClass implements CheckService { - - int i = 0; - - FooService fs; - - public static CallbackCheckService singleton; - - public static int count = 0; - - private static CallbackCheckService singleton() { - if (singleton == null) { - count++; - singleton = new CallbackCheckService(); - } - return singleton; - } - - public static CallbackCheckService several() { - count++; - return new CallbackCheckService(); - } - - private void start() { - i++; - } - - protected void stop() { - i++; - } - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties p = new Properties(); - p.put("int", new Integer(i)); - p.put("count", new Integer(count)); - return p; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java deleted file mode 100644 index abd757b21e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -import org.apache.felix.ipojo.runtime.bad.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java deleted file mode 100644 index 2bb590871d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -import org.apache.felix.ipojo.runtime.bad.services.CheckService; -import org.apache.felix.ipojo.runtime.bad.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java deleted file mode 100644 index ed544f617d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/LifecycleControllerTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -import org.apache.felix.ipojo.runtime.bad.services.CheckService; - -import java.util.Properties; - -public class LifecycleControllerTest implements CheckService { - - private boolean m_state = true; - private String m_conf; - - public void setConf(String newConf) { - if (newConf.equals("foo")) { - m_state = true; - } else { - m_state = false; - } - } - - public boolean check() { - return m_state; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("conf", m_conf); - props.put("state", new Boolean(m_state)); - return props; - } -} - diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java deleted file mode 100644 index 3f5cd246fb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/components/ParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.bad.components; - -public class ParentClass { - - public void parentStart() { - - } - - public void parentStop() { - - } - - protected String[] strings; - - protected String string; - - protected int upStrings; - - protected int upString; - - public void updateStrings(String[] bb) { - strings = bb; - upStrings++; - } - - public void updateString(String bb) { - string = bb; - upString++; - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java deleted file mode 100644 index e204c9f645..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.bad.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java deleted file mode 100644 index 79025f807e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.bad.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java deleted file mode 100644 index 1d3c907bfd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/bad/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.bad.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml deleted file mode 100644 index f2308b3b9e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java deleted file mode 100644 index a25d9c9d1f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/Common.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.bad.test; - -import org.ow2.chameleon.testing.helpers.BaseTest; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - // Nothing to customize. - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java deleted file mode 100644 index 08f79cad51..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadFactories.java +++ /dev/null @@ -1,140 +0,0 @@ -/* - * 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.ipojo.runtime.bad.test; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.junit.Test; - -import static org.junit.Assert.fail; - -public class TestBadFactories extends Common { - - private Element getElementFactoryWithNoClassName() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("name", "noclassname")); - return elem; - } - - private Element getElementHandlerFactoryWithNoClassName() { - Element elem = new Element("handler", ""); - elem.addAttribute(new Attribute("name", "noclassname")); - return elem; - } - - private Element getElementHandlerFactoryWithNoName() { - Element elem = new Element("handler", ""); - elem.addAttribute(new Attribute("className", "noclassname")); - return elem; - } - - @Test - public void testBadFactory() { - try { - new ComponentFactory(osgiHelper.getContext(), getElementFactoryWithNoClassName()); - fail("A factory with no class name must be rejected"); - } catch (ConfigurationException e) { - // OK. - } - } - - @Test - public void testBadHandlerFactory1() { - try { - new HandlerManagerFactory(osgiHelper.getContext(), getElementHandlerFactoryWithNoClassName()); - fail("An handler factory with no class name must be rejected"); - } catch (ConfigurationException e) { - // OK. - } - } - - @Test - public void testBadHandlerFactory2() { - try { - new HandlerManagerFactory(osgiHelper.getContext(), getElementHandlerFactoryWithNoName()); - fail("An handler factory with no name must be rejected"); - } catch (ConfigurationException e) { - // OK. - } - } - - @Test - public void testCreationOnBadConstructor() { - Factory factory = ipojoHelper.getFactory("BAD-BadConstructor"); - ComponentInstance ci; - try { - // Change in Felix-966, now throws a runtime exception - ci = factory.createComponentInstance(null); - //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState()); - ci.dispose(); - fail("Exception expected"); - } catch (Throwable e) { - //fail("Exception unexpected : " + e.getMessage()); - // OK - } - } - - @Test - public void testCreationOnBadFactory() { - Factory factory = ipojoHelper.getFactory("BAD-BadFactory"); - ComponentInstance ci; - try { - // Change in Felix-966, now throw a runtime exception - ci = factory.createComponentInstance(null); - //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState()); - ci.dispose(); - fail("Exception expected"); - } catch (Throwable e) { - //fail("Exception unexpected : " + e.getMessage()); - //OK - } - } - - @Test - public void testCreationOnBadFactory2() { - Factory factory = ipojoHelper.getFactory("BAD-BadFactory2"); - ComponentInstance ci; - try { - // Change in Felix-966, now throw a runtime exception - ci = factory.createComponentInstance(null); - //assertEquals("Check ci create error", ComponentInstance.STOPPED, ci.getState()); - ci.dispose(); - fail("Exception expected"); - } catch (Throwable e) { - //fail("Exception unexpected : " + e.getMessage()); - //Ok - } - } - - @Test - public void testNoManipulationMetadata() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.test.scenarios.component.CallbackCheckService")); - try { - ComponentFactory fact = new ComponentFactory(osgiHelper.getContext(), elem); - fact.stop(); - fail("A factory with no manipulation metadata must be rejected"); - } catch (ConfigurationException e) { - // OK. - } - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java deleted file mode 100644 index 2574099c12..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCCallback.java +++ /dev/null @@ -1,262 +0,0 @@ -/* - * 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.ipojo.runtime.bad.test; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.junit.Before; -import org.junit.Test; - -import java.util.Properties; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestBadLFCCallback extends Common { - - private String clazz = "org.apache.felix.ipojo.runtime.bad.components.CallbackCheckService"; - private String type = "BAD-CallbackCheckService"; - private Element manipulation; - private Properties props; - - @Before - public void setUp() { - manipulation = getManipulationForComponent(); - props = new Properties(); - props.put("instance.name", "BAD"); - } - - - private Element getNothing() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getNoTransition() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("method", "start")); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getNoMethod() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("transition", "validate")); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadMethod() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("transition", "validate")); - callback.addAttribute(new Attribute("method", "start_")); // Missing method. - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadMethod2() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("transition", "invalidate")); - callback.addAttribute(new Attribute("method", "stop_")); // Missing method. - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadTransition() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("method", "start")); - callback.addAttribute(new Attribute("transition", "validate_")); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getManipulationForComponent() { - // On KF we must cast the result. - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - Element manip = getManipulationForComponent(elem, type); - assertNotNull("Check manipulation metadata not null for " + type, manip); - return manip; - } - - private Element getManipulationForComponent(Element metadata, String comp_name) { - Element[] comps = metadata.getElements("component"); - for (int i = 0; i < comps.length; i++) { - if (comps[i].containsAttribute("factory") && comps[i].getAttribute("factory").equals(comp_name)) { - return comps[i].getElements("manipulation")[0]; - } - if (comps[i].containsAttribute("name") && comps[i].getAttribute("name").equals(comp_name)) { - return comps[i].getElements("manipulation")[0]; - } - } - return null; - } - - @Test - public void testNothing() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNothing()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A lifecycle callback with a missing method and transition must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testNoTransition() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoTransition()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A lifecycle callback with a missing transition must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testNoMethod() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoMethod()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A lifecycle callback with a missing method must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadMethod() { - try { - ComponentFactory cf = new ComponentFactory(getTestBundle().getBundleContext(), getBadMethod()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - if (ci.isStarted()) { - fail("A lifecycle callback with a bad method must be rejected (instance stills valid)" + cf); - } - ci.dispose(); - cf.stop(); - } catch (ConfigurationException e) { - //The check does not happen in the configure method. - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadMethod2() { - try { - ComponentFactory cf = new ComponentFactory(getTestBundle().getBundleContext(), getBadMethod2()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.stop(); - if (ci.isStarted()) { - fail("A lifecycle callback with a bad method must be rejected (instance stills valid)" + cf); - } - ci.dispose(); - cf.stop(); - } catch (ConfigurationException e) { - //The check does not happen in the configure method. - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadTransition() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadTransition()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A lifecycle callback with a bad transition must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java deleted file mode 100644 index 814c882c0d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadLFCController.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.ipojo.runtime.bad.test; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.junit.Test; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestBadLFCController extends Common { - - private String clazz = "org.apache.felix.ipojo.test.scenarios.component.LifecycleControllerTest"; - - private Element getNoFieldController() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element controller = new Element("controller", ""); - elem.addElement(controller); - return elem; - } - - private Element getBadFieldController() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element controller = new Element("controller", ""); - controller.addAttribute(new Attribute("field", "controller")); // Missing field - elem.addElement(controller); - elem.addElement(getManipulationForComponent("BAD-lcTest")); - return elem; - } - - private Element getManipulationForComponent(String comp_name) { - // On KF we must cast the result - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parseHeaderMetadata(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - Element manip = getManipulationForComponent(elem, comp_name); - assertNotNull("Check manipulation metadata not null for " + comp_name, manip); - return manip; - } - - private Element getManipulationForComponent(Element metadata, String comp_name) { - Element[] comps = metadata.getElements("component"); - for (Element comp : comps) { - if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) { - return comp.getElements("manipulation")[0]; - } - } - return null; - } - - @Test - public void testNoField() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoFieldController()); - cf.start(); - cf.stop(); - fail("A lifecycle controller with a missing field must be rejected " + cf); - } catch (Exception e) { - // OK - } - } - - @Test - public void testBadField() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFieldController()); - cf.start(); - cf.stop(); - fail("A lifecycle controller with a bad field must be rejected " + cf); - } catch (Exception e) { - // OK - } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java deleted file mode 100644 index 03133fee6f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/bad/test/TestBadServiceDependencies.java +++ /dev/null @@ -1,370 +0,0 @@ -/* - * 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.ipojo.runtime.bad.test; - -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.parser.ManifestMetadataParser; -import org.apache.felix.ipojo.parser.ParseException; -import org.apache.felix.ipojo.runtime.bad.services.BarService; -import org.junit.Before; -import org.junit.Test; - -import java.util.Properties; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestBadServiceDependencies extends Common { - - private String clazz = "org.apache.felix.ipojo.test.scenarios.component.CheckServiceProvider"; - private String type = "BAD-BothCheckServiceProvider"; - private Element manipulation; - private Properties props; - - @Before - public void setUp() { - manipulation = getManipulationForComponent(); - props = new Properties(); - props.put("instance.name", "BAD"); - } - - - private Element getNothing() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getNoField() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - callback.addAttribute(new Attribute("filter", "(foo=bar)")); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadField() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - callback.addAttribute(new Attribute("field", "BAD_FIELD")); // missing field. - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadFilter() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - callback.addAttribute(new Attribute("field", "fs")); - callback.addAttribute(new Attribute("filter", "(foo=bar)&(bar=foo)")); // Incorrect filter - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadFrom() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - callback.addAttribute(new Attribute("field", "fs")); - callback.addAttribute(new Attribute("from", "ba(d&_")); // Incorrect from - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getBadType() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - Element callback = new Element("requires", ""); - callback.addAttribute(new Attribute("field", "fs")); - callback.addAttribute(new Attribute("interface", BarService.class.getName())); - elem.addElement(callback); - elem.addElement(manipulation); - return elem; - } - - private Element getMissingSpecification() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - // iPOJO cannot determine the specification of this type of dependency. - Element dependency = new Element("requires", ""); - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("type", "bind")); - callback.addAttribute(new Attribute("method", "refBind")); - dependency.addElement(callback); - elem.addElement(dependency); - - elem.addElement(manipulation); - return elem; - } - - private Element getMissingCallbackType() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - // iPOJO cannot determine the specification of this type of dependency. - Element dependency = new Element("requires", ""); - dependency.addAttribute(new Attribute("field", "fs")); - Element callback = new Element("callback", ""); - // callback.addAttribute(new Attribute("type", "bind")); --> Type missing. - callback.addAttribute(new Attribute("method", "refBind")); - dependency.addElement(callback); - elem.addElement(dependency); - - elem.addElement(manipulation); - return elem; - } - - private Element getMissingCallbackMethod() { - Element elem = new Element("component", ""); - elem.addAttribute(new Attribute("classname", clazz)); - - // iPOJO cannot determine the specification of this type of dependency. - Element dependency = new Element("requires", ""); - dependency.addAttribute(new Attribute("field", "fs")); - Element callback = new Element("callback", ""); - callback.addAttribute(new Attribute("type", "bind")); - // callback.addAttribute(new Attribute("method", "refBind")); --> Method missing. - dependency.addElement(callback); - elem.addElement(dependency); - - elem.addElement(manipulation); - return elem; - } - - - private Element getManipulationForComponent() { - // On KF we must cast the result. - String header = (String) getTestBundle().getHeaders().get("iPOJO-Components"); - Element elem = null; - try { - elem = ManifestMetadataParser.parse(header); - } catch (ParseException e) { - fail("Parse Exception when parsing iPOJO-Component"); - } - - assertNotNull("Check elem not null", elem); - - Element manip = getManipulationForComponent(elem, type); - assertNotNull("Check manipulation metadata not null for " + type, manip); - return manip; - } - - private Element getManipulationForComponent(Element metadata, String comp_name) { - Element[] comps = metadata.getElements("component"); - for (Element comp : comps) { - if (comp.containsAttribute("factory") && comp.getAttribute("factory").equals(comp_name)) { - return comp.getElements("manipulation")[0]; - } - if (comp.containsAttribute("name") && comp.getAttribute("name").equals(comp_name)) { - return comp.getElements("manipulation")[0]; - } - } - return null; - } - - @Test - public void testNothing() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNothing()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with neither field and method must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testNoField() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getNoField()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with neither field and method must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadField() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadField()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad field must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadFilter() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFilter()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad filter must be rejected " + cf); - } catch (ConfigurationException e) { - //OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadFrom() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadFrom()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad from must be rejected " + cf); - } catch (ConfigurationException e) { - //OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - @Test - public void testBadType() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getBadType()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad type must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - /** - * Check that a component using a service dependency without service specification is rejected. - */ - @Test - public void testDependencyWithoutSpecification() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getMissingSpecification()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad type must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - /** - * Check that a component using a service dependency with a callback without its type is rejected. - * The type is either 'bind' or 'unbind'. - */ - @Test - public void testDependencyWithACallbackWithoutType() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getMissingCallbackType()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad type must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } - - /** - * Check that a component using a service dependency with a callback without its method is rejected. - */ - @Test - public void testDependencyWithACallbackWithoutMethod() { - try { - ComponentFactory cf = new ComponentFactory(osgiHelper.getContext(), getMissingCallbackMethod()); - cf.start(); - ComponentInstance ci = cf.createComponentInstance(props); - ci.dispose(); - cf.stop(); - fail("A service requirement with a bad type must be rejected " + cf); - } catch (ConfigurationException e) { - // OK - } catch (UnacceptableConfiguration e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } catch (MissingHandlerException e) { - fail("Unexpected exception when creating an instance : " + e.getMessage()); - } - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties b/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties deleted file mode 100644 index d8a500d9d8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-bad-configuration-test/src/test/resources/exam.properties +++ /dev/null @@ -1,19 +0,0 @@ -# -# 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. -# - diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/pom.xml deleted file mode 100644 index 9f51ce2802..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-configuration-admin-test - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProvider.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProvider.java deleted file mode 100644 index f0df68fb71..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProvider.java +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class ConfigurableFooProvider implements FooService { - - private String message; // Configurable property - private int invokeCount = 0; - - public void setMessage(String message) { - System.err.println("=== Set message to " + message); - this.message = message; - invokeCount++; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties props = new Properties(); - if (message == null) { - props.put("message", "NULL"); - } else { - props.put("message", message); - } - props.put("count", new Integer(invokeCount)); - return props; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return invokeCount; - } - - public int getInt() { - return invokeCount; - } - - public long getLong() { - return invokeCount; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProviderWithPropagation.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProviderWithPropagation.java deleted file mode 100644 index 01898b7016..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableFooProviderWithPropagation.java +++ /dev/null @@ -1,73 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -@Component(propagation = true) -@Provides -public class ConfigurableFooProviderWithPropagation implements FooService { - - @Property - private String message; - - @Property(name=".private") - private String myPrivateLife; - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties props = new Properties(); - if (message == null) { - props.put("message", "NULL"); - } else { - props.put("message", message); - } - return props; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return 0; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateConfigurableFooProvider.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateConfigurableFooProvider.java deleted file mode 100644 index 236007d810..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ImmediateConfigurableFooProvider.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.Updated; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Dictionary; -import java.util.Properties; - -@Component(propagation = true, immediate = true) -@Provides -public class ImmediateConfigurableFooProvider implements FooService { - - @Property - private String message; - - @Property(name=".private") - private String myPrivateLife; - - private Dictionary configuration; - private int count; - - @Updated - public void updated(Dictionary conf) { - System.out.println("Updating component with " + conf); - this.configuration = conf; - this.count++; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties props = new Properties(); - if (message == null) { - props.put("message", "NULL"); - } else { - props.put("message", message); - } - props.put("count", count); - - return props; - } - - public boolean getBoolean() { - return false; - } - - public double getDouble() { - return 0; - } - - public int getInt() { - return count; - } - - public long getLong() { - return 0; - } - - public Boolean getObject() { - return null; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index c3d38ec723..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 716115f566..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/resources/metadata.xml deleted file mode 100644 index c9e02c08b0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index ce43d70d35..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.junit.After; -import org.junit.Before; -import org.osgi.service.cm.ConfigurationAdmin; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.helpers.ConfigAdminHelper; -import org.ow2.chameleon.testing.helpers.TimeUtils; - -public class Common extends BaseTest { - - public static int UPDATE_WAIT_TIME = 2000; - - public ConfigAdminHelper caHelper = null; - - public ConfigurationAdmin admin; - - public void grace() { - TimeUtils.grace(UPDATE_WAIT_TIME); - } - - @Override - public boolean deployConfigAdmin() { - return true; - } - - @Before - public void initializeConfigAdmin() { - caHelper = new ConfigAdminHelper(bc); - admin = caHelper.getConfigurationAdmin(); - caHelper.deleteAllConfigurations(); - } - - @After - public void stoppingConfigAdmin() { - caHelper.deleteAllConfigurations(); - caHelper.dispose(); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForImmediate.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForImmediate.java deleted file mode 100644 index 8e1e34649b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForImmediate.java +++ /dev/null @@ -1,346 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.fail; - -public class TestManagedServiceFactoryTestForImmediate extends Common { - - private ComponentFactory factory; - - @Before - public void setUp() { - factory = (ComponentFactory) ipojoHelper.getFactory("CA-ImmConfigurableProvider"); - } - - @Test - public void testCreationAndReconfiguration() { - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 2, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testCreationAndReconfiguration2() { - //The reconfiguration happens before the service invocation - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - System.out.println("PID : " + pid); - - // Wait for the processing of the first configuration. - grace(); - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Check object -2", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - //Invoke - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = ((Integer) p.get("count")).intValue(); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 2, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testDelayedCreationAndReconfiguration() { - factory.stop(); - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - assertNull("check no instance", osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - - factory.start(); - - - // Wait for the processing of the first configuration. - grace(); - - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - //assertEquals("Assert count", 2, count); - // This test was removed as the result can be 3. - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testDelayedCreationAndReconfiguration2() { - factory.stop(); - //The reconfiguration happens before the service invocation - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ImmConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - assertNull("check no instance", osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - - factory.start(); - - // Wait for the processing of the first configuration. - grace(); - - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Check object -1", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - //Invoke - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 2, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForServices.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForServices.java deleted file mode 100644 index 11865c8d85..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceFactoryTestForServices.java +++ /dev/null @@ -1,356 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -public class TestManagedServiceFactoryTestForServices extends Common { - - private ComponentFactory factory; - - @Before - public void setUp() { - factory = (ComponentFactory) ipojoHelper.getFactory("CA-ConfigurableProvider"); - } - - @Test - public void testMSFCreationAndReconfiguration() { - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - System.out.println("PID : " + pid); - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - osgiHelper.waitForService(FooService.class.getName(), "(instance.name=" + pid + ")", 1000); - - ServiceReference refx = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNotNull("Check refx", refx); - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNotNull("Check fs", fs); - - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - - // Wait for the processing of the first configuration. - grace(); - - Dictionary p2 = configuration.getProperties(); - p2.put("message", "message2"); - try { - System.err.println("The configuration will be updated with message2"); - - configuration.update(p2); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - System.err.println("The configuration should be updated with message2"); - - fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 2, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testMSFCreationAndReconfiguration2() { - //The reconfiguration happens before the service invocation - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - // Wait for the processing of the first configuration. - grace(); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Check no object -2", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - //Invoke - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testDelayedCreationAndReconfiguration() { - factory.stop(); - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - assertNull("check no instance", osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - - factory.start(); - - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - osgiHelper.waitForService(FooService.class.getName(), "(instance.name=" + pid + ")", 1000); - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - // Wait for the processing of the first configuration. - grace(); - - System.out.println("==="); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - System.out.println("==="); - - fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 2, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - @Test - public void testDelayedCreationAndReconfiguration2() { - factory.stop(); - //The reconfiguration happens before the service invocation - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("CA-ConfigurableProvider", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("message", "message"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - System.out.println("PID : " + pid); - - assertNull("check no instance", osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - - factory.start(); - - - // The instance should be created, wait for the architecture service - osgiHelper.waitForService(Architecture.class.getName(), "(architecture.instance=" + pid + ")", 1000); - Architecture architecture = (Architecture) osgiHelper.getServiceObject(Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - // Wait for the processing of the first configuration. - grace(); - - props.put("message", "message2"); - try { - configuration.update(props); - // Update the configuration ... - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - //architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Check no object -2", 0, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - //Invoke - FooService fs = (FooService) osgiHelper.getServiceObject(FooService.class.getName(), "(instance.name=" + pid + ")"); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - // architecture = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance="+pid+")"); - - assertEquals("Assert Message", "message2", mes); - assertEquals("Assert count", 1, count); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) architecture.getInstanceDescription()).getCreatedObjects().length); - - try { - configuration.delete(); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = osgiHelper.getServiceReference(FooService.class.getName(), "(instance.name=" + pid + ")"); - assertNull("Check unavailability", ref); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForImmediate.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForImmediate.java deleted file mode 100644 index d655bc59d4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForImmediate.java +++ /dev/null @@ -1,368 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestManagedServiceTestForImmediate extends Common { - - private String factNameImm = "CA-ImmConfigurableProvider"; - private String msp = "foo"; - - private ComponentFactory factImm; - - @Before - public void setUp() throws InterruptedException { - factImm = (ComponentFactory) ipojoHelper.getFactory(factNameImm); - } - - @Test - public void testFactoryCreationAndReconfigurationUsingManagedService() { - Properties props = new Properties(); - props.put("managed.service.pid", msp); // Exposes a ManagedService. - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factImm.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message", mes); - assertEquals("Check count", 1, count); - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - System.err.println("updated ? "); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message2", mes); - assertEquals("Check count", 2, count); - - instance.dispose(); - } - - /** - * Creates an instance using a factory configuration. - * The configuration specifies the managed.service.pid property - * Reconfiguration is applied using the exposed managed service. - */ - @Test - public void testCreationUsingFactoryConfigurationSettingTheManagedServicePid() { - Configuration conf = null; - try { - conf = admin.createFactoryConfiguration(factNameImm, getTestBundle().getLocation()); - Dictionary props = conf.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("managed.service.pid", msp); - props.put("message", "message"); - conf.update(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - - Architecture arch = (Architecture) osgiHelper.getServiceObject(org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), conf.getPid()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message", mes); - assertEquals("Check count", 1, count); - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), conf.getPid()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - if (mes.equals("message")) { - System.out.println("Warning, configuration not yet applied"); - assertEquals("Check count - W", 1, count); - } else { - assertEquals("Check message", "message2", mes); - assertEquals("Check count", 2, count); - } - - try { - conf.delete(); - grace(); - } catch (IOException e) { - fail(e.getMessage()); - } - - } - - @Test - public void testCreationAndReconfiguration2() { - // The configuration exists before the instance creation. - - //Update - Configuration configuration = null; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - Properties props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factImm.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - // int count1 = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message - 1 (" + mes + ")", "message2", mes); // Already reconfigured. - // assertEquals("Check count", 2, count); // Two : 1) "message" on immediate, "message2" on the reconfiguration, - // not necessary as the property can be set before the immediate instance creation - - instance.dispose(); - - //Reconfiguration - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message3"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - // Recreation of the instance. - props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - instance = null; - try { - instance = factImm.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - // int count = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message already reconfigured", "message3", mes); // Already reconfigured. - //assertEquals("Check count", count1 + 1, count); // message before the reconfiguration, message3 after the reconfiguration - - instance.dispose(); - - - } - - @Test - public void testCreationAndReconfiguration3() { - // The configuration exists before the instance creation. - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - Properties props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factImm.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - // int count = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message2", mes); // Already reconfigured. - //assertEquals("Check count", 1, count); - - //Reconfiguration - try { - configuration = admin.getConfiguration(msp); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message3"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - instance.dispose(); - - // Recreation of the instance. - props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - instance = null; - try { - instance = factImm.createComponentInstance(props); - } catch (Exception e) { - fail(e.getMessage()); - } - - // Wait until the configuration is delivered. - grace(); - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - // count = ((Integer) p.get("count")).intValue(); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message3", mes); // Already reconfigured. - // assertEquals("Check count", 1, count); - - instance.dispose(); - - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForService.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForService.java deleted file mode 100644 index 5b4f84940d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceTestForService.java +++ /dev/null @@ -1,362 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestManagedServiceTestForService extends Common { - - private String factNameSvc = "CA-ConfigurableProvider"; - private String msp = "foo"; - private ComponentFactory factSvc; - - @Before - public void setUp() { - factSvc = (ComponentFactory) ipojoHelper.getFactory(factNameSvc); - } - - @Test - public void testCreationUsingFactoryAndReconfigurationUsingManagedService() { - Properties props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factSvc.createComponentInstance(props); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message", mes); - assertEquals("Check count", 1, count); - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - if (mes.equals("message")) { - System.out.println("Warning, configuration not yet applied"); - assertEquals("Check count - W", 1, count); - } else { - assertEquals("Check message", "message2", mes); - assertEquals("Check count", 2, count); - } - - instance.dispose(); - - } - - @Test - public void testCreationUsingMSFAndReconfigurationUsingManagedService() { - Configuration conf = null; - try { - conf = admin.createFactoryConfiguration(factNameSvc, getTestBundle().getLocation()); - Dictionary props = conf.getProperties(); - if (props == null) { - props = new Properties(); - } - props.put("managed.service.pid", msp); - props.put("message", "message"); - conf.update(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - Architecture arch = (Architecture) osgiHelper.getServiceObject(org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), conf.getPid()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message", mes); - assertEquals("Check count", 1, count); - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), conf.getPid()); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - // arch = (Architecture) osgiHelper.getServiceObject( org.apache.felix.ipojo.architecture.Architecture.class.getName(), "(architecture.instance=" + conf.getPid() + ")"); - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) arch.getInstanceDescription()).getCreatedObjects().length); - if (mes.equals("message")) { - System.out.println("Warning, configuration not yet applied"); - assertEquals("Check count - W", 1, count); - } else { - assertEquals("Check message", "message2", mes); - assertEquals("Check count", 2, count); - } - - try { - conf.delete(); - } catch (IOException e) { - fail(e.getMessage()); - } - - } - - @Test - public void testConfigurationPushedBeforeInstantiationUsingFactory() { - // The configuration exists before the instance creation. - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - //listener.waitForEvent(msp, "1"); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - Properties props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factSvc.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message2", mes); // Already reconfigured. - assertEquals("Check count", 1, count); - - instance.dispose(); - - //Reconfiguration - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message3"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - // Recreation of the instance. - props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - instance = null; - try { - instance = factSvc.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message3", mes); // Already reconfigured. - assertEquals("Check count", 1, count); - - instance.dispose(); - - - } - - @Test - public void testConfigurationPushedBeforeInstantiationUsingFactoryAndReconfiguration() { - // The configuration exists before the instance creation. - - //Update - Configuration configuration; - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message2"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - Properties props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - ComponentInstance instance = null; - try { - instance = factSvc.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - FooService fs = (FooService) bc.getService(ref); - Properties p = fs.fooProps(); - String mes = p.getProperty("message"); - int count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message2", mes); // Already reconfigured. - assertEquals("Check count", 1, count); - - //Reconfiguration - try { - configuration = admin.getConfiguration(msp, getTestBundle().getLocation()); - Dictionary prc = configuration.getProperties(); - if (prc == null) { - prc = new Properties(); - } - prc.put("message", "message3"); - configuration.update(prc); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - instance.dispose(); - - // Recreation of the instance. - props = new Properties(); - props.put("managed.service.pid", msp); - props.put("message", "message"); - instance = null; - try { - instance = factSvc.createComponentInstance(props); - grace(); - } catch (Exception e) { - fail(e.getMessage()); - } - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertEquals("Check no object", 0, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertNotNull("FS availability", ref); - - fs = (FooService) bc.getService(ref); - p = fs.fooProps(); - mes = p.getProperty("message"); - count = (Integer) p.get("count"); - assertEquals("Check 1 object", 1, ((PrimitiveInstanceDescription) instance.getInstanceDescription()).getCreatedObjects().length); - assertEquals("Check message", "message3", mes); // Already reconfigured. - assertEquals("Check count", 1, count); - - instance.dispose(); - - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropagation.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropagation.java deleted file mode 100644 index 962c51a4c6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropagation.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandlerDescription; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertNull; - -/** - * Test for FELIX-4207 - ipojo @Component with propagation set to true doesn't propagate properties - */ -public class TestPropagation extends Common { - - private String factoryName = "org.apache.felix.ipojo.runtime.core.components.ConfigurableFooProviderWithPropagation"; - - @Test - public void testPropagationFromConfigurationAdminWhenCreatingTheInstance() throws IOException { - Dictionary props = new Hashtable(); - props.put("message", "message"); - props.put("propagated", "propagated"); - props.put(".private", "wow"); - - Configuration configuration = admin.createFactoryConfiguration(factoryName, "?"); - configuration.update(props); - - ServiceReference ref = osgiHelper.waitForService(FooService.class.getName(), - "(instance.name=" + configuration.getPid() + ")", - 1000); - - // Check the propagation - assertEquals(ref.getProperty("propagated"), "propagated"); - assertEquals(ref.getProperty("message"), "message"); - assertNull(ref.getProperty(".private")); - assertNull(ref.getProperty("private")); - - // Check the the .private property has the right value - ConfigurationHandlerDescription desc = (ConfigurationHandlerDescription) ipojoHelper.getArchitectureByName(configuration.getPid()) - .getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties"); - PropertyDescription prop = desc.getPropertyByName(".private"); - assertEquals(prop.getValue(), "wow"); - - // Update the property - props.put("message", "message2"); - props.put("propagated", "propagated2"); - props.put(".private", "wow2"); - configuration.update(props); - - grace(); - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), configuration.getPid()); - // Check the propagation - assertEquals(ref.getProperty("propagated"), "propagated2"); - assertEquals(ref.getProperty("message"), "message2"); - - desc = (ConfigurationHandlerDescription) ipojoHelper.getArchitectureByName(configuration.getPid()) - .getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties"); - prop = desc.getPropertyByName(".private"); - assertEquals(prop.getValue(), "wow2"); - - configuration.delete(); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdated.java b/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdated.java deleted file mode 100644 index 0f71b615b6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-admin-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdated.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; - -/** - * Test for FELIX-4172 Updated method called twice at the bundle start - */ -public class TestUpdated extends Common { - - private String factoryName = "org.apache.felix.ipojo.runtime.core.components.ImmediateConfigurableFooProvider"; - - @Test - public void testNumberOfUpdatedCalls() throws IOException { - Dictionary props = new Hashtable(); - props.put("message", "message"); - props.put("propagated", "propagated"); - props.put(".private", "wow"); - - Configuration configuration = admin.createFactoryConfiguration(factoryName, "?"); - configuration.update(props); - - FooService fs = osgiHelper.waitForService(FooService.class, - "(instance.name=" + configuration.getPid() + ")", - 1000); - - assertEquals(fs.getInt(), 1); - - // Update the property - props.put("message", "message2"); - props.put("propagated", "propagated2"); - props.put(".private", "wow2"); - configuration.update(props); - - grace(); - - assertEquals(fs.getInt(), 2); - - // Remove a property - props.remove("propagated"); - configuration.update(props); - - grace(); - - assertEquals(fs.getInt(), 3); - - - configuration.delete(); - } - - @Test - public void testNumberOfUpdatedCallsWithManagedService() throws IOException { - Dictionary props = new Hashtable(); - props.put("message", "message"); - props.put("propagated", "propagated"); - props.put(".private", "wow"); - props.put("managed.service.pid", "config"); - - Configuration configuration = admin.createFactoryConfiguration(factoryName, "?"); - configuration.update(props); - - FooService fs = osgiHelper.waitForService(FooService.class, - "(instance.name=" + configuration.getPid() + ")", - 1000); - - assertEquals(fs.getInt(), 1); - - // Update the property using the managed service. - - Configuration managedConfiguration = admin.getConfiguration("config", "?"); - props.put("message", "message2"); - props.put("propagated", "propagated2"); - props.put(".private", "wow2"); - managedConfiguration.update(props); - - grace(); - - assertEquals(fs.getInt(), 2); - - // Remove a property - props.remove("propagated"); - managedConfiguration.update(props); - - grace(); - - assertEquals(fs.getInt(), 3); - - managedConfiguration.delete(); - configuration.delete(); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/pom.xml deleted file mode 100644 index 0d5fff7aff..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-configuration-processor-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Bean.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Bean.java deleted file mode 100644 index 7b0d406429..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/Bean.java +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -/** - * A bean - */ -public class Bean { - - private String message; - - private int count; - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public int getCount() { - return count; - } - - public void setCount(int count) { - this.count = count; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureAnotherInstance.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureAnotherInstance.java deleted file mode 100644 index f5b5c3c149..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureAnotherInstance.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class ConfigureAnotherInstance { - - // Declare an instance of MyComponent named myInstance - Instance anotherInstance = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureNothing.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureNothing.java deleted file mode 100644 index c3c6588dba..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureNothing.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; - -/** - * Nothing happen in this class.. - */ -@Configuration -public class ConfigureNothing { - - // Nothing on purpose - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java deleted file mode 100644 index d3f25117d2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureOneInstance.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class ConfigureOneInstance { - - // Declare an instance of MyComponent named myInstance - Instance myInstance = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureThreeInstancesUsingMethods.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureThreeInstancesUsingMethods.java deleted file mode 100644 index 58c05a865f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureThreeInstancesUsingMethods.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration using methods and fields. - */ -@Configuration -public class ConfigureThreeInstancesUsingMethods { - - // Declare an instance of MyComponent named myInstance - Instance myInstance = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - - Instance instance1() { - return instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - } - - Instance instance2(BundleContext bc) { - return instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(bc.getBundles().length) - .with("props").setto(new Properties()); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstances.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstances.java deleted file mode 100644 index 0dfb520960..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstances.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class ConfigureTwoInstances { - - // Declare an instance of MyComponent named myInstance - Instance myInstance1 = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - - // Declare an instance of MyComponent named hello - Instance myInstance2 = instance().of(MyComponent.class) - .named("hello") - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithInheritance.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithInheritance.java deleted file mode 100644 index c290747f5c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithInheritance.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class ConfigureTwoInstancesWithInheritance extends ParentConfiguration { - - // Declare an instance of MyComponent named myInstance - Instance myInstance1 = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithOverridding.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithOverridding.java deleted file mode 100644 index 564bc6748e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigureTwoInstancesWithOverridding.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class ConfigureTwoInstancesWithOverridding extends ParentConfiguration { - - // Declare an instance of MyComponent named myInstance - Instance myInstance1 = instance().of(MyComponent.class) - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - - protected Instance myInstance2 = instance().of(MyComponent.class) - .named("hello-over") - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComplexComponent.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComplexComponent.java deleted file mode 100644 index b61512de8e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComplexComponent.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileReader; -import java.io.IOException; -import java.util.Map; -import java.util.Properties; - -/** - * A complex component - */ -@Component -@Provides -public class MyComplexComponent implements FooService { - - @Property - private File file; - @Property - private Bean bean; - @Property - private Map map; - - @Override - public boolean foo() { - return file != null; - } - - @Override - public Properties fooProps() { - String content; - try { - content = read(); - } catch (IOException e) { - throw new IllegalStateException("unexpected error", e); - } - Properties props = new Properties(); - props.put("map", map); - props.put("content", content); - props.put("bean", bean); - return props; - } - - private String read() throws IOException { - BufferedReader reader = new BufferedReader(new FileReader(file)); - String line; - StringBuilder stringBuilder = new StringBuilder(); - String ls = System.getProperty("line.separator"); - - while ((line = reader.readLine()) != null) { - stringBuilder.append(line); - stringBuilder.append(ls); - } - - return stringBuilder.toString(); - } - - @Override - public Boolean getObject() { - return false; - } - - @Override - public boolean getBoolean() { - return false; - } - - @Override - public int getInt() { - return 0; - } - - @Override - public long getLong() { - return 1; - } - - @Override - public double getDouble() { - return 1; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java deleted file mode 100644 index bbd5a44228..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/MyComponent.java +++ /dev/null @@ -1,89 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.annotations.ServiceProperty; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -/** - * A simple component - */ -@Component -@Provides -public class MyComponent implements FooService { - - @Property - private Boolean bool; - - @Property - private Properties props; - - @ServiceProperty - private String message; - - @Property - private long number; - - @Property - private int integer; - - @Property - private double floating; - - @Override - public boolean foo() { - return message != null; - } - - @Override - public Properties fooProps() { - return props; - } - - @Override - public Boolean getObject() { - return bool; - } - - @Override - public boolean getBoolean() { - return bool; - } - - @Override - public int getInt() { - return integer; - } - - @Override - public long getLong() { - return number; - } - - @Override - public double getDouble() { - return floating; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfiguration.java deleted file mode 100644 index f8c9481930..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfiguration.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * This configuration is a parent configuration. - */ -public class ParentConfiguration { - - // Inherited fields must be public. - protected Instance myInstance2 = instance().of(MyComponent.class) - .named("hello") - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - - private Instance hidden = instance().of(MyComponent.class) - .named("hello") - .with("floating").setto("1.0") - .with("message").setto("hidden") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java deleted file mode 100644 index 314fb8c305..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleConfiguration.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration - */ -@Configuration -public class SimpleConfiguration { - - // Declare an instance of MyComponent named myInstance - Instance myInstance = instance().of(MyComponent.class) - .named("foo"); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyComplexConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyComplexConfiguration.java deleted file mode 100644 index 3aed514a37..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyComplexConfiguration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.configuration; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; -import org.apache.felix.ipojo.runtime.core.components.Bean; -import org.apache.felix.ipojo.runtime.core.components.MyComplexComponent; -import org.osgi.framework.BundleContext; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.PrintWriter; - -import static org.apache.felix.ipojo.configuration.Instance.*; - -/** - * A complex configuration creating two instances of MyComplex component - */ -@Configuration -public class MyComplexConfiguration { - - Instance complex1(BundleContext bc) throws FileNotFoundException { - - File file = bc.getBundle().getDataFile("file1.txt"); - write(file, "I'm file 1"); - - Bean bean = new Bean(); - bean.setMessage("I'm 1"); - bean.setCount(1); - - return instance().of(MyComplexComponent.class) - .with("file").setto(file) - .with("bean").setto(bean) - .with("map").setto(map(pair("a", "b"), pair("c", "d"))); - - } - - Instance complex2(BundleContext bc) throws FileNotFoundException { - - File file = bc.getBundle().getDataFile("file2.txt"); - write(file, "I'm file 2"); - - Bean bean = new Bean(); - bean.setMessage("I'm 2"); - bean.setCount(2); - - return instance().of(MyComplexComponent.class) - .with("file").setto(file) - .with("bean").setto(bean) - .with("map").setto(map(pair("a", "b2"), pair("c", "d2"))); - - } - - private void write(File file, String message) throws FileNotFoundException { - PrintWriter out = new PrintWriter(file); - out.println(message); - out.close(); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java deleted file mode 100644 index 5d2cf8db42..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.configuration; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; - -import java.util.Properties; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -/** - * Simple configuration in another package. - */ -@Configuration -public class MyConfiguration { - - // Declare an instance of MyComponent named myInstance - // We use the factory name to avoid import-export package. - Instance myInstance = instance().of("org.apache.felix.ipojo.runtime.core.components.MyComponent") - .with("floating").setto("1.0") - .with("message").setto("foo") - .with("bool").setto(true) - .with("number").setto(1l) - .with("integer").setto(1) - .with("props").setto(new Properties()); -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 8b2ba0d986..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -public class Common extends BaseTest { - - @Override - public boolean deployConfigAdmin() { - return true; - } - - @Override - protected List getExtraExports() { - return Arrays.asList( - "org.apache.felix.ipojo.runtime.core.components" - ); - } - - @Override - public boolean deployTestBundle() { - return false; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexConfigurations.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexConfigurations.java deleted file mode 100644 index 2e08f717be..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexConfigurations.java +++ /dev/null @@ -1,145 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.runtime.core.components.Bean; -import org.apache.felix.ipojo.runtime.core.components.MyComplexComponent; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.components.configuration.MyComplexConfiguration; -import org.apache.felix.ipojo.runtime.core.components.configuration.MyConfiguration; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.Map; -import java.util.Properties; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check @Configuration embedded in another bundle using complex configurations. - */ -public class TestComplexConfigurations extends Common { - - @Configuration - public Option[] config() throws IOException { - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComplexComponent.class) - .add(Bean.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.components") - .build(IPOJOStrategy.withiPOJO()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComplexConfiguration.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Configuration") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - /** - *

    - *
  1. Check when all bundles are deployed
  2. - *
  3. Check when the configuration bundle is stopped
  4. - *
  5. Check when the configuration is restarted
  6. - *
  7. Check when the component bundle is stopped
  8. - *
  9. Check when the component bundle is restarted
  10. - *
- */ - @Test - public void testDynamism() throws BundleException { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - //1) - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - - //2) Stopping configuration bundle - osgiHelper.getBundle("Configuration").stop(); - Assert.assertNull(osgiHelper.getServiceReference(FooService.class)); - - //3) Restart configuration bundle - osgiHelper.getBundle("Configuration").start(); - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - - //4) Stop the component bundle - osgiHelper.getBundle("MyComponent").stop(); - Assert.assertNull(osgiHelper.getServiceReference(FooService.class)); - - //5) Restart the component bundle - osgiHelper.getBundle("MyComponent").start(); - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - FooService fs1 = ipojoHelper.getServiceObjectByName(FooService.class, "complex1"); - Properties props1 = fs1.fooProps(); - Assert.assertTrue(((String)props1.get("content")).contains("I'm file 1")); - Assert.assertEquals(((Bean)props1.get("bean")).getMessage(), "I'm 1"); - Assert.assertEquals(((Bean)props1.get("bean")).getCount(), 1); - Assert.assertEquals(((Map)props1.get("map")).get("a"), "b"); - - FooService fs2 = ipojoHelper.getServiceObjectByName(FooService.class, "complex2"); - Assert.assertNotNull(fs2); - Properties props2 = fs2.fooProps(); - Assert.assertTrue(((String)props2.get("content")).contains("I'm file 2")); - Assert.assertEquals(((Bean)props2.get("bean")).getMessage(), "I'm 2"); - Assert.assertEquals(((Bean)props2.get("bean")).getCount(), 2); - Assert.assertEquals(((Map)props2.get("map")).get("a"), "b2"); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationInAnotherBundle.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationInAnotherBundle.java deleted file mode 100644 index 3911bd1f19..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationInAnotherBundle.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.components.configuration.MyConfiguration; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.BundleException; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check @Configuration embedded in another bundle. - */ -public class TestConfigurationInAnotherBundle extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyConfiguration.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "Configuration") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - /** - *
    - *
  1. Check when all bundles are deployed
  2. - *
  3. Check when the configuration bundle is stopped
  4. - *
  5. Check when the configuration is restarted
  6. - *
  7. Check when the component bundle is stopped
  8. - *
  9. Check when the component bundle is restarted
  10. - *
- */ - @Test - public void testDynamism() throws BundleException { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - //1) - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - - //2) Stopping configuration bundle - osgiHelper.getBundle("Configuration").stop(); - Assert.assertNull(osgiHelper.getServiceReference(FooService.class)); - - //3) Restart configuration bundle - osgiHelper.getBundle("Configuration").start(); - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - - //4) Stop the component bundle - osgiHelper.getBundle("MyComponent").stop(); - Assert.assertNull(osgiHelper.getServiceReference(FooService.class)); - - //5) Restart the component bundle - osgiHelper.getBundle("MyComponent").start(); - osgiHelper.waitForService(FooService.class, null, 10000); - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfMyComponent.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfMyComponent.java deleted file mode 100644 index e02df8a1c5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfMyComponent.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.runtime.core.components.ConfigureOneInstance; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check simple @Configuration - */ -public class TestConfigurationOfMyComponent extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComponent.class) - .add(ConfigureOneInstance.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() throws IOException { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check configuration - FooService fs = osgiHelper.getServiceObject(FooService.class); - Assert.assertTrue(fs.foo()); - Assert.assertEquals(fs.getDouble(), 1.0, 0); - Assert.assertEquals(fs.getInt(), 1); - Assert.assertEquals(fs.getLong(), 1l); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfThreeInstancesUsingMethods.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfThreeInstancesUsingMethods.java deleted file mode 100644 index 03c726ff02..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfThreeInstancesUsingMethods.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.ConfigureThreeInstancesUsingMethods; -import org.apache.felix.ipojo.runtime.core.components.ConfigureTwoInstances; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check a @Configuration with 2 instances. - */ -public class TestConfigurationOfThreeInstancesUsingMethods extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(ConfigureThreeInstancesUsingMethods.class) - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check we have three instances - ServiceReference[] refs = osgiHelper.getServiceReferences(FooService.class, null); - Assert.assertEquals(refs.length, 3); - - List arch = osgiHelper.getServiceObjects(Architecture.class, null); - for (Architecture a : arch) { - System.out.println("Instance " + a.getInstanceDescription().getName()); - } - - // Check name - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "myInstance")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "instance1")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "instance2")); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfTwoInstances.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfTwoInstances.java deleted file mode 100644 index 7f162e2560..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationOfTwoInstances.java +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.ConfigureTwoInstances; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check a @Configuration with 2 instances. - */ -public class TestConfigurationOfTwoInstances extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(ConfigureTwoInstances.class) - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check we have two instances - ServiceReference[] refs = osgiHelper.getServiceReferences(FooService.class, null); - Assert.assertEquals(refs.length, 2); - - List arch = osgiHelper.getServiceObjects(Architecture.class, null); - for (Architecture a : arch) { - System.out.println("Instance " + a.getInstanceDescription().getName()); - } - - // Check name - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "hello")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "myInstance1")); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithInheritedInstance.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithInheritedInstance.java deleted file mode 100644 index d0b0c68307..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithInheritedInstance.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.ConfigureTwoInstancesWithInheritance; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.components.ParentConfiguration; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check a @Configuration inheriting an instance from a parent class. - */ -public class TestConfigurationWithInheritedInstance extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(ConfigureTwoInstancesWithInheritance.class) - .add(ParentConfiguration.class) - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check we have two instances - ServiceReference[] refs = osgiHelper.getServiceReferences(FooService.class, null); - Assert.assertEquals(refs.length, 2); - - List arch = osgiHelper.getServiceObjects(Architecture.class, null); - for (Architecture a : arch) { - System.out.println("Instance " + a.getInstanceDescription().getName()); - } - - // Check name - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "hello")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "myInstance1")); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithOverriddenInstance.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithOverriddenInstance.java deleted file mode 100644 index a5379532e9..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigurationWithOverriddenInstance.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.ConfigureTwoInstancesWithOverridding; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.components.ParentConfiguration; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check a @Configuration overriding instance declaration. - */ -public class TestConfigurationWithOverriddenInstance extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(ConfigureTwoInstancesWithOverridding.class) - .add(ParentConfiguration.class) - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check we have two instances - ServiceReference[] refs = osgiHelper.getServiceReferences(FooService.class, null); - Assert.assertEquals(refs.length, 2); - - List arch = osgiHelper.getServiceObjects(Architecture.class, null); - for (Architecture a : arch) { - System.out.println("Instance " + a.getInstanceDescription().getName()); - } - - // Check name - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "hello-over")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "myInstance1")); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java deleted file mode 100644 index 7ca2d691c9..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestEmptyConfiguration.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.runtime.core.components.ConfigureNothing; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check an empty @Configuration - */ -public class TestEmptyConfiguration extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComponent.class) - .add(ConfigureNothing.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() throws InterruptedException { - TimeUtils.grace(1000); - // Check configuration - Assert.assertNull(osgiHelper.getServiceReference(FooService.class)); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConfigurations.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConfigurations.java deleted file mode 100644 index 571669ac51..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSeveralConfigurations.java +++ /dev/null @@ -1,99 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.components.ConfigureAnotherInstance; -import org.apache.felix.ipojo.runtime.core.components.ConfigureOneInstance; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check several configuration @Configuration in the same bundle. - */ -public class TestSeveralConfigurations extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(ConfigureOneInstance.class) - .add(ConfigureAnotherInstance.class) - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - - TimeUtils.grace(500); - osgiHelper.waitForService(FooService.class, null, 10000); - - // Check we have two instances - ServiceReference[] refs = osgiHelper.getServiceReferences(FooService.class, null); - Assert.assertEquals(refs.length, 2); - - List arch = osgiHelper.getServiceObjects(Architecture.class, null); - for (Architecture a : arch) { - System.out.println("Instance " + a.getInstanceDescription().getName()); - } - - // Check name - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "anotherInstance")); - Assert.assertNotNull(ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "myInstance")); - - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java deleted file mode 100644 index 52c76146f8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-processor-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleConfiguration.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.runtime.core.components.MyComponent; -import org.apache.felix.ipojo.runtime.core.components.SimpleConfiguration; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.exam.OptionUtils; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.TimeUtils; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.IOException; - -import static org.ops4j.pax.exam.CoreOptions.streamBundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Check a simple @Configuration - */ -public class TestSimpleConfiguration extends Common { - - @Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - // Build a service bundle - return OptionUtils.combine(options, - streamBundle( - TinyBundles.bundle() - .add(FooService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.runtime.core.services") - .build(withBnd()) - ), - streamBundle( - TinyBundles.bundle() - .add(MyComponent.class) - .add(SimpleConfiguration.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "MyComponent") - .build(IPOJOStrategy.withiPOJO()) - ) - ); - } - - @Test - public void testConfiguration() throws InterruptedException { - if (isKnopflerfish()) { - return; // Test disabled on KF - } - TimeUtils.grace(1000); - // Check configuration - Assert.assertNotNull(osgiHelper.getServiceReference(FooService.class)); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-configuration-test/pom.xml deleted file mode 100644 index f58b9acec0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/pom.xml +++ /dev/null @@ -1,34 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-configuration-test - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java deleted file mode 100644 index 9edfc1f21f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComplexConfiguration.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Dictionary; -import java.util.List; -import java.util.Map; -import java.util.Properties; - -public class ComplexConfiguration implements CheckService { - - private List m_list; - private Map m_map; - private Dictionary m_dict; - private String[] m_array; - - private List m_complexList; - private Map m_complexMap; - private Object[] m_complexArray; - - public boolean check() { - return true; - } - - - public Properties getProps() { - Properties props = new Properties(); - props.put("list", m_list); - props.put("map", m_map); - props.put("dict", m_dict); - props.put("array", m_array); - props.put("complex-list", m_complexList); - props.put("complex-map", m_complexMap); - props.put("complex-array", m_complexArray); - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java deleted file mode 100644 index 315f44385b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ConfigurableCheckServiceProvider.java +++ /dev/null @@ -1,223 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -public class ConfigurableCheckServiceProvider implements CheckService { - - // Integer types - byte b; - short s; - int i; - long l; - - // Floatting types - double d; - float f; - - // Character - char c; - - // Boolean - boolean bool; - - // Integer arrays - byte[] bs; - short[] ss; - int[] is; - long[] ls; - - double[] ds; - float[] fs; - - char[] cs; - - boolean[] bools; - - String string; - String[] strings; - - int upB, upS, upI, upL, upD, upF, upC, upBool, upBs, upSs, upIs, upLs, upDs, upFs, upCs, upBools, upString, upStrings; - - - public boolean check() { - return true; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("b", new Byte(b)); - props.put("s", new Short(s)); - props.put("i", new Integer(i)); - props.put("l", new Long(l)); - props.put("d", new Double(d)); - props.put("f", new Float(f)); - props.put("c", new Character(c)); - props.put("bool", new Boolean(bool)); - - if (bs != null) { - props.put("bs", bs); - } - if (ss != null) { - props.put("ss", ss); - } - if (is != null) { - props.put("is", is); - } - if (ls != null) { - props.put("ls", ls); - } - if (ds != null) { - props.put("ds", ds); - } - if (fs != null) { - props.put("fs", fs); - } - if (cs != null) { - props.put("cs", cs); - } - if (bools != null) { - props.put("bools", bools); - } - - props.put("upb", new Integer(upB)); - props.put("ups", new Integer(upS)); - props.put("upi", new Integer(upI)); - props.put("upl", new Integer(upL)); - props.put("upd", new Integer(upD)); - props.put("upf", new Integer(upF)); - props.put("upc", new Integer(upC)); - props.put("upbool", new Integer(upBool)); - - props.put("upbs", new Integer(upBs)); - props.put("upss", new Integer(upSs)); - props.put("upis", new Integer(upIs)); - props.put("upls", new Integer(upLs)); - props.put("upds", new Integer(upDs)); - props.put("upfs", new Integer(upFs)); - props.put("upcs", new Integer(upCs)); - props.put("upbools", new Integer(upBools)); - - if (string != null) { - props.put("string", string); - } - if (string != null) { - props.put("strings", strings); - } - - props.put("upstring", new Integer(upString)); - props.put("upstrings", new Integer(upStrings)); - - return props; - } - - public void updateB(byte bb) { - b = bb; - upB++; - } - - public void updateS(short bb) { - s = bb; - upS++; - } - - public void updateI(int bb) { - i = bb; - upI++; - } - - public void updateL(long bb) { - l = bb; - upL++; - } - - public void updateD(double bb) { - d = bb; - upD++; - } - - public void updateF(float bb) { - f = bb; - upF++; - } - - public void updateC(char bb) { - c = bb; - upC++; - } - - public void updateBool(boolean bb) { - bool = bb; - upBool++; - } - - public void updateBs(byte[] bb) { - bs = bb; - upBs++; - } - - public void updateSs(short[] bb) { - ss = bb; - upSs++; - } - - public void updateIs(int[] bb) { - is = bb; - upIs++; - } - - public void updateLs(long[] bb) { - ls = bb; - upLs++; - } - - public void updateDs(double[] bb) { - ds = bb; - upDs++; - } - - public void updateFs(float[] bb) { - fs = bb; - upFs++; - } - - public void updateCs(char[] bb) { - cs = bb; - upCs++; - } - - public void updateBools(boolean[] bb) { - bools = bb; - upBools++; - } - - public void updateStrings(String[] bb) { - strings = bb; - upStrings++; - } - - public void updateString(String bb) { - string = bb; - upString++; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index 3c090960a4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Dictionary; -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - private int updated; - private Dictionary lastupdated; - - private static FooProviderType1 singleton(BundleContext bc) { - if (singleton == null) { - count++; - singleton = new FooProviderType1(bc); - } - return singleton; - } - - public static FooProviderType1 several(BundleContext bc) { - count++; - return new FooProviderType1(bc); - } - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - - p.put("updated", new Integer(updated)); - if (lastupdated != null) { - p.put("lastupdated", lastupdated); - } - - - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - - /** - * Custom constructor. - * @param bar - * @param foo - * @param bc - */ - public FooProviderType1(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - - public void updated(Dictionary props) { - updated++; - lastupdated = props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java deleted file mode 100644 index 90237cfbe0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType2.java +++ /dev/null @@ -1,115 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType2 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static int count = 0; - - private int updated; - - - public FooProviderType2(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - - p.put("updated", new Integer(updated)); - - - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - - /** - * Custom constructor. - * @param bar - * @param foo - * @param bc - */ - public FooProviderType2(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - - public void updated() { - updated++; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index 9ccddd6416..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Dictionary; -import java.util.Properties; - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - private int updated; - private Dictionary lastUpdate; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp == null || strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - if (strProp != null) { - p.put("strProp", strProp); - } - if (strAProp != null) { - p.put("strAProp", strAProp); - } - if (intAProp != null) { - p.put("intAProp", intAProp); - } - - p.put("updated", new Integer(updated)); - if (lastUpdate != null) { - p.put("lastupdated", lastUpdate); - } - - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - - public void updated(Dictionary props) { - updated++; - lastUpdate = props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java deleted file mode 100644 index 33d385c5e8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class ParentClass { - - public void parentStart() { - - } - - public void parentStop() { - - } - - protected String[] strings; - - protected String string; - - protected int upStrings; - - protected int upString; - - public void updateStrings(String[] bb) { - strings = bb; - upStrings++; - } - - public void updateString(String bb) { - string = bb; - upString++; - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java deleted file mode 100644 index aaafb3ccd0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ParentConfigurableCheckServiceProvider.java +++ /dev/null @@ -1,194 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -public class ParentConfigurableCheckServiceProvider extends ParentClass implements CheckService { - - // Integer types - byte b; - short s; - int i; - long l; - - // Floatting types - double d; - float f; - - // Character - char c; - - // Boolean - boolean bool; - - // Integer arrays - byte[] bs; - short[] ss; - int[] is; - long[] ls; - - double[] ds; - float[] fs; - - char[] cs; - - boolean[] bools; - - //String string; - //String[] strings; - - int upB, upS, upI, upL, upD, upF, upC, upBool, upBs, upSs, upIs, upLs, upDs, upFs, upCs, upBools/*, upString, upStrings*/; - - - public boolean check() { - return true; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("b", new Byte(b)); - props.put("s", new Short(s)); - props.put("i", new Integer(i)); - props.put("l", new Long(l)); - props.put("d", new Double(d)); - props.put("f", new Float(f)); - props.put("c", new Character(c)); - props.put("bool", new Boolean(bool)); - - props.put("bs", bs); - props.put("ss", ss); - props.put("is", is); - props.put("ls", ls); - props.put("ds", ds); - props.put("fs", fs); - props.put("cs", cs); - props.put("bools", bools); - - props.put("upb", new Integer(upB)); - props.put("ups", new Integer(upS)); - props.put("upi", new Integer(upI)); - props.put("upl", new Integer(upL)); - props.put("upd", new Integer(upD)); - props.put("upf", new Integer(upF)); - props.put("upc", new Integer(upC)); - props.put("upbool", new Integer(upBool)); - - props.put("upbs", new Integer(upBs)); - props.put("upss", new Integer(upSs)); - props.put("upis", new Integer(upIs)); - props.put("upls", new Integer(upLs)); - props.put("upds", new Integer(upDs)); - props.put("upfs", new Integer(upFs)); - props.put("upcs", new Integer(upCs)); - props.put("upbools", new Integer(upBools)); - - props.put("string", string); - props.put("strings", strings); - props.put("upstring", new Integer(upString)); - props.put("upstrings", new Integer(upStrings)); - - return props; - } - - public void updateB(byte bb) { - b = bb; - upB++; - } - - public void updateS(short bb) { - s = bb; - upS++; - } - - public void updateI(int bb) { - i = bb; - upI++; - } - - public void updateL(long bb) { - l = bb; - upL++; - } - - public void updateD(double bb) { - d = bb; - upD++; - } - - public void updateF(float bb) { - f = bb; - upF++; - } - - public void updateC(char bb) { - c = bb; - upC++; - } - - public void updateBool(boolean bb) { - bool = bb; - upBool++; - } - - public void updateBs(byte[] bb) { - bs = bb; - upBs++; - } - - public void updateSs(short[] bb) { - ss = bb; - upSs++; - } - - public void updateIs(int[] bb) { - is = bb; - upIs++; - } - - public void updateLs(long[] bb) { - ls = bb; - upLs++; - } - - public void updateDs(double[] bb) { - ds = bb; - upDs++; - } - - public void updateFs(float[] bb) { - fs = bb; - upFs++; - } - - public void updateCs(char[] bb) { - cs = bb; - upCs++; - } - - public void updateBools(boolean[] bb) { - bools = bb; - upBools++; - } - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java deleted file mode 100644 index d4fa3a7c30..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/PropertyModifier.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class PropertyModifier implements CheckService { - - private Class[] classes; - private BundleContext context; - - PropertyModifier(BundleContext bc) { - context = bc; - } - - public boolean check() { - return classes != null; - } - - public void setClasses(String[] classes) throws ClassNotFoundException { - Class[] cls = new Class[classes.length]; - for (int i = 0; i < classes.length; i++) { - try { - cls[i] = context.getBundle().loadClass(classes[i]); - } catch (ClassNotFoundException e) { - e.printStackTrace(); - throw e; - } - } - - this.classes = cls; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("classes", classes); - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/arch/MyComponentToIntrospect.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/arch/MyComponentToIntrospect.java deleted file mode 100644 index 8ebb157b0c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/arch/MyComponentToIntrospect.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.arch; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -/** - * A component with properties with/without default values to check that the architecture contains all the required - * information. - * - *
    - *
  • p1 : the property has no value, the field has one
  • - *
  • p2 : the property has no value, it receives one in the constructor
  • - *
  • p3 : the property has a default value
  • - *
  • p4 : the property has a default value, overridden by the field value
  • - *
  • p5 : the property has a default value, overridden by the instance configuration
  • - *
  • p6 : the property has no value, the field is not initialized (not initialized means no value)
  • - *
  • p62 : the property has no value, the field is initialized to null
  • - *
  • p7 : the property has no value, it receives one in the constructor, but stay unused
  • - *
  • p8 : the property has no value, it does not receive one.
  • - *
  • p9 : the property has no value, it receives one in a method.
  • - *
- */ -@Component(propagation = true) -@Provides -public class MyComponentToIntrospect implements CheckService { - - @Property(name="p2") - private final String p2; - - @Property - private String p1 = "v1"; - - @Property(name="p3", value = "v3") - private String p3; - - @Property(value = "v4") - private String p4 = "v42"; - - @Property(value = "v5") - private String p5 = "v52"; - - @Property - private String p6; - - @Property - private String p62 = null; - - public MyComponentToIntrospect(@Property(name="p7") String v7) { - p2 = "v2"; - } - - - @Property(name="p8") - public void setP8(String v8) { - - } - - @Property(name="p9") - public void setP9(String v9) { - - } - - @Override - public boolean check() { - return true; - } - - @Override - public Properties getProps() { - return null; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithBundleContextAndProperty.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithBundleContextAndProperty.java deleted file mode 100644 index da37d3288e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithBundleContextAndProperty.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.constructor; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -@Component(immediate = true) -@Provides -public class CheckServiceProviderWithBundleContextAndProperty implements CheckService { - - - private final String message; - private final BundleContext context; - - public CheckServiceProviderWithBundleContextAndProperty(BundleContext context, @Property String message) { - this.message = message; - this.context = context; - } - - public boolean check() { - return message != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("message", message); - props.put("context", context); - - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithDefaultValueProperty.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithDefaultValueProperty.java deleted file mode 100644 index 32e2c417f3..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithDefaultValueProperty.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.constructor; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -@Component(immediate = true) -@Provides -public class CheckServiceProviderWithDefaultValueProperty implements CheckService { - - - private final String message; - - public CheckServiceProviderWithDefaultValueProperty(@Property(value = "message") String message) { - this.message = message; - } - - - public boolean check() { - return message != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("message", message); - - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithNamedProperty.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithNamedProperty.java deleted file mode 100644 index cca6bfed42..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithNamedProperty.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.constructor; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -@Component(immediate = true) -@Provides -public class CheckServiceProviderWithNamedProperty implements CheckService { - - - private final String message; - - public CheckServiceProviderWithNamedProperty(@Property(name = "message") String message) { - this.message = message; - } - - - public boolean check() { - return message != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("message", message); - - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithTwoProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithTwoProperties.java deleted file mode 100644 index eb25b5b0e4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithTwoProperties.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.constructor; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -@Component(immediate = true) -@Provides -public class CheckServiceProviderWithTwoProperties implements CheckService { - - - private final String message; - private final String product; - - public CheckServiceProviderWithTwoProperties(@Property String message, @Property(value="ipojo") String product) { - this.message = message; - this.product = product; - } - - - public boolean check() { - return message != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("message", message); - props.put("product", product); - - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithUnnamedProperty.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithUnnamedProperty.java deleted file mode 100644 index cf79b0de35..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/constructor/CheckServiceProviderWithUnnamedProperty.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.constructor; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; - -import java.util.Properties; - -@Component(immediate = true) -@Provides -public class CheckServiceProviderWithUnnamedProperty implements CheckService { - - - private final String message; - - public CheckServiceProviderWithUnnamedProperty(@Property String message) { - this.message = message; - } - - - public boolean check() { - return message != null; - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("message", message); - - return props; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/metadata.xml deleted file mode 100644 index 9b970ab6d8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,267 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/updated.xml b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/updated.xml deleted file mode 100644 index 89393e8ae5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/main/resources/updated.xml +++ /dev/null @@ -1,103 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 03bdbb6a46..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.junit.After; -import org.junit.Before; -import org.osgi.service.cm.ConfigurationAdmin; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.helpers.ConfigAdminHelper; -import org.ow2.chameleon.testing.helpers.TimeUtils; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - public static int UPDATE_WAIT_TIME = 2000; - - public ConfigAdminHelper caHelper = null; - - public ConfigurationAdmin admin; - - public void grace() { - TimeUtils.grace(UPDATE_WAIT_TIME); - } - - @Override - public boolean deployConfigAdmin() { - return true; - } - - @Before - public void initializeConfigAdmin() { - caHelper = new ConfigAdminHelper(bc); - admin = caHelper.getConfigurationAdmin(); - caHelper.deleteAllConfigurations(); - } - - @After - public void stoppingConfigAdmin() { - caHelper.deleteAllConfigurations(); - caHelper.dispose(); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java deleted file mode 100644 index 8cbfc96902..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestArchitecture.java +++ /dev/null @@ -1,236 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveInstanceDescription; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandlerDescription; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.util.Property; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Dictionary; -import java.util.Hashtable; - -import static junit.framework.Assert.*; - -public class TestArchitecture extends Common { - - /** - * Instance where the ManagedServicePID is provided by the component type. - */ - ComponentInstance instance1; - /** - * Instance where the ManagedServicePID is provided by the instance. - */ - ComponentInstance instance2; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-4"; - Dictionary p = new Hashtable(); - p.put("instance.name", "instance"); - p.put("foo", "foo"); - p.put("bar", "2"); - p.put("baz", "baz"); - instance1 = ipojoHelper.createComponentInstance(type, p); - assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState()); - - type = "CONFIG-FooProviderType-3"; - Dictionary p1 = new Hashtable(); - p1.put("instance.name", "instance-2"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - p1.put("managed.service.pid", "instance"); - instance2 = ipojoHelper.createComponentInstance(type, p1); - - } - - @After - public void tearDown() { - instance1.dispose(); - instance2.dispose(); - - instance1 = null; - instance2 = null; - } - - @Test - public void testArchitectureForInstance1() { - - Architecture arch = osgiHelper.getServiceObject(Architecture.class, - "(architecture.instance=instance)"); - assertNotNull(arch); - - // Test on String representation. - String desc = arch.getInstanceDescription().getDescription().toString(); - assertTrue(desc.contains("managed.service.pid=\"FooProvider-3\"")); - - // Test on handler description - ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties"); - assertNotNull(hd); - - assertEquals(2, hd.getProperties().length); - assertEquals("FooProvider-3", hd.getManagedServicePid()); - - // Check the getInstance() method - assertSame(arch.getInstanceDescription().getInstance(), instance1); - - } - - @Test - public void testArchitectureForInstance2() { - Architecture arch = osgiHelper.getServiceObject(Architecture.class, "(architecture.instance=instance-2)"); - assertNotNull(arch); - - // Test on String representation. - String desc = arch.getInstanceDescription().getDescription().toString(); - assertTrue(desc.contains("managed.service.pid=\"instance\"")); - - // Test on handler description - ConfigurationHandlerDescription hd = (ConfigurationHandlerDescription) arch.getInstanceDescription().getHandlerDescription("org.apache.felix.ipojo:properties"); - assertNotNull(hd); - - assertEquals(2, hd.getProperties().length); - assertEquals("instance", hd.getManagedServicePid()); - - // Check the getInstance() method - assertSame(arch.getInstanceDescription().getInstance(), instance2); - - } - - /** - * Test checking the availability of the architecture instance according to the instance state. - * The architecture instance is available even in the STOPPED state. - */ - @Test - public void testArchitectureServiceAvailability() { - String instanceName = instance1.getInstanceName(); - // Check architecture of instance1 - Architecture arch = ipojoHelper.getArchitectureByName(instanceName); - assertNotNull(arch); - assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState()); - - // We stop the instance - instance1.stop(); - arch = ipojoHelper.getArchitectureByName(instanceName); - assertNotNull(arch); - assertEquals(ComponentInstance.STOPPED, arch.getInstanceDescription().getState()); - - // Restart. - instance1.start(); - arch = ipojoHelper.getArchitectureByName(instanceName); - assertNotNull(arch); - assertEquals(ComponentInstance.VALID, arch.getInstanceDescription().getState()); - - // Disposal - instance1.dispose(); - arch = ipojoHelper.getArchitectureByName(instanceName); - assertNull(arch); - } - - /** - * Checks the introspection possibilities before and after object creation. - * Especially check the 'unvalued' case. - */ - @Test - public void testIntrospection() { - Dictionary configuration = new Hashtable(); - configuration.put("p5", "v5i"); - configuration.put("p7", "v7i"); - configuration.put("p9", "v9i"); - - ComponentInstance instance = ipojoHelper.createComponentInstance( - "org.apache.felix.ipojo.runtime.core.components.arch.MyComponentToIntrospect", - configuration); - - // We don't get the service object until we finished the pre-instantiation tests. - ServiceReference reference = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() + ")", 1000); - - assertNotNull(reference); - - PropertyDescription[] properties = ((PrimitiveInstanceDescription) instance.getInstanceDescription()) - .getProperties(); - - assertNotNull(properties); - - // Check the properties. - assertEquals(getProperty(properties, "p1").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p2").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p3").getValue(), "v3"); // Default value - assertEquals(getProperty(properties, "p4").getValue(), "v4"); // Default value - assertEquals(getProperty(properties, "p5").getValue(), "v5i"); // Instance value - assertEquals(getProperty(properties, "p6").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p6").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p7").getValue(), "v7i"); // Instance value - assertEquals(getProperty(properties, "p8").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p9").getValue(), "v9i"); // Instance value - - // Check the propagation - assertNull(reference.getProperty("p1")); - assertNull(reference.getProperty("p2")); - assertEquals(reference.getProperty("p3"), "v3"); - assertEquals(reference.getProperty("p4"), "v4"); - assertEquals(reference.getProperty("p5"), "v5i"); - assertNull(reference.getProperty("p6")); - assertNull(reference.getProperty("p62")); - assertEquals(reference.getProperty("p7"), "v7i"); - assertNull(reference.getProperty("p8")); - assertEquals(reference.getProperty("p9"), "v9i"); - - // Trigger instantiation - assertTrue(((CheckService) context.getService(reference)).check()); - - // Check new value. - assertEquals(getProperty(properties, "p1").getValue(), "v1"); - assertEquals(getProperty(properties, "p2").getValue(), "v2"); - assertEquals(getProperty(properties, "p3").getValue(), "v3"); // Default value - assertEquals(getProperty(properties, "p4").getValue(), "v42"); // Default value - assertEquals(getProperty(properties, "p5").getValue(), "v52"); // Field value - assertEquals(getProperty(properties, "p6").getValue(), Property.UNVALUED); // Specific value used for null - assertEquals(getProperty(properties, "p62").getValue(), "null"); // Specific value used for null - assertEquals(getProperty(properties, "p7").getValue(), "v7i"); // Instance value - assertEquals(getProperty(properties, "p8").getValue(), Property.UNVALUED); - assertEquals(getProperty(properties, "p9").getValue(), "v9i"); // Instance value - - // New valued properties are not propagated. - // It avoids having fluctuation ins the service registrations - // To enable this propagation use @ServiceProperty - } - - private PropertyDescription getProperty(PropertyDescription[] props, String name) { - for (PropertyDescription desc : props) { - if (desc.getName().equals(name)) { - return desc; - } - } - return null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java deleted file mode 100644 index 07fb384fae..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestBothProperties.java +++ /dev/null @@ -1,870 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -public class TestBothProperties extends Common { - - ComponentInstance instance, instance2; - - @Before - public void setUp() { - Factory fact = ipojoHelper.getFactory("CONFIG-BothConfigurableCheckService"); - Properties props = new Properties(); - props.put("instance.name", "under-test"); - props.put("b", "1"); - props.put("s", "1"); - props.put("i", "1"); - props.put("l", "1"); - props.put("d", "1"); - props.put("f", "1"); - props.put("c", "a"); - props.put("bool", "true"); - props.put("bs", "{1,2,3}"); - props.put("ss", "{1,2,3}"); - props.put("is", "{1,2,3}"); - props.put("ls", "{1,2,3}"); - props.put("ds", "{1,2,3}"); - props.put("fs", "{1,2,3}"); - props.put("cs", "{a,b,c}"); - props.put("bools", "{true,true,true}"); - props.put("string", "foo"); - props.put("strings", "{foo, bar, baz}"); - - try { - instance = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the under-test instance : " + e.getMessage()); - } - - try { - instance2 = fact.createComponentInstance(null); - } catch (Exception e) { - fail("Cannot create the under-test instance2 : " + e.getMessage()); - } - - - } - - @After - public void tearDown() { - instance.dispose(); - instance2.dispose(); - instance = null; - instance2 = null; - } - - @Test - public void testConfigurationPrimitive() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1"), 0); - assertEquals("Check f", f, new Float("1"), 0); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - - Integer upb = (Integer) props.get("upb"); - Integer ups = (Integer) props.get("ups"); - Integer upi = (Integer) props.get("upi"); - Integer upl = (Integer) props.get("upl"); - Integer upd = (Integer) props.get("upd"); - Integer upf = (Integer) props.get("upf"); - Integer upc = (Integer) props.get("upc"); - Integer upbool = (Integer) props.get("upbool"); - - assertEquals("Check upb", upb, new Integer(1)); - assertEquals("Check ups", ups, new Integer(1)); - assertEquals("Check upi", upi, new Integer(1)); - assertEquals("Check upl", upl, new Integer(1)); - assertEquals("Check upd", upd, new Integer(1)); - assertEquals("Check upf", upf, new Integer(1)); - assertEquals("Check upc", upc, new Integer(1)); - assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2"), 0); - assertEquals("2) Check f", f, new Float("2"), 0); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - upb = (Integer) props.get("upb"); - ups = (Integer) props.get("ups"); - upi = (Integer) props.get("upi"); - upl = (Integer) props.get("upl"); - upd = (Integer) props.get("upd"); - upf = (Integer) props.get("upf"); - upc = (Integer) props.get("upc"); - upbool = (Integer) props.get("upbool"); - - assertEquals("2) Check upb", upb, new Integer(2)); - assertEquals("2) Check ups", ups, new Integer(2)); - assertEquals("2) Check upi", upi, new Integer(2)); - assertEquals("2) Check upl", upl, new Integer(2)); - assertEquals("2) Check upd", upd, new Integer(2)); - assertEquals("2) Check upf", upf, new Integer(2)); - assertEquals("2) Check upc", upc, new Integer(2)); - assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1"), 0); - assertEquals("Check f", f, new Float("1"), 0); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - - Integer upb = (Integer) props.get("upb"); - Integer ups = (Integer) props.get("ups"); - Integer upi = (Integer) props.get("upi"); - Integer upl = (Integer) props.get("upl"); - Integer upd = (Integer) props.get("upd"); - Integer upf = (Integer) props.get("upf"); - Integer upc = (Integer) props.get("upc"); - Integer upbool = (Integer) props.get("upbool"); - - assertEquals("Check upb", upb, new Integer(1)); - assertEquals("Check ups", ups, new Integer(1)); - assertEquals("Check upi", upi, new Integer(1)); - assertEquals("Check upl", upl, new Integer(1)); - assertEquals("Check upd", upd, new Integer(1)); - assertEquals("Check upf", upf, new Integer(1)); - assertEquals("Check upc", upc, new Integer(1)); - assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2"), 0); - assertEquals("2) Check f", f, new Float("2"), 0); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - upb = (Integer) props.get("upb"); - ups = (Integer) props.get("ups"); - upi = (Integer) props.get("upi"); - upl = (Integer) props.get("upl"); - upd = (Integer) props.get("upd"); - upf = (Integer) props.get("upf"); - upc = (Integer) props.get("upc"); - upbool = (Integer) props.get("upbool"); - - assertEquals("2) Check upb", upb, new Integer(2)); - assertEquals("2) Check ups", ups, new Integer(2)); - assertEquals("2) Check upi", upi, new Integer(2)); - assertEquals("2) Check upl", upl, new Integer(2)); - assertEquals("2) Check upd", upd, new Integer(2)); - assertEquals("2) Check upf", upf, new Integer(2)); - assertEquals("2) Check upc", upc, new Integer(2)); - assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArrays() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1.0, 0); - assertEquals("Check d 1", d[1], 2.0, 0); - assertEquals("Check d 2", d[2], 3.0, 0); - assertEquals("Check f 0", f[0], 1.0, 0); - assertEquals("Check f 1", f[1], 2.0, 0); - assertEquals("Check f 2", f[2], 3.0, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - - Integer upb = (Integer) props.get("upbs"); - Integer ups = (Integer) props.get("upss"); - Integer upi = (Integer) props.get("upis"); - Integer upl = (Integer) props.get("upls"); - Integer upd = (Integer) props.get("upds"); - Integer upf = (Integer) props.get("upfs"); - Integer upc = (Integer) props.get("upcs"); - Integer upbool = (Integer) props.get("upbools"); - - assertEquals("Check upb", upb, new Integer(1)); - assertEquals("Check ups", ups, new Integer(1)); - assertEquals("Check upi", upi, new Integer(1)); - assertEquals("Check upl", upl, new Integer(1)); - assertEquals("Check upd", upd, new Integer(1)); - assertEquals("Check upf", upf, new Integer(1)); - assertEquals("Check upc", upc, new Integer(1)); - assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3.0, 0); - assertEquals("2) Check d 1", d[1], 2.0, 0); - assertEquals("2) Check d 2", d[2], 1.0, 0); - assertEquals("2) Check f 0", f[0], 3.0, 0); - assertEquals("2) Check f 1", f[1], 2.0, 0); - assertEquals("2) Check f 2", f[2], 1.0, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - upb = (Integer) props.get("upbs"); - ups = (Integer) props.get("upss"); - upi = (Integer) props.get("upis"); - upl = (Integer) props.get("upls"); - upd = (Integer) props.get("upds"); - upf = (Integer) props.get("upfs"); - upc = (Integer) props.get("upcs"); - upbool = (Integer) props.get("upbools"); - - assertEquals("2) Check upb", upb, new Integer(2)); - assertEquals("2) Check ups", ups, new Integer(2)); - assertEquals("2) Check upi", upi, new Integer(2)); - assertEquals("2) Check upl", upl, new Integer(2)); - assertEquals("2) Check upd", upd, new Integer(2)); - assertEquals("2) Check upf", upf, new Integer(2)); - assertEquals("2) Check upc", upc, new Integer(2)); - assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArraysString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1.0, 0); - assertEquals("Check d 1", d[1], 2.0, 0); - assertEquals("Check d 2", d[2], 3.0, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - - Integer upb = (Integer) props.get("upbs"); - Integer ups = (Integer) props.get("upss"); - Integer upi = (Integer) props.get("upis"); - Integer upl = (Integer) props.get("upls"); - Integer upd = (Integer) props.get("upds"); - Integer upf = (Integer) props.get("upfs"); - Integer upc = (Integer) props.get("upcs"); - Integer upbool = (Integer) props.get("upbools"); - - assertEquals("Check upb", upb, new Integer(1)); - assertEquals("Check ups", ups, new Integer(1)); - assertEquals("Check upi", upi, new Integer(1)); - assertEquals("Check upl", upl, new Integer(1)); - assertEquals("Check upd", upd, new Integer(1)); - assertEquals("Check upf", upf, new Integer(1)); - assertEquals("Check upc", upc, new Integer(1)); - assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3.0, 0); - assertEquals("2) Check d 1", d[1], 2.0, 0); - assertEquals("2) Check d 2", d[2], 1.0, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - upb = (Integer) props.get("upbs"); - ups = (Integer) props.get("upss"); - upi = (Integer) props.get("upis"); - upl = (Integer) props.get("upls"); - upd = (Integer) props.get("upds"); - upf = (Integer) props.get("upfs"); - upc = (Integer) props.get("upcs"); - upbool = (Integer) props.get("upbools"); - - assertEquals("2) Check upb", upb, new Integer(2)); - assertEquals("2) Check ups", ups, new Integer(2)); - assertEquals("2) Check upi", upi, new Integer(2)); - assertEquals("2) Check upl", upl, new Integer(2)); - assertEquals("2) Check upd", upd, new Integer(2)); - assertEquals("2) Check upf", upf, new Integer(2)); - assertEquals("2) Check upc", upc, new Integer(2)); - assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationObj() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - - Integer upString = (Integer) props.get("upstring"); - Integer upStrings = (Integer) props.get("upstrings"); - - assertEquals("Check upString", upString, new Integer(1)); - assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - - upString = (Integer) props.get("upstring"); - upStrings = (Integer) props.get("upstrings"); - - assertEquals("2) Check upstring", upString, new Integer(2)); - assertEquals("2) Check upstrings", upStrings, new Integer(2)); - } - - @Test - public void testConfigurationObjString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - - Integer upString = (Integer) props.get("upstring"); - Integer upStrings = (Integer) props.get("upstrings"); - - assertEquals("Check upString", upString, new Integer(1)); - assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - - upString = (Integer) props.get("upstring"); - upStrings = (Integer) props.get("upstrings"); - - assertEquals("2) Check upstring", upString, new Integer(2)); - assertEquals("2) Check upstrings", upStrings, new Integer(2)); - } - - private void reconfigure(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", new Byte("2")); - props2.put("s", new Short("2")); - props2.put("i", new Integer("2")); - props2.put("l", new Long("2")); - props2.put("d", new Double("2")); - props2.put("f", new Float("2")); - props2.put("c", new Character('b')); - props2.put("bool", new Boolean(false)); - props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1}); - props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1}); - props2.put("is", new int[]{3, 2, 1}); - props2.put("ls", new long[]{3, 2, 1}); - props2.put("ds", new double[]{3, 2, 1}); - props2.put("fs", new float[]{3, 2, 1}); - props2.put("cs", new char[]{'c', 'b', 'a'}); - props2.put("bools", new boolean[]{false, false, false}); - props2.put("string", "bar"); - props2.put("strings", new String[]{"baz", "bar", "foo"}); - - ci.reconfigure(props2); - } - - private void reconfigureString(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", "2"); - props2.put("s", "2"); - props2.put("i", "2"); - props2.put("l", "2"); - props2.put("d", "2"); - props2.put("f", "2"); - props2.put("c", "b"); - props2.put("bool", "false"); - props2.put("bs", "{3, 2,1}"); - props2.put("ss", "{3, 2,1}"); - props2.put("is", "{3, 2,1}"); - props2.put("ls", "{3, 2,1}"); - props2.put("ds", "{3, 2,1}"); - props2.put("fs", "{3, 2,1}"); - props2.put("cs", "{c, b , a}"); - props2.put("bools", "{false,false,false}"); - props2.put("string", "bar"); - props2.put("strings", "{baz, bar, foo}"); - - ci.reconfigure(props2); - } - - @Test - public void testConfigurationPrimitiveNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("0")); - assertEquals("Check s", s, new Short("0")); - assertEquals("Check i", i, new Integer("0")); - assertEquals("Check l", l, new Long("0")); - assertEquals("Check d", d, new Double("0"), 0); - assertEquals("Check f", f, new Float("0"), 0); - assertEquals("Check c", c, new Character((char) 0)); - assertEquals("Check bool", bool, new Boolean(false)); - - Integer upb = (Integer) props.get("upb"); - Integer ups = (Integer) props.get("ups"); - Integer upi = (Integer) props.get("upi"); - Integer upl = (Integer) props.get("upl"); - Integer upd = (Integer) props.get("upd"); - Integer upf = (Integer) props.get("upf"); - Integer upc = (Integer) props.get("upc"); - Integer upbool = (Integer) props.get("upbool"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2"), 0); - assertEquals("2) Check f", f, new Float("2"), 0); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - upb = (Integer) props.get("upb"); - ups = (Integer) props.get("ups"); - upi = (Integer) props.get("upi"); - upl = (Integer) props.get("upl"); - upd = (Integer) props.get("upd"); - upf = (Integer) props.get("upf"); - upc = (Integer) props.get("upc"); - upbool = (Integer) props.get("upbool"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - //assertEquals("2) Check upbool", upbool, new Integer(1)); // TODO Why 0 ??? - - } - - @Test - public void testConfigurationPrimitiveArraysNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertNull("Check b nullity", b); - assertNull("Check s nullity", s); - assertNull("Check i nullity", i); - assertNull("Check l nullity", l); - assertNull("Check d nullity", d); - assertNull("Check f nullity", f); - assertNull("Check c nullity", c); - assertNull("Check bool nullity", bool); - - Integer upb = (Integer) props.get("upbs"); - Integer ups = (Integer) props.get("upss"); - Integer upi = (Integer) props.get("upis"); - Integer upl = (Integer) props.get("upls"); - Integer upd = (Integer) props.get("upds"); - Integer upf = (Integer) props.get("upfs"); - Integer upc = (Integer) props.get("upcs"); - Integer upbool = (Integer) props.get("upbools"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3.0, 0); - assertEquals("2) Check d 1", d[1], 2.0, 0); - assertEquals("2) Check d 2", d[2], 1.0, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - upb = (Integer) props.get("upbs"); - ups = (Integer) props.get("upss"); - upi = (Integer) props.get("upis"); - upl = (Integer) props.get("upls"); - upd = (Integer) props.get("upds"); - upf = (Integer) props.get("upfs"); - upc = (Integer) props.get("upcs"); - upbool = (Integer) props.get("upbools"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - assertEquals("2) Check upbool", upbool, new Integer(1)); - - } - - @Test - public void testConfigurationObjNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, null); - assertEquals("Check strings", ss, null); - - - Integer upString = (Integer) props.get("upstring"); - Integer upStrings = (Integer) props.get("upstrings"); - - assertEquals("Check upString", upString, new Integer(0)); - assertEquals("Check upStrings", upStrings, new Integer(0)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - - upString = (Integer) props.get("upstring"); - upStrings = (Integer) props.get("upstrings"); - - assertEquals("2) Check upstring", upString, new Integer(1)); - assertEquals("2) Check upstrings", upStrings, new Integer(1)); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java deleted file mode 100644 index 782915d4b8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComplexProperties.java +++ /dev/null @@ -1,234 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Dictionary; -import java.util.List; -import java.util.Map; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - - -public class TestComplexProperties extends Common { - - - private ServiceReference m_ref; - private CheckService m_check; - - @Before - public void setUp() { - m_ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), "complex"); - assertNotNull("Complex service availability", m_ref); - m_check = (CheckService) osgiHelper.getRawServiceObject(m_ref); - } - - @After - public void tearDown() { - m_check = null; - - } - - @Test - public void testArray() { - String[] array = (String[]) m_check.getProps().get("array"); - assertEquals("Array size", 2, array.length); - assertEquals("Array[0]", "a", array[0]); - assertEquals("Array[1]", "b", array[1]); - } - - @Test - public void testList() { - List list = (List) m_check.getProps().get("list"); - assertEquals("List size", 2, list.size()); - assertEquals("List[0]", "a", list.get(0)); - assertEquals("List[1]", "b", list.get(1)); - } - - @Test - public void testMap() { - Map map = (Map) m_check.getProps().get("map"); - assertEquals("Map size", 2, map.size()); - assertEquals("Map[a]", "a", map.get("a")); - assertEquals("Map[b]", "b", map.get("b")); - } - - @Test - public void testDictionary() { - Dictionary dict = (Dictionary) m_check.getProps().get("dict"); - assertEquals("Map size", 2, dict.size()); - assertEquals("Map[a]", "a", dict.get("a")); - assertEquals("Map[b]", "b", dict.get("b")); - } - - @Test - public void testComplexArray() { - Object[] array = (Object[]) m_check.getProps().get("complex-array"); - assertEquals("Array size", 2, array.length); - assertTrue("Array[0] type", array[0] instanceof List); - assertTrue("Array[1] type", array[1] instanceof List); - List list = (List) array[0]; - assertEquals("List size", 2, list.size()); - assertEquals("List[0]", "a", list.get(0)); - assertEquals("List[1]", "b", list.get(1)); - list = (List) array[1]; - assertEquals("List size - 2", 2, list.size()); - assertEquals("List[0] - 2", "c", list.get(0)); - assertEquals("List[1] - 2", "d", list.get(1)); - } - - @Test - public void testComplexList() { - List list = (List) m_check.getProps().get("complex-list"); - assertEquals("List size", 2, list.size()); - assertTrue("List[0] type", list.get(0) instanceof List); - assertTrue("List[1] type", list.get(1) instanceof List); - List list1 = (List) list.get(0); - assertEquals("List size - 1", 2, list1.size()); - assertEquals("List[0] - 1", "a", list1.get(0)); - assertEquals("List[1] - 1", "b", list1.get(1)); - list1 = (List) list.get(1); - assertEquals("List size - 2", 2, list1.size()); - assertEquals("List[0] - 2", "c", list1.get(0)); - assertEquals("List[1] - 2", "d", list1.get(1)); - } - - @Test - public void testComplexMap() { - Map map = (Map) m_check.getProps().get("complex-map"); - assertEquals("List size", 2, map.size()); - assertTrue("List[0] type", map.get("a") instanceof List); - assertTrue("List[1] type", map.get("b") instanceof List); - List list = (List) map.get("a"); - assertEquals("List size - 1", 2, list.size()); - assertEquals("List[0] - 1", "a", list.get(0)); - assertEquals("List[1] - 1", "b", list.get(1)); - list = (List) map.get("b"); - assertEquals("List size - 2", 2, list.size()); - assertEquals("List[0] - 2", "c", list.get(0)); - assertEquals("List[1] - 2", "d", list.get(1)); - } - - @Test - public void testServiceArray() { - String[] array = (String[]) m_ref.getProperty("array"); - assertEquals("Array size", 2, array.length); - assertEquals("Array[0]", "a", array[0]); - assertEquals("Array[1]", "b", array[1]); - } - - @Test - public void testServiceList() { - List list = (List) m_ref.getProperty("list"); - assertEquals("List size", 2, list.size()); - assertEquals("List[0]", "a", list.get(0)); - assertEquals("List[1]", "b", list.get(1)); - } - - @Test - public void testServiceMap() { - Map map = (Map) m_ref.getProperty("map"); - assertEquals("Map size", 2, map.size()); - assertEquals("Map[a]", "a", map.get("a")); - assertEquals("Map[b]", "b", map.get("b")); - } - - @Test - public void testServiceDictionary() { - Dictionary dict = (Dictionary) m_ref.getProperty("dict"); - assertEquals("Map size", 2, dict.size()); - assertEquals("Map[a]", "a", dict.get("a")); - assertEquals("Map[b]", "b", dict.get("b")); - } - - @Test - public void testServiceComplexArray() { - Object[] array = (Object[]) m_ref.getProperty("complex-array"); - assertEquals("Array size", 2, array.length); - assertTrue("Array[0] type", array[0] instanceof List); - assertTrue("Array[1] type", array[1] instanceof List); - List list = (List) array[0]; - assertEquals("List size", 2, list.size()); - assertEquals("List[0]", "a", list.get(0)); - assertEquals("List[1]", "b", list.get(1)); - list = (List) array[1]; - assertEquals("List size - 2", 2, list.size()); - assertEquals("List[0] - 2", "c", list.get(0)); - assertEquals("List[1] - 2", "d", list.get(1)); - } - - @Test - public void testServiceComplexList() { - List list = (List) m_ref.getProperty("complex-list"); - assertEquals("List size", 2, list.size()); - assertTrue("List[0] type", list.get(0) instanceof List); - assertTrue("List[1] type", list.get(1) instanceof List); - List list1 = (List) list.get(0); - assertEquals("List size - 1", 2, list1.size()); - assertEquals("List[0] - 1", "a", list1.get(0)); - assertEquals("List[1] - 1", "b", list1.get(1)); - list1 = (List) list.get(1); - assertEquals("List size - 2", 2, list1.size()); - assertEquals("List[0] - 2", "c", list1.get(0)); - assertEquals("List[1] - 2", "d", list1.get(1)); - } - - @Test - public void testServiceComplexMap() { - Map map = (Map) m_ref.getProperty("complex-map"); - assertEquals("List size", 2, map.size()); - assertTrue("List[0] type", map.get("a") instanceof List); - assertTrue("List[1] type", map.get("b") instanceof List); - List list = (List) map.get("a"); - assertEquals("List size - 1", 2, list.size()); - assertEquals("List[0] - 1", "a", list.get(0)); - assertEquals("List[1] - 1", "b", list.get(1)); - list = (List) map.get("b"); - assertEquals("List size - 2", 2, list.size()); - assertEquals("List[0] - 2", "c", list.get(0)); - assertEquals("List[1] - 2", "d", list.get(1)); - } - - @Test - public void testServiceEmptyArray() { - String[] array = (String[]) m_ref.getProperty("empty-array"); - assertEquals("Array size", 0, array.length); - } - - @Test - public void testServiceEmptyList() { - List list = (List) m_ref.getProperty("empty-list"); - assertEquals("List size", 0, list.size()); - } - - @Test - public void testServiceEmptyMap() { - Map map = (Map) m_ref.getProperty("empty-map"); - assertEquals("Map size", 0, map.size()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConstructorInjectionOfProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConstructorInjectionOfProperties.java deleted file mode 100644 index b153268ffd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConstructorInjectionOfProperties.java +++ /dev/null @@ -1,120 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - - -public class TestConstructorInjectionOfProperties extends Common { - - - @Test - public void testInjectionOfNamedProperty() { - Dictionary conf = new Hashtable(); - conf.put("message", "message"); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.constructor.CheckServiceProviderWithNamedProperty", conf); - - ServiceReference ref = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() +")", - 1000); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - assertEquals(cs.getProps().getProperty("message"), "message"); - } - - @Test - public void testInjectionOfUnnamedProperty() { - Dictionary conf = new Hashtable(); - conf.put("message", "message"); - - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.constructor.CheckServiceProviderWithUnnamedProperty", conf); - - ServiceReference ref = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() +")", - 1000); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - assertEquals(cs.getProps().getProperty("message"), "message"); - } - - @Test - public void testInjectionOfPropertyWithDefaultValue() { - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.constructor.CheckServiceProviderWithDefaultValueProperty"); - - ServiceReference ref = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() +")", - 1000); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - assertEquals(cs.getProps().getProperty("message"), "message"); - } - - @Test - public void testInjectionOfTwoProperties() { - Dictionary conf = new Hashtable(); - conf.put("message", "message"); - - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.constructor.CheckServiceProviderWithTwoProperties", conf); - - ServiceReference ref = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() +")", - 1000); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - assertEquals(cs.getProps().getProperty("message"), "message"); - assertEquals(cs.getProps().getProperty("product"), "ipojo"); - } - - @Test - public void testInjectionOfAPropertyAndBundleContext() { - Dictionary conf = new Hashtable(); - conf.put("message", "message"); - - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.constructor.CheckServiceProviderWithBundleContextAndProperty", conf); - - ServiceReference ref = osgiHelper.waitForService(CheckService.class.getName(), - "(instance.name=" + instance.getInstanceName() +")", - 1000); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - assertEquals(cs.getProps().getProperty("message"), "message"); - assertNotNull(cs.getProps().get("context")); - assertTrue(cs.getProps().get("context") instanceof BundleContext); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurablePropertiesUsingConfigAdmin.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurablePropertiesUsingConfigAdmin.java deleted file mode 100644 index 6f78e6cb55..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestDynamicallyConfigurablePropertiesUsingConfigAdmin.java +++ /dev/null @@ -1,399 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -/** - * iPOJO does not expose the ManagedServiceFactory anymore, we must use the configuration admin. - */ -public class TestDynamicallyConfigurablePropertiesUsingConfigAdmin extends Common { - - ComponentInstance instance, instance2; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-3"; - - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance-r"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - instance = ipojoHelper.createComponentInstance(type, p1); - - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance2"); - - instance2 = ipojoHelper.createComponentInstance(type, p2); - } - - @After - public void tearDown() { - instance.dispose(); - instance2.dispose(); - instance2 = null; - instance = null; - } - - @Test - public void testStatic() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", 2); - conf.put("foo", "foo"); - conf.put("instance.name", instance.getInstanceName()); - - configuration.update(conf); - - // Asynchronous dispatching of the configuration - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - } - - @Test - public void testStaticNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", 2); - conf.put("foo", "foo"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, 2); - assertEquals("Check baz equality -2", bazP, "zab"); - } - - @Test - public void testDynamic() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", 0); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - } - - @Test - public void testDynamicNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", 0); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, 0); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, 0); - - osgiHelper.getContext().ungetService(fooRef); - } - - @Test - public void testDynamicString() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), - instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", "0"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - } - - @Test - public void testPropagation() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "foo"); - conf.put("bar", 2); - conf.put("propagated1", "propagated"); - conf.put("propagated2", 1); - conf.put(".notpropagated", "xxx"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - System.out.println(instance.getInstanceDescription().getDescription()); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertNotNull("Check the propagated1 existence", fooRef.getProperty("propagated1")); - String prop1 = (String) fooRef.getProperty("propagated1"); - assertNotNull("Check the propagated2 existence", fooRef.getProperty("propagated2")); - Integer prop2 = (Integer) fooRef.getProperty("propagated2"); - assertNull("Check the not propagated non-existence", fooRef.getProperty(".notpropagated")); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "zab"); - assertEquals("Check propagated1 equality", prop1, "propagated"); - assertEquals("Check propagated2 equality", prop2, new Integer(1)); - } - - @Test - public void testPropagationNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "foo"); - conf.put("bar", new Integer(2)); - conf.put("propagated1", "propagated"); - conf.put("propagated2", new Integer(1)); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1")); - String prop1 = (String) fooRef.getProperty("propagated1"); - assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2")); - Integer prop2 = (Integer) fooRef.getProperty("propagated2"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "zab"); - assertEquals("Check propagated1 equality", prop1, "propagated"); - assertEquals("Check propagated2 equality", prop2, new Integer(1)); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java deleted file mode 100644 index b3e3380c4b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFieldProperties.java +++ /dev/null @@ -1,768 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - - -public class TestFieldProperties extends Common { - - ComponentInstance instance; - ComponentInstance instance2; - - @Before - public void setUp() { - osgiHelper = new OSGiHelper(bc); - ipojoHelper = new IPOJOHelper(bc); - Factory fact = ipojoHelper.getFactory("CONFIG-FieldConfigurableCheckService"); - Properties props = new Properties(); - props.put("instance.name", "under-test"); - props.put("b", "1"); - props.put("s", "1"); - props.put("i", "1"); - props.put("l", "1"); - props.put("d", "1"); - props.put("f", "1"); - props.put("c", "a"); - props.put("bool", "true"); - props.put("bs", "{1,2,3}"); - props.put("ss", "{1,2,3}"); - props.put("is", "{1,2,3}"); - props.put("ls", "{1,2,3}"); - props.put("ds", "{1,2,3}"); - props.put("fs", "{1,2,3}"); - props.put("cs", "{a,b,c}"); - props.put("bools", "{true,true,true}"); - props.put("string", "foo"); - props.put("strings", "{foo, bar, baz}"); - - try { - instance = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the under-test instance : " + e.getMessage()); - } - - try { - instance2 = fact.createComponentInstance(null); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot create the instance : " + e.getMessage()); - - } - - - } - - @After - public void tearDown() { - ipojoHelper.dispose(); - osgiHelper.dispose(); - instance.dispose(); - instance2.dispose(); - instance = null; - instance2 = null; - } - - @Test - public void testConfigurationPrimitive() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - } - - @Test - public void testConfigurationPrimitiveNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("0")); - assertEquals("Check s", s, new Short("0")); - assertEquals("Check i", i, new Integer("0")); - assertEquals("Check l", l, new Long("0")); - assertEquals("Check d", d, new Double("0")); - assertEquals("Check f", f, new Float("0")); - assertEquals("Check c", c, new Character((char) 0)); - assertEquals("Check bool", bool, new Boolean(false)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - } - - @Test - public void testConfigurationPrimitiveString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - } - - @Test - public void testConfigurationPrimitiveStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("0")); - assertEquals("Check s", s, new Short("0")); - assertEquals("Check i", i, new Integer("0")); - assertEquals("Check l", l, new Long("0")); - assertEquals("Check d", d, new Double("0")); - assertEquals("Check f", f, new Float("0")); - assertEquals("Check c", c, new Character((char) 0)); - assertEquals("Check bool", bool, new Boolean(false)); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - } - - @Test - public void testConfigurationPrimitiveArrays() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - } - - @Test - public void testConfigurationPrimitiveArraysNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertNull("Check b nullity", b); - assertNull("Check s nullity", s); - assertNull("Check i nullity", i); - assertNull("Check l nullity", l); - assertNull("Check d nullity", d); - assertNull("Check f nullity", f); - assertNull("Check c nullity", c); - assertNull("Check bool nullity", bool); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - } - - @Test - public void testConfigurationPrimitiveArraysString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - } - - @Test - public void testConfigurationPrimitiveArraysStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertNull("Check b nullity", b); - assertNull("Check s nullity", s); - assertNull("Check i nullity", i); - assertNull("Check l nullity", l); - assertNull("Check d nullity", d); - assertNull("Check f nullity", f); - assertNull("Check c nullity", c); - assertNull("Check bool nullity", bool); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - } - - @Test - public void testConfigurationObj() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - } - - @Test - public void testConfigurationObjNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, null); - assertEquals("Check strings", ss, null); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - } - - @Test - public void testConfigurationObjString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - } - - @Test - public void testConfigurationObjStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, null); - assertEquals("Check strings", ss, null); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("TeosgiHelper.getRawServiceObjectty", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - } - - private void reconfigure(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", new Byte("2")); - props2.put("s", new Short("2")); - props2.put("i", new Integer("2")); - props2.put("l", new Long("2")); - props2.put("d", new Double("2")); - props2.put("f", new Float("2")); - props2.put("c", new Character('b')); - props2.put("bool", new Boolean(false)); - props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1}); - props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1}); - props2.put("is", new int[]{3, 2, 1}); - props2.put("ls", new long[]{3, 2, 1}); - props2.put("ds", new double[]{3, 2, 1}); - props2.put("fs", new float[]{3, 2, 1}); - props2.put("cs", new char[]{'c', 'b', 'a'}); - props2.put("bools", new boolean[]{false, false, false}); - props2.put("string", "bar"); - props2.put("strings", new String[]{"baz", "bar", "foo"}); - - ci.reconfigure(props2); - } - - private void reconfigureString(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", "2"); - props2.put("s", "2"); - props2.put("i", "2"); - props2.put("l", "2"); - props2.put("d", "2"); - props2.put("f", "2"); - props2.put("c", "b"); - props2.put("bool", "false"); - props2.put("bs", "{3, 2,1}"); - props2.put("ss", "{3, 2,1}"); - props2.put("is", "{3, 2,1}"); - props2.put("ls", "{3, 2,1}"); - props2.put("ds", "{3, 2,1}"); - props2.put("fs", "{3, 2,1}"); - props2.put("cs", "{c, b , a}"); - props2.put("bools", "{false,false,false}"); - props2.put("string", "bar"); - props2.put("strings", "{baz, bar, foo}"); - - ci.reconfigure(props2); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestListeners.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestListeners.java deleted file mode 100644 index d420fa8432..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestListeners.java +++ /dev/null @@ -1,205 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.handlers.configuration.ConfigurationHandlerDescription; -import org.apache.felix.ipojo.handlers.configuration.ConfigurationListener; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.*; - -import static org.junit.Assert.*; - -/** - * Test that the ConfigurationHandler calls the ConfigurationListeners when watched instance is reconfigured. - */ -public class TestListeners extends Common { - - /** - * The number of reconfigurations, incremented by the {@code CountingListener}s. - */ - int updates = 0; - - /** - * The {@code instance} arguments received by the {@code AppendingListener}s. - */ - List instances = new ArrayList(); - - /** - * The {@code configuration} arguments received by the {@code AppendingListener}s. - */ - List> configs = new ArrayList>(); - - /** - * The tested component instance. - */ - ComponentInstance fooProvider; - - /** - * The configuration handler description of the tested component instance. - */ - ConfigurationHandlerDescription fooConfig; - - /** - * The service provided by the tested component instance. - */ - FooService foo; - - @Before - public void setUp() { - Properties p = new Properties(); - p.put("instance.name", "FooProvider-42"); - p.put("int", 4); - p.put("boolean", false); - p.put("string", "bar"); - p.put("strAProp", new String[]{"bar", "foo"}); - p.put("intAProp", new int[]{1, 2, 3}); - fooProvider = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfUpdated", p); - fooConfig = (ConfigurationHandlerDescription) fooProvider.getInstanceDescription() - .getHandlerDescription("org.apache.felix.ipojo:properties"); - - // Get the service - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-42"); - foo = (FooService) osgiHelper.getRawServiceObject(ref); - } - - @After - public void tearDown() { - fooConfig = null; - fooProvider.dispose(); - fooProvider = null; - } - - /** - * A ConfigurationListener that just count its calls. - */ - private class CountingListener implements ConfigurationListener { - public void configurationChanged(ComponentInstance instance, Map configuration) { - updates++; - } - } - - /** - * A ConfigurationListener that just fails. - *

- * Used to ensure that a failing listener does not prevent the following listeners to be called. - *

- */ - private class ThrowingListener implements ConfigurationListener { - public void configurationChanged(ComponentInstance instance, Map configuration) { - throw new RuntimeException("I'm bad"); - } - } - - /** - * A ConfigurationListener that just appends its arguments. - */ - private class AppendingListener implements ConfigurationListener { - public void configurationChanged(ComponentInstance instance, Map configuration) { - instances.add(instance); - configs.add(configuration); - } - } - - /** - * Test that the listeners registered on the tested instance are called when the instance is reconfigured. - */ - @Test - public void testConfigurationListener() { - // Register listeners - ConfigurationListener l1 = new CountingListener(); - fooConfig.addListener(l1); - ConfigurationListener l2 = new ThrowingListener(); - fooConfig.addListener(l2); - ConfigurationListener l3 = new AppendingListener(); - fooConfig.addListener(l3); - - // Trigger a manual reconfiguration - Hashtable conf = new Hashtable(); - conf.put("int", 40); - conf.put("boolean", true); - conf.put("string", "saloon"); - conf.put("strAProp", new String[]{"bar", "bad"}); - conf.put("intAProp", new int[]{21, 22, 23}); - fooProvider.reconfigure(conf); - - // Check the listeners has been called + check the arguments. - assertEquals(1, updates); - - assertEquals(1, instances.size()); - assertSame(fooProvider, instances.get(0)); - - assertEquals(1, configs.size()); - Map configMap = configs.get(0); - assertEquals(5, configMap.size()); - assertEquals(40, configMap.get("int")); - assertEquals(true, configMap.get("boolean")); - assertEquals("saloon", configMap.get("string")); - assertArrayEquals(new String[]{"bar", "bad"}, (String[]) configMap.get("strAProp")); - assertArrayEquals(new int[]{21, 22, 23}, (int[]) configMap.get("intAProp")); - - // Trigger a POJO internal "reconfiguration". - // It should not trigger any reconfiguration event. - foo.foo(); - - // Check nothing has changed in the listeners - assertEquals(1, updates); - assertEquals(1, instances.size()); - assertEquals(1, configs.size()); - - // Unregister the listeners - fooConfig.removeListener(l1); - fooConfig.removeListener(l2); - fooConfig.removeListener(l3); - - // Trigger a manual reconfiguration - conf.put("int", 40); - conf.put("boolean", true); - conf.put("string", "saloon"); - conf.put("strAProp", new String[]{"bar", "bad"}); - conf.put("intAProp", new int[]{21, 22, 23}); - fooProvider.reconfigure(conf); - - // Check nothing has changed in the listeners, since they are all removed - assertEquals(1, updates); - assertEquals(1, instances.size()); - assertEquals(1, configs.size()); - } - - @Test(expected = NullPointerException.class) - public void testNullProvidedServiceListener() { - // Should fail! - fooConfig.addListener(null); - } - - /** - * This test was initially expecting a NoSuchElementException, in 1.11.2, we changed the method to ignore missing - * listeners. - */ - @Test - public void testRemoveNonexistentProvidedServiceListener() { - fooConfig.removeListener(new ThrowingListener()); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java deleted file mode 100644 index 6965fa6221..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestManagedServiceConfigurableProperties.java +++ /dev/null @@ -1,618 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.ConfigurationException; -import org.osgi.service.cm.ManagedService; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - - -public class TestManagedServiceConfigurableProperties extends Common { - - /** - * Instance where the ManagedServicePID is provided by the component type. - */ - ComponentInstance instance1; - /** - * Instance where the ManagedServicePID is provided by the instance. - */ - ComponentInstance instance2; - /** - * Instance without configuration. - */ - ComponentInstance instance3; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-4"; - Hashtable p = new Hashtable(); - p.put("instance.name", "instance"); - p.put("foo", "foo"); - p.put("bar", "2"); - p.put("baz", "baz"); - instance1 = ipojoHelper.createComponentInstance(type, p); - assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState()); - - type = "CONFIG-FooProviderType-3"; - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance-2"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - p1.put("managed.service.pid", "instance"); - instance2 = ipojoHelper.createComponentInstance(type, p1); - - type = "CONFIG-FooProviderType-3"; - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance-3"); - p2.put("managed.service.pid", "instance-3"); - instance3 = ipojoHelper.createComponentInstance(type, p2); - } - - @After - public void tearDown() { - instance1.dispose(); - instance2.dispose(); - instance3.dispose(); - instance1 = null; - instance2 = null; - instance3 = null; - } - - @Test - public void testStaticInstance1() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID( - ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testStaticInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance"); - assertNotNull("Check ManagedService availability", msRef); - - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testStaticInstance3() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - // No values ... no properties. - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3"); - assertNotNull("Check ManagedService availability", msRef); - - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testDynamicInstance1() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testDynamicInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testDynamicInstance3() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - // No values ... no properties. - assertEquals("Check foo equality", fooP, null); - assertEquals("Check bar equality", barP, null); - assertEquals("Check baz equality", bazP, null); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testDynamicStringInstance1() { - assertEquals("Check instance1 state", ComponentInstance.VALID, instance1.getState()); - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality - 1", fooP, "foo"); - assertEquals("Check bar equality - 1", barP, new Integer(2)); - assertEquals("Check baz equality - 1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedService availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", "0"); - assertEquals("Check instance1 state (2)", ComponentInstance.VALID, instance1.getState()); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - - PrimitiveHandler ph = (PrimitiveHandler) ms; - assertSame("Check the correct instance", ph.getInstanceManager(), instance1); - - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - assertEquals("Check instance1 state (3)", ComponentInstance.VALID, instance1.getState()); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality - 2", fooP, "oof"); - assertEquals("Check bar equality - 2", barP, new Integer(0)); - assertEquals("Check baz equality - 2", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testDynamicStringInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance"); - assertNotNull("Check ManagedService availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", "0"); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getContext().getService(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - osgiHelper.getContext().ungetService(fooRef); - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testPropagationInstance1() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedService availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "foo"); - conf.put("bar", new Integer(2)); - conf.put("propagated1", "propagated"); - conf.put("propagated2", new Integer(1)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1")); - String prop1 = (String) fooRef.getProperty("propagated1"); - assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2")); - Integer prop2 = (Integer) fooRef.getProperty("propagated2"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "zab"); - assertEquals("Check propagated1 equality", prop1, "propagated"); - assertEquals("Check propagated2 equality", prop2, new Integer(1)); - - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testPropagationInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance"); - assertNotNull("Check ManagedService availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "foo"); - conf.put("bar", new Integer(2)); - conf.put("propagated1", "propagated"); - conf.put("propagated2", new Integer(1)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1")); - String prop1 = (String) fooRef.getProperty("propagated1"); - assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2")); - Integer prop2 = (Integer) fooRef.getProperty("propagated2"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "zab"); - assertEquals("Check propagated1 equality", prop1, "propagated"); - assertEquals("Check propagated2 equality", prop2, new Integer(1)); - - osgiHelper.getContext().ungetService(msRef); - } - - @Test - public void testPropagationInstance3() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, null); - assertEquals("Check bar equality", barP, null); - assertEquals("Check baz equality", bazP, null); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instance-3"); - assertNotNull("Check ManagedService availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "foo"); - conf.put("bar", new Integer(2)); - conf.put("propagated1", "propagated"); - conf.put("propagated2", new Integer(1)); - ManagedService ms = (ManagedService) osgiHelper.getContext().getService(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance3.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertNotNull("Check the propagated1 existency", fooRef.getProperty("propagated1")); - String prop1 = (String) fooRef.getProperty("propagated1"); - assertNotNull("Check the propagated2 existency", fooRef.getProperty("propagated2")); - Integer prop2 = (Integer) fooRef.getProperty("propagated2"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "zab"); - assertEquals("Check propagated1 equality", prop1, "propagated"); - assertEquals("Check propagated2 equality", prop2, new Integer(1)); - - osgiHelper.getContext().ungetService(msRef); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java deleted file mode 100644 index c707cf4df2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestMethodProperties.java +++ /dev/null @@ -1,1647 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - - -public class TestMethodProperties extends Common { - - ComponentInstance instance; - - ComponentInstance instance2; - - ComponentInstance instance3; - - - - @Before - public void setUp() { - Factory fact = ipojoHelper.getFactory("CONFIG-MethodConfigurableCheckService"); - Properties props = new Properties(); - props.put("instance.name", "under-test"); - props.put("b", "1"); - props.put("s", "1"); - props.put("i", "1"); - props.put("l", "1"); - props.put("d", "1"); - props.put("f", "1"); - props.put("c", "a"); - props.put("bool", "true"); - props.put("bs", "{1,2,3}"); - props.put("ss", "{1,2,3}"); - props.put("is", "{1,2,3}"); - props.put("ls", "{1,2,3}"); - props.put("ds", "{1,2,3}"); - props.put("fs", "{1,2,3}"); - props.put("cs", "{a,b,c}"); - props.put("bools", "{true,true,true}"); - props.put("string", "foo"); - props.put("strings", "{foo, bar, baz}"); - - try { - instance = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the under-test instance : " + e.getMessage()); - } - - Properties props2 = new Properties(); - props2.put("instance.name", "under-test-2"); - props2.put("b", new Byte("1")); - props2.put("s", new Short("1")); - props2.put("i", new Integer("1")); - props2.put("l", new Long("1")); - props2.put("d", new Double("1")); - props2.put("f", new Float("1")); - props2.put("c", new Character('a')); - props2.put("bool", new Boolean(true)); - props2.put("bs", new byte[]{1, 2, 3}); - props2.put("ss", new short[]{1, 2, 3}); - props2.put("is", new int[]{1, 2, 3}); - props2.put("ls", new long[]{1, 2, 3}); - props2.put("ds", new double[]{1, 2, 3}); - props2.put("fs", new float[]{1, 2, 3}); - props2.put("cs", new char[]{'a', 'b', 'c'}); - props2.put("bools", new boolean[]{true, true, true}); - props2.put("string", "foo"); - props2.put("strings", new String[]{"foo", "bar", "baz"}); - - try { - instance2 = fact.createComponentInstance(props2); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot create the under-test instance 2 : " + e.getMessage()); - } - - try { - instance3 = fact.createComponentInstance(null); - } catch (Exception e) { - e.printStackTrace(); - fail("Cannot create the under-test instance 3 : " + e.getMessage()); - } - - - } - - @After - public void tearDown() { - instance.dispose(); - instance2.dispose(); - instance3.dispose(); - instance = null; - instance2 = null; - instance3 = null; - } - - @Test - public void testConfigurationPrimitive() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); -// - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArrays() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArraysString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationObj() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigure(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - @Test - public void testConfigurationObjString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigureString(instance); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - @Test - public void testConfigurationPrimitive2() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitive2String() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArrays2() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArrays2String() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationObj2() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigure(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - @Test - public void testConfigurationObj2String() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigureString(instance2); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance2.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - private void reconfigure(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", new Byte("2")); - props2.put("s", new Short("2")); - props2.put("i", new Integer("2")); - props2.put("l", new Long("2")); - props2.put("d", new Double("2")); - props2.put("f", new Float("2")); - props2.put("c", new Character('b')); - props2.put("bool", new Boolean(false)); - props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1}); - props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1}); - props2.put("is", new int[]{3, 2, 1}); - props2.put("ls", new long[]{3, 2, 1}); - props2.put("ds", new double[]{3, 2, 1}); - props2.put("fs", new float[]{3, 2, 1}); - props2.put("cs", new char[]{'c', 'b', 'a'}); - props2.put("bools", new boolean[]{false, false, false}); - props2.put("string", "bar"); - props2.put("strings", new String[]{"baz", "bar", "foo"}); - - ci.reconfigure(props2); - } - - private void reconfigureString(ComponentInstance ci) { - Properties props2 = new Properties(); - props2.put("b", "2"); - props2.put("s", "2"); - props2.put("i", "2"); - props2.put("l", "2"); - props2.put("d", "2"); - props2.put("f", "2"); - props2.put("c", "b"); - props2.put("bool", "false"); - props2.put("bs", "{3, 2,1}"); - props2.put("ss", "{3, 2,1}"); - props2.put("is", "{3, 2,1}"); - props2.put("ls", "{3, 2,1}"); - props2.put("ds", "{3, 2,1}"); - props2.put("fs", "{3, 2,1}"); - props2.put("cs", "{c, b , a}"); - props2.put("bools", "{false,false,false}"); - props2.put("string", "bar"); - props2.put("strings", "{baz, bar, foo}"); - - ci.reconfigure(props2); - } - - @Test - public void testConfigurationPrimitiveNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("0")); - assertEquals("Check s", s, new Short("0")); - assertEquals("Check i", i, new Integer("0")); - assertEquals("Check l", l, new Long("0")); - assertEquals("Check d", d, new Double("0")); - assertEquals("Check f", f, new Float("0")); - assertEquals("Check c", c, new Character((char) 0)); - assertEquals("Check bool", bool, new Boolean("false")); - - Integer upb = (Integer) props.get("upb"); - Integer ups = (Integer) props.get("ups"); - Integer upi = (Integer) props.get("upi"); - Integer upl = (Integer) props.get("upl"); - Integer upd = (Integer) props.get("upd"); - Integer upf = (Integer) props.get("upf"); - Integer upc = (Integer) props.get("upc"); - Integer upbool = (Integer) props.get("upbool"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - reconfigure(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - upb = (Integer) props.get("upb"); - ups = (Integer) props.get("ups"); - upi = (Integer) props.get("upi"); - upl = (Integer) props.get("upl"); - upd = (Integer) props.get("upd"); - upf = (Integer) props.get("upf"); - upc = (Integer) props.get("upc"); - upbool = (Integer) props.get("upbool"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - assertEquals("2) Check upbool", upbool, new Integer(1)); - - } - - @Test - public void testConfigurationPrimitiveStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("0")); - assertEquals("Check s", s, new Short("0")); - assertEquals("Check i", i, new Integer("0")); - assertEquals("Check l", l, new Long("0")); - assertEquals("Check d", d, new Double("0")); - assertEquals("Check f", f, new Float("0")); - assertEquals("Check c", c, new Character((char) 0)); - assertEquals("Check bool", bool, new Boolean("false")); - - Integer upb = (Integer) props.get("upb"); - Integer ups = (Integer) props.get("ups"); - Integer upi = (Integer) props.get("upi"); - Integer upl = (Integer) props.get("upl"); - Integer upd = (Integer) props.get("upd"); - Integer upf = (Integer) props.get("upf"); - Integer upc = (Integer) props.get("upc"); - Integer upbool = (Integer) props.get("upbool"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - reconfigureString(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - - upb = (Integer) props.get("upb"); - ups = (Integer) props.get("ups"); - upi = (Integer) props.get("upi"); - upl = (Integer) props.get("upl"); - upd = (Integer) props.get("upd"); - upf = (Integer) props.get("upf"); - upc = (Integer) props.get("upc"); - upbool = (Integer) props.get("upbool"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - assertEquals("2) Check upbool", upbool, new Integer(1)); - - } - - @Test - public void testConfigurationPrimitiveArraysNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertNull("Check b nullity", b); - assertNull("Check s nullity", s); - assertNull("Check i nullity", i); - assertNull("Check l nullity", l); - assertNull("Check d nullity", d); - assertNull("Check f nullity", f); - assertNull("Check c nullity", c); - assertNull("Check bool nullity", bool); - - Integer upb = (Integer) props.get("upbs"); - Integer ups = (Integer) props.get("upss"); - Integer upi = (Integer) props.get("upis"); - Integer upl = (Integer) props.get("upls"); - Integer upd = (Integer) props.get("upds"); - Integer upf = (Integer) props.get("upfs"); - Integer upc = (Integer) props.get("upcs"); - Integer upbool = (Integer) props.get("upbools"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - reconfigure(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - upb = (Integer) props.get("upbs"); - ups = (Integer) props.get("upss"); - upi = (Integer) props.get("upis"); - upl = (Integer) props.get("upls"); - upd = (Integer) props.get("upds"); - upf = (Integer) props.get("upfs"); - upc = (Integer) props.get("upcs"); - upbool = (Integer) props.get("upbools"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - assertEquals("2) Check upbool", upbool, new Integer(1)); - - } - - @Test - public void testConfigurationPrimitiveArraysStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertNull("Check b nullity", b); - assertNull("Check s nullity", s); - assertNull("Check i nullity", i); - assertNull("Check l nullity", l); - assertNull("Check d nullity", d); - assertNull("Check f nullity", f); - assertNull("Check c nullity", c); - assertNull("Check bool nullity", bool); - - Integer upb = (Integer) props.get("upbs"); - Integer ups = (Integer) props.get("upss"); - Integer upi = (Integer) props.get("upis"); - Integer upl = (Integer) props.get("upls"); - Integer upd = (Integer) props.get("upds"); - Integer upf = (Integer) props.get("upfs"); - Integer upc = (Integer) props.get("upcs"); - Integer upbool = (Integer) props.get("upbools"); - - assertEquals("Check upb", upb, new Integer(0)); - assertEquals("Check ups", ups, new Integer(0)); - assertEquals("Check upi", upi, new Integer(0)); - assertEquals("Check upl", upl, new Integer(0)); - assertEquals("Check upd", upd, new Integer(0)); - assertEquals("Check upf", upf, new Integer(0)); - assertEquals("Check upc", upc, new Integer(0)); - assertEquals("Check upbool", upbool, new Integer(0)); - - - reconfigureString(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - - upb = (Integer) props.get("upbs"); - ups = (Integer) props.get("upss"); - upi = (Integer) props.get("upis"); - upl = (Integer) props.get("upls"); - upd = (Integer) props.get("upds"); - upf = (Integer) props.get("upfs"); - upc = (Integer) props.get("upcs"); - upbool = (Integer) props.get("upbools"); - - assertEquals("2) Check upb", upb, new Integer(1)); - assertEquals("2) Check ups", ups, new Integer(1)); - assertEquals("2) Check upi", upi, new Integer(1)); - assertEquals("2) Check upl", upl, new Integer(1)); - assertEquals("2) Check upd", upd, new Integer(1)); - assertEquals("2) Check upf", upf, new Integer(1)); - assertEquals("2) Check upc", upc, new Integer(1)); - assertEquals("2) Check upbool", upbool, new Integer(1)); - - } - - @Test - public void testConfigurationObjNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, null); - assertEquals("Check strings", ss, null); - - - Integer upString = (Integer) props.get("upstring"); - Integer upStrings = (Integer) props.get("upstrings"); - - assertEquals("Check upString", upString, new Integer(0)); - assertEquals("Check upStrings", upStrings, new Integer(0)); - - reconfigure(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - - upString = (Integer) props.get("upstring"); - upStrings = (Integer) props.get("upstrings"); - - assertEquals("2) Check upString", upString, new Integer(1)); - assertEquals("2) Check upStrings", upStrings, new Integer(1)); - } - - @Test - public void testConfigurationObjStringNoValue() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, null); - assertEquals("Check strings", ss, null); - - - Integer upString = (Integer) props.get("upstring"); - Integer upStrings = (Integer) props.get("upstrings"); - - assertEquals("Check upString", upString, new Integer(0)); - assertEquals("Check upStrings", upStrings, new Integer(0)); - - reconfigureString(instance3); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance3.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - - upString = (Integer) props.get("upstring"); - upStrings = (Integer) props.get("upstrings"); - - assertEquals("2) Check upString", upString, new Integer(1)); - assertEquals("2) Check upStrings", upStrings, new Integer(1)); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java deleted file mode 100644 index c1c56f443d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestPropertyModifier.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.Configuration; -import org.ops4j.pax.exam.Option; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import javax.inject.Inject; -import java.util.Properties; - -import static org.junit.Assert.*; -import static org.ops4j.pax.exam.CoreOptions.junitBundles; -import static org.ops4j.pax.exam.CoreOptions.options; - - -public class TestPropertyModifier extends Common { - - @Test - public void testPropertyModifier() { - - ComponentInstance ci = null; - Factory factory = ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.PropertyModifier"); - Properties props = new Properties(); - props.put("cls", new String[]{FooService.class.getName()}); - try { - ci = factory.createComponentInstance(props); - } catch (Exception e) { - e.printStackTrace(); - fail(e.getMessage()); - } - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName()); - assertNotNull("Check ref", ref); - - // Check the service property - // Not exposed here: - assertNull("Classes -0", ref.getProperty("classes")); - - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - assertTrue(check.check()); - - // Property exposed now. - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName()); - Class[] str = (Class[]) ref.getProperty("classes"); - assertEquals("Classes size", 1, str.length); - assertEquals("Classes[0]", FooService.class.getName(), str[0].getName()); - - Properties p = check.getProps(); - Class[] str2 = (Class[]) p.get("classes"); - assertEquals("Classes size -2", 1, str2.length); - assertEquals("Classes[0] -2", FooService.class.getName(), str2[0].getName()); - - Properties props2 = new Properties(); - props2.put("cls", new String[]{FooService.class.getName(), CheckService.class.getName()}); - try { - ci.reconfigure(props2); - } catch (Exception e) { - fail(e.getMessage()); - } - - // Check the service property - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), ci.getInstanceName()); - assertNotNull("Check ref", ref); - str = (Class[]) ref.getProperty("classes"); - assertEquals("Classes size -3", 2, str.length); - assertEquals("Classes[0] -3", FooService.class.getName(), str[0].getName()); - assertEquals("Classes[1] -3", CheckService.class.getName(), str[1].getName()); - - - check = (CheckService) osgiHelper.getRawServiceObject(ref); - p = check.getProps(); - str2 = (Class[]) p.get("classes"); - assertEquals("Classes size -4", 2, str2.length); - assertEquals("Classes[0] -4", FooService.class.getName(), str2[0].getName()); - assertEquals("Classes[1] -4", CheckService.class.getName(), str2[1].getName()); - - ci.dispose(); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java deleted file mode 100644 index 0982b004b7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSimpleProperties.java +++ /dev/null @@ -1,261 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - - -public class TestSimpleProperties extends Common { - - - ComponentInstance fooProvider1; - ComponentInstance fooProvider2; - ComponentInstance fooProvider3; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-Conf"; - - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "FooProvider-1"); - fooProvider1 = ipojoHelper.createComponentInstance(type, p1); - - Properties p2 = new Properties(); - p2.put("instance.name", "FooProvider-2"); - p2.put("int", new Integer(4)); - p2.put("boolean", new Boolean(false)); - p2.put("string", new String("bar")); - p2.put("strAProp", new String[]{"bar", "foo"}); - p2.put("intAProp", new int[]{1, 2, 3}); - fooProvider2 = ipojoHelper.createComponentInstance(type, p2); - - Hashtable p3 = new Hashtable(); - p3.put("instance.name", "FooProvider-3"); - fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValue", p3); - } - - @After - public void tearDown() { - fooProvider1.dispose(); - fooProvider2.dispose(); - fooProvider3.dispose(); - fooProvider1 = null; - fooProvider2 = null; - fooProvider3 = null; - } - - @Test - public void testComponentTypeConfiguration() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName()); - assertNotNull("Check FooService availability", ref); - FooService fs = (FooService) osgiHelper.getContext().getService(ref); - Properties toCheck = fs.fooProps(); - - Integer intProp = (Integer) toCheck.get("intProp"); - Boolean boolProp = (Boolean) toCheck.get("boolProp"); - String strProp = (String) toCheck.get("strProp"); - String[] strAProp = (String[]) toCheck.get("strAProp"); - int[] intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality (1)", intProp, new Integer(2)); - assertEquals("Check longProp equality (1)", boolProp, new Boolean(false)); - assertEquals("Check strProp equality (1)", strProp, new String("foo")); - assertNotNull("Check strAProp not nullity (1)", strAProp); - String[] v = new String[]{"foo", "bar"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - int[] v2 = new int[]{1, 2, 3}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]); - } - } - - // change the field value - assertTrue("Invoke the fs service", fs.foo()); - toCheck = fs.fooProps(); - - - // Re-check the property (change) - intProp = (Integer) toCheck.get("intProp"); - boolProp = (Boolean) toCheck.get("boolProp"); - strProp = (String) toCheck.get("strProp"); - strAProp = (String[]) toCheck.get("strAProp"); - intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3)); - assertEquals("Check longProp equality (2)", boolProp, new Boolean(true)); - assertEquals("Check strProp equality (2)", strProp, new String("bar")); - assertNotNull("Check strAProp not nullity (2)", strAProp); - v = new String[]{"foo", "bar", "baz"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality (2)"); - } - } - assertNotNull("Check intAProp not nullity (2)", intAProp); - v2 = new int[]{3, 2, 1}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]); - } - } - - fs = null; - osgiHelper.getContext().ungetService(ref); - } - - - @Test - public void testInstanceConfiguration() { - ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-2"); - assertNotNull("Check the availability of the FS service", sr); - - FooService fs = (FooService) osgiHelper.getContext().getService(sr); - Properties toCheck = fs.fooProps(); - - // Check service properties - Integer intProp = (Integer) toCheck.get("intProp"); - Boolean boolProp = (Boolean) toCheck.get("boolProp"); - String strProp = (String) toCheck.get("strProp"); - String[] strAProp = (String[]) toCheck.get("strAProp"); - int[] intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality", intProp, new Integer(4)); - assertEquals("Check longProp equality", boolProp, new Boolean(false)); - assertEquals("Check strProp equality", strProp, new String("bar")); - assertNotNull("Check strAProp not nullity", strAProp); - String[] v = new String[]{"bar", "foo"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality"); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - int[] v2 = new int[]{1, 2, 3}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality"); - } - } - - - assertTrue("invoke fs", fs.foo()); - toCheck = fs.fooProps(); - - // Re-check the property (change) - intProp = (Integer) toCheck.get("intProp"); - boolProp = (Boolean) toCheck.get("boolProp"); - strProp = (String) toCheck.get("strProp"); - strAProp = (String[]) toCheck.get("strAProp"); - intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality", intProp, new Integer(3)); - assertEquals("Check longProp equality", boolProp, new Boolean(true)); - assertEquals("Check strProp equality", strProp, new String("foo")); - assertNotNull("Check strAProp not nullity", strAProp); - v = new String[]{"foo", "bar", "baz"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality"); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - v2 = new int[]{3, 2, 1}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality"); - } - } - - fs = null; - osgiHelper.getContext().ungetService(sr); - } - - @Test - public void testNoValue() { - ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3"); - assertNotNull("Check the availability of the FS service", sr); - - FooService fs = (FooService) osgiHelper.getContext().getService(sr); - Properties toCheck = fs.fooProps(); - - // Check service properties - Integer intProp = (Integer) toCheck.get("intProp"); - Boolean boolProp = (Boolean) toCheck.get("boolProp"); - String strProp = (String) toCheck.get("strProp"); - String[] strAProp = (String[]) toCheck.get("strAProp"); - int[] intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality", intProp, new Integer(0)); - assertEquals("Check longProp equality", boolProp, new Boolean(false)); - assertEquals("Check strProp equality", strProp, null); - assertNull("Check strAProp nullity", strAProp); - assertNull("Check intAProp nullity", intAProp); - - assertTrue("invoke fs", fs.foo()); - toCheck = fs.fooProps(); - - // Re-check the property (change) - intProp = (Integer) toCheck.get("intProp"); - boolProp = (Boolean) toCheck.get("boolProp"); - strProp = (String) toCheck.get("strProp"); - strAProp = (String[]) toCheck.get("strAProp"); - intAProp = (int[]) toCheck.get("intAProp"); - - assertEquals("Check intProp equality", intProp, new Integer(3)); - assertEquals("Check longProp equality", boolProp, new Boolean(true)); - assertEquals("Check strProp equality", strProp, new String("bar")); - assertNotNull("Check strAProp not nullity", strAProp); - String[] v = new String[]{"foo", "bar", "baz"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality"); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - int[] v2 = new int[]{3, 2, 1}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality"); - } - } - - fs = null; - osgiHelper.getContext().ungetService(sr); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java deleted file mode 100644 index c1d4a02abc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestSuperMethodProperties.java +++ /dev/null @@ -1,631 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import java.util.Properties; - -import static org.junit.Assert.*; - - -public class TestSuperMethodProperties extends Common { - - ComponentInstance instance; - - @Before - public void setUp() { - Factory fact = ipojoHelper.getFactory("CONFIG-ParentMethodConfigurableCheckService"); - Properties props = new Properties(); - props.put("instance.name", "under-test"); - props.put("b", "1"); - props.put("s", "1"); - props.put("i", "1"); - props.put("l", "1"); - props.put("d", "1"); - props.put("f", "1"); - props.put("c", "a"); - props.put("bool", "true"); - props.put("bs", "{1,2,3}"); - props.put("ss", "{1,2,3}"); - props.put("is", "{1,2,3}"); - props.put("ls", "{1,2,3}"); - props.put("ds", "{1,2,3}"); - props.put("fs", "{1,2,3}"); - props.put("cs", "{a,b,c}"); - props.put("bools", "{true,true,true}"); - props.put("string", "foo"); - props.put("strings", "{foo, bar, baz}"); - - try { - instance = fact.createComponentInstance(props); - } catch (Exception e) { - fail("Cannot create the under-test instance : " + e.getMessage()); - } - - - } - - @After - public void tearDown() { - instance.dispose(); - instance = null; - } - - @Test - public void testConfigurationPrimitive() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - Byte b = (Byte) props.get("b"); - Short s = (Short) props.get("s"); - Integer i = (Integer) props.get("i"); - Long l = (Long) props.get("l"); - Double d = (Double) props.get("d"); - Float f = (Float) props.get("f"); - Character c = (Character) props.get("c"); - Boolean bool = (Boolean) props.get("bool"); - - assertEquals("Check b", b, new Byte("1")); - assertEquals("Check s", s, new Short("1")); - assertEquals("Check i", i, new Integer("1")); - assertEquals("Check l", l, new Long("1")); - assertEquals("Check d", d, new Double("1")); - assertEquals("Check f", f, new Float("1")); - assertEquals("Check c", c, new Character('a')); - assertEquals("Check bool", bool, new Boolean("true")); - -// Integer upb = (Integer) props.get("upb"); -// Integer ups = (Integer) props.get("ups"); -// Integer upi = (Integer) props.get("upi"); -// Integer upl = (Integer) props.get("upl"); -// Integer upd = (Integer) props.get("upd"); -// Integer upf = (Integer) props.get("upf"); -// Integer upc = (Integer) props.get("upc"); -// Integer upbool = (Integer) props.get("upbool"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (Byte) props.get("b"); - s = (Short) props.get("s"); - i = (Integer) props.get("i"); - l = (Long) props.get("l"); - d = (Double) props.get("d"); - f = (Float) props.get("f"); - c = (Character) props.get("c"); - bool = (Boolean) props.get("bool"); - - assertEquals("2) Check b (" + b + ")", b, new Byte("2")); - assertEquals("2) Check s", s, new Short("2")); - assertEquals("2) Check i", i, new Integer("2")); - assertEquals("2) Check l", l, new Long("2")); - assertEquals("2) Check d", d, new Double("2")); - assertEquals("2) Check f", f, new Float("2")); - assertEquals("2) Check c", c, new Character('b')); - assertEquals("2) Check bool", bool, new Boolean("false")); - -// upb = (Integer) props.get("upb"); -// ups = (Integer) props.get("ups"); -// upi = (Integer) props.get("upi"); -// upl = (Integer) props.get("upl"); -// upd = (Integer) props.get("upd"); -// upf = (Integer) props.get("upf"); -// upc = (Integer) props.get("upc"); -// upbool = (Integer) props.get("upbool"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArrays() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigure(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationPrimitiveArraysString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - byte[] b = (byte[]) props.get("bs"); - short[] s = (short[]) props.get("ss"); - int[] i = (int[]) props.get("is"); - long[] l = (long[]) props.get("ls"); - double[] d = (double[]) props.get("ds"); - float[] f = (float[]) props.get("fs"); - char[] c = (char[]) props.get("cs"); - boolean[] bool = (boolean[]) props.get("bools"); - - assertEquals("Check b 0", b[0], 1); - assertEquals("Check b 1", b[1], 2); - assertEquals("Check b 2", b[2], 3); - assertEquals("Check s 0", s[0], 1); - assertEquals("Check s 1", s[1], 2); - assertEquals("Check s 2", s[2], 3); - assertEquals("Check i 0", i[0], 1); - assertEquals("Check i 1", i[1], 2); - assertEquals("Check i 2", i[2], 3); - assertEquals("Check l 0", l[0], 1); - assertEquals("Check l 1", l[1], 2); - assertEquals("Check l 2", l[2], 3); - assertEquals("Check d 0", d[0], 1, 0); - assertEquals("Check d 1", d[1], 2, 0); - assertEquals("Check d 2", d[2], 3, 0); - assertEquals("Check f 0", f[0], 1, 0); - assertEquals("Check f 1", f[1], 2, 0); - assertEquals("Check f 2", f[2], 3, 0); - assertEquals("Check c 0", c[0], 'a'); - assertEquals("Check c 1", c[1], 'b'); - assertEquals("Check c 2", c[2], 'c'); - assertTrue("Check bool 0", bool[0]); - assertTrue("Check bool 1", bool[0]); - assertTrue("Check bool 2", bool[0]); - -// Integer upb = (Integer) props.get("upbs"); -// Integer ups = (Integer) props.get("upss"); -// Integer upi = (Integer) props.get("upis"); -// Integer upl = (Integer) props.get("upls"); -// Integer upd = (Integer) props.get("upds"); -// Integer upf = (Integer) props.get("upfs"); -// Integer upc = (Integer) props.get("upcs"); -// Integer upbool = (Integer) props.get("upbools"); -// -// assertEquals("Check upb", upb, new Integer(1)); -// assertEquals("Check ups", ups, new Integer(1)); -// assertEquals("Check upi", upi, new Integer(1)); -// assertEquals("Check upl", upl, new Integer(1)); -// assertEquals("Check upd", upd, new Integer(1)); -// assertEquals("Check upf", upf, new Integer(1)); -// assertEquals("Check upc", upc, new Integer(1)); -// assertEquals("Check upbool", upbool, new Integer(1)); - - reconfigureString(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - b = (byte[]) props.get("bs"); - s = (short[]) props.get("ss"); - i = (int[]) props.get("is"); - l = (long[]) props.get("ls"); - d = (double[]) props.get("ds"); - f = (float[]) props.get("fs"); - c = (char[]) props.get("cs"); - bool = (boolean[]) props.get("bools"); - - assertEquals("2) Check b 0", b[0], 3); - assertEquals("2) Check b 1", b[1], 2); - assertEquals("2) Check b 2", b[2], 1); - assertEquals("2) Check s 0", s[0], 3); - assertEquals("2) Check s 1", s[1], 2); - assertEquals("2) Check s 2", s[2], 1); - assertEquals("2) Check i 0", i[0], 3); - assertEquals("2) Check i 1", i[1], 2); - assertEquals("2) Check i 2", i[2], 1); - assertEquals("2) Check l 0", l[0], 3); - assertEquals("2) Check l 1", l[1], 2); - assertEquals("2) Check l 2", l[2], 1); - assertEquals("2) Check d 0", d[0], 3, 0); - assertEquals("2) Check d 1", d[1], 2, 0); - assertEquals("2) Check d 2", d[2], 1, 0); - assertEquals("2) Check f 0", f[0], 3, 0); - assertEquals("2) Check f 1", f[1], 2, 0); - assertEquals("2) Check f 2", f[2], 1, 0); - assertEquals("2) Check c 0", c[0], 'c'); - assertEquals("2) Check c 1", c[1], 'b'); - assertEquals("2) Check c 2", c[2], 'a'); - assertFalse("2) Check bool 0", bool[0]); - assertFalse("2) Check bool 1", bool[0]); - assertFalse("2) Check bool 2", bool[0]); - -// upb = (Integer) props.get("upbs"); -// ups = (Integer) props.get("upss"); -// upi = (Integer) props.get("upis"); -// upl = (Integer) props.get("upls"); -// upd = (Integer) props.get("upds"); -// upf = (Integer) props.get("upfs"); -// upc = (Integer) props.get("upcs"); -// upbool = (Integer) props.get("upbools"); -// -// assertEquals("2) Check upb", upb, new Integer(2)); -// assertEquals("2) Check ups", ups, new Integer(2)); -// assertEquals("2) Check upi", upi, new Integer(2)); -// assertEquals("2) Check upl", upl, new Integer(2)); -// assertEquals("2) Check upd", upd, new Integer(2)); -// assertEquals("2) Check upf", upf, new Integer(2)); -// assertEquals("2) Check upc", upc, new Integer(2)); -// assertEquals("2) Check upbool", upbool, new Integer(2)); - - } - - @Test - public void testConfigurationObj() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigure(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - @Test - public void testConfigurationObjString() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - CheckService check = (CheckService) osgiHelper.getRawServiceObject(ref); - Properties props = check.getProps(); - - String s = (String) props.get("string"); - String[] ss = (String[]) props.get("strings"); - - assertEquals("Check string", s, "foo"); - assertEquals("Check strings 0", ss[0], "foo"); - assertEquals("Check strings 1", ss[1], "bar"); - assertEquals("Check strings 2", ss[2], "baz"); - -// Integer upString = (Integer) props.get("upstring"); -// Integer upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("Check upString", upString, new Integer(1)); -// assertEquals("Check upStrings", upStrings, new Integer(1)); - - reconfigureString(); - - ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), instance.getInstanceName()); - assertNotNull("Test check service availability", ref); - check = (CheckService) osgiHelper.getRawServiceObject(ref); - props = check.getProps(); - - s = (String) props.get("string"); - ss = (String[]) props.get("strings"); - - assertEquals("2) Check string", s, "bar"); - assertEquals("2) Check strings 0", ss[0], "baz"); - assertEquals("2) Check strings 1", ss[1], "bar"); - assertEquals("2) Check strings 2", ss[2], "foo"); - -// upString = (Integer) props.get("upstring"); -// upStrings = (Integer) props.get("upstrings"); -// -// assertEquals("2) Check upString", upString, new Integer(2)); -// assertEquals("2) Check upStrings", upStrings, new Integer(2)); - } - - private void reconfigure() { - Properties props2 = new Properties(); - props2.put("instance.name", "under-test"); - props2.put("b", new Byte("2")); - props2.put("s", new Short("2")); - props2.put("i", new Integer("2")); - props2.put("l", new Long("2")); - props2.put("d", new Double("2")); - props2.put("f", new Float("2")); - props2.put("c", new Character('b')); - props2.put("bool", new Boolean(false)); - props2.put("bs", new byte[]{(byte) 3, (byte) 2, (byte) 1}); - props2.put("ss", new short[]{(short) 3, (short) 2, (short) 1}); - props2.put("is", new int[]{3, 2, 1}); - props2.put("ls", new long[]{3, 2, 1}); - props2.put("ds", new double[]{3, 2, 1}); - props2.put("fs", new float[]{3, 2, 1}); - props2.put("cs", new char[]{'c', 'b', 'a'}); - props2.put("bools", new boolean[]{false, false, false}); - props2.put("string", "bar"); - props2.put("strings", new String[]{"baz", "bar", "foo"}); - - instance.reconfigure(props2); - } - - private void reconfigureString() { - Properties props2 = new Properties(); - props2.put("instance.name", "under-test"); - props2.put("b", "2"); - props2.put("s", "2"); - props2.put("i", "2"); - props2.put("l", "2"); - props2.put("d", "2"); - props2.put("f", "2"); - props2.put("c", "b"); - props2.put("bool", "false"); - props2.put("bs", "{3, 2,1}"); - props2.put("ss", "{3, 2,1}"); - props2.put("is", "{3, 2,1}"); - props2.put("ls", "{3, 2,1}"); - props2.put("ds", "{3, 2,1}"); - props2.put("fs", "{3, 2,1}"); - props2.put("cs", "{c, b , a}"); - props2.put("bools", "{false,false,false}"); - props2.put("string", "bar"); - props2.put("strings", "{baz, bar, foo}"); - - instance.reconfigure(props2); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java deleted file mode 100644 index 5852f7eb49..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethod.java +++ /dev/null @@ -1,218 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.IPOJOHelper; -import org.ow2.chameleon.testing.helpers.OSGiHelper; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static org.junit.Assert.*; - - -public class TestUpdatedMethod extends Common { - - ComponentInstance fooProvider1; - ComponentInstance fooProvider2; - ComponentInstance fooProvider3; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-ConfUpdated"; - - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "FooProvider-1"); - fooProvider1 = ipojoHelper.createComponentInstance(type, p1); - - Properties p2 = new Properties(); - p2.put("instance.name", "FooProvider-2"); - p2.put("int", 4); - p2.put("boolean", false); - p2.put("string", "bar"); - p2.put("strAProp", new String[]{"bar", "foo"}); - p2.put("intAProp", new int[]{1, 2, 3}); - fooProvider2 = ipojoHelper.createComponentInstance(type, p2); - - Hashtable p3 = new Hashtable(); - p3.put("instance.name", "FooProvider-3"); - fooProvider3 = ipojoHelper.createComponentInstance("CONFIG-FooProviderType-ConfNoValueUpdated", p3); - } - - @After - public void tearDown() { - fooProvider1.dispose(); - fooProvider2.dispose(); - fooProvider3.dispose(); - fooProvider1 = null; - fooProvider2 = null; - fooProvider3 = null; - } - - @Test - public void testComponentTypeConfiguration() { - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), fooProvider1.getInstanceName()); - assertNotNull("Check FooService availability", ref); - FooService fs = (FooService) osgiHelper.getRawServiceObject(ref); - Properties toCheck = fs.fooProps(); - - Integer intProp = (Integer) toCheck.get("intProp"); - Boolean boolProp = (Boolean) toCheck.get("boolProp"); - String strProp = (String) toCheck.get("strProp"); - String[] strAProp = (String[]) toCheck.get("strAProp"); - int[] intAProp = (int[]) toCheck.get("intAProp"); - - // Check updated - Integer updated = (Integer) toCheck.get("updated"); - Dictionary dict = (Dictionary) toCheck.get("lastupdated"); - - assertEquals("Check intProp equality (1)", intProp, new Integer(2)); - assertEquals("Check longProp equality (1)", boolProp, false); - assertEquals("Check strProp equality (1)", strProp, "foo"); - assertNotNull("Check strAProp not nullity (1)", strAProp); - String[] v = new String[]{"foo", "bar"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality (1) : " + strAProp[i] + " != " + v[i]); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - int[] v2 = new int[]{1, 2, 3}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality (1) : " + intAProp[i] + " != " + v2[i]); - } - } - - assertEquals("updated count ", 1, updated.intValue()); - assertEquals("Last updated", 5, dict.size()); - - // change the field value - assertTrue("Invoke the fs service", fs.foo()); - toCheck = fs.fooProps(); - - - // Re-check the property (change) - intProp = (Integer) toCheck.get("intProp"); - boolProp = (Boolean) toCheck.get("boolProp"); - strProp = (String) toCheck.get("strProp"); - strAProp = (String[]) toCheck.get("strAProp"); - intAProp = (int[]) toCheck.get("intAProp"); - - // Check updated - updated = (Integer) toCheck.get("updated"); - dict = (Dictionary) toCheck.get("lastupdated"); - - assertEquals("Check intProp equality (2) (" + intProp + ")", intProp, new Integer(3)); - assertEquals("Check longProp equality (2)", boolProp, true); - assertEquals("Check strProp equality (2)", strProp, "bar"); - assertNotNull("Check strAProp not nullity (2)", strAProp); - v = new String[]{"foo", "bar", "baz"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality (2)"); - } - } - assertNotNull("Check intAProp not nullity (2)", intAProp); - v2 = new int[]{3, 2, 1}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality (2) : " + intAProp[i] + " != " + v2[i]); - } - } - - // This does not reconfigure... - assertEquals("updated count -2 ", 1, updated.intValue()); - assertEquals("Last update - 2", 5, dict.size()); - - fs = null; - } - - @Test - public void testNoValue() { - ServiceReference sr = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), "FooProvider-3"); - assertNotNull("Check the availability of the FS service", sr); - - FooService fs = (FooService) osgiHelper.getRawServiceObject(sr); - Properties toCheck = fs.fooProps(); - - // Check service properties - Integer intProp = (Integer) toCheck.get("intProp"); - Boolean boolProp = (Boolean) toCheck.get("boolProp"); - String strProp = (String) toCheck.get("strProp"); - String[] strAProp = (String[]) toCheck.get("strAProp"); - int[] intAProp = (int[]) toCheck.get("intAProp"); - - // Check updated - Integer updated = (Integer) toCheck.get("updated"); - Dictionary dict = (Dictionary) toCheck.get("lastupdated"); - - assertEquals("Check intProp equality", intProp, new Integer(0)); - assertEquals("Check longProp equality", boolProp, false); - assertEquals("Check strProp equality", strProp, null); - assertNull("Check strAProp nullity", strAProp); - assertNull("Check intAProp nullity", intAProp); - - assertEquals("updated count ", 1, updated.intValue()); - assertEquals("Last update", 0, dict.size()); - - assertTrue("invoke fs", fs.foo()); - toCheck = fs.fooProps(); - - // Re-check the property (change) - intProp = (Integer) toCheck.get("intProp"); - boolProp = (Boolean) toCheck.get("boolProp"); - strProp = (String) toCheck.get("strProp"); - strAProp = (String[]) toCheck.get("strAProp"); - intAProp = (int[]) toCheck.get("intAProp"); - - updated = (Integer) toCheck.get("updated"); - dict = (Dictionary) toCheck.get("lastupdated"); - - assertEquals("Check intProp equality", intProp, new Integer(3)); - assertEquals("Check longProp equality", boolProp, true); - assertEquals("Check strProp equality", strProp, "bar"); - assertNotNull("Check strAProp not nullity", strAProp); - String[] v = new String[]{"foo", "bar", "baz"}; - for (int i = 0; i < strAProp.length; i++) { - if (!strAProp[i].equals(v[i])) { - fail("Check the strAProp Equality"); - } - } - assertNotNull("Check intAProp not nullity", intAProp); - int[] v2 = new int[]{3, 2, 1}; - for (int i = 0; i < intAProp.length; i++) { - if (intAProp[i] != v2[i]) { - fail("Check the intAProp Equality"); - } - } - - fs = null; - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndConfigAdmin.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndConfigAdmin.java deleted file mode 100644 index c2b1d8e21a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndConfigAdmin.java +++ /dev/null @@ -1,330 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; - - -@ExamReactorStrategy(PerMethod.class) -public class TestUpdatedMethodAndConfigAdmin extends Common { - - ComponentInstance instance, instance2; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-3Updated"; - - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - instance = ipojoHelper.createComponentInstance(type, p1); - - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance2"); - - instance2 = ipojoHelper.createComponentInstance(type, p2); - } - - @After - public void tearDown() { - instance.dispose(); - instance2.dispose(); - instance2 = null; - instance = null; - } - - @Test - public void testStatic() throws IOException, InterruptedException { - - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - System.out.println("Dictionary : " + dict); - assertEquals("Check last updated", 3, dict.size()); // foo bar and baz as a service prooperties. - } - - @Test - public void testStaticNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - } - - @Test - public void testDynamic() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - } - - @Test - public void testDynamicNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - } - - - @Test - public void testDynamicString() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", "0"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java deleted file mode 100644 index 6c9656277b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedMethodAndManagedService.java +++ /dev/null @@ -1,405 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.HandlerFactory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.ConfigurationException; -import org.osgi.service.cm.ManagedService; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; -import java.net.URL; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.fail; -import static org.junit.Assert.assertNotNull; - - -@ExamReactorStrategy(PerMethod.class) -public class TestUpdatedMethodAndManagedService extends Common { - - /** - * Instance where the ManagedServicePID is provided by the component type. - */ - ComponentInstance instance1; - /** - * Instance where the ManagedServicePID is provided by the instance. - */ - ComponentInstance instance2; - - /** - * Instance without configuration. - */ - ComponentInstance instance3; - - @Before - public void setUp() throws IOException { - - for (HandlerFactory handler : osgiHelper.getServiceObjects(HandlerFactory.class)) { - System.out.println("handler : " + handler.getHandlerName() + " - " + handler.getState() + " - " + handler - .getMissingHandlers()); - } - - String type = "CONFIG-FooProviderType-4Updated"; - Hashtable p = new Hashtable(); - p.put("instance.name", "instance"); - p.put("foo", "foo"); - p.put("bar", "2"); - p.put("baz", "baz"); - instance1 = ipojoHelper.createComponentInstance(type, p); - System.out.println(instance1.getInstanceDescription().getDescription()); - - assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState()); - - System.out.println(instance1.getInstanceDescription().getDescription()); - - type = "CONFIG-FooProviderType-3Updated"; - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance-2"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - p1.put("managed.service.pid", "instance-managed-service"); - instance2 = ipojoHelper.createComponentInstance(type, p1); - - type = "CONFIG-FooProviderType-3Updated"; - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance-3"); - p2.put("managed.service.pid", "instance-3"); - instance3 = ipojoHelper.createComponentInstance(type, p2); - } - - - @After - public void tearDown() { - instance1.dispose(); - instance2.dispose(); - instance3.dispose(); - instance1 = null; - instance2 = null; - instance3 = null; - } - - - @Test - public void testStaticInstance1() throws IOException { - for (Architecture architecture : osgiHelper.getServiceObjects(Architecture.class)) { - System.out.println(architecture.getInstanceDescription().getName() + " " + architecture - .getInstanceDescription().getState()); - } - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), - "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - } - - @Test - public void testStaticInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), - "instance-managed-service"); - assertNotNull("Check ManagedService availability", msRef); - - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - } - - @Test - public void testDynamicInstance1() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), - "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated -1", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - } - - @Test - public void testDynamicInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), - "instance-managed-service"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - Dictionary dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated", 1, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - dict = (Dictionary) fs.fooProps().get("lastupdated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - assertEquals("Check last updated", 3, dict.size()); - - } - - public static void dump(BundleContext bc, File output) throws IOException { - if (!output.exists()) { - output.mkdirs(); - } - - for (Bundle bundle : bc.getBundles()) { - if (bundle.getBundleId() == 0) { - continue; - } - System.out.println("Location : " + bundle.getLocation()); - if ("local".equals(bundle.getLocation())) { - continue; // Pax Exam, when you hug me, I feel so... - } - URL location = new URL(bundle.getLocation()); - FileOutputStream outputStream = null; - if (bundle.getVersion() != null) { - outputStream = new FileOutputStream(new File(output, - bundle.getSymbolicName() + "-" + bundle.getVersion().toString() + ".jar")); - } else { - outputStream = new FileOutputStream(new File(output, bundle.getSymbolicName() + ".jar")); - } - - int read = 0; - byte[] bytes = new byte[1024]; - - InputStream inputStream = location.openStream(); - while ((read = inputStream.read(bytes)) != -1) { - outputStream.write(bytes, 0, read); - } - inputStream.close(); - outputStream.close(); - } - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndConfigAdmin.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndConfigAdmin.java deleted file mode 100644 index a9e14753d6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndConfigAdmin.java +++ /dev/null @@ -1,319 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.ops4j.pax.exam.spi.reactors.ExamReactorStrategy; -import org.ops4j.pax.exam.spi.reactors.PerMethod; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; - - -@ExamReactorStrategy(PerMethod.class) -public class TestUpdatedNoArgMethodAndConfigAdmin extends Common { - - ComponentInstance instance, instance2; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-3Updated2"; - - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - instance = ipojoHelper.createComponentInstance(type, p1); - - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance2"); - - instance2 = ipojoHelper.createComponentInstance(type, p2); - } - - @After - public void tearDown() { - instance.dispose(); - instance2.dispose(); - instance2 = null; - instance = null; - } - - @Test - public void testStatic() throws IOException, InterruptedException { - - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - - } - - @Test - public void testStaticNoValue() throws InterruptedException, IOException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin ad = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - } - - @Test - public void testDynamic() throws InterruptedException, IOException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - } - - @Test - public void testDynamicNoValue() throws IOException, InterruptedException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - Object fooP = fooRef.getProperty("foo"); - Object barP = fooRef.getProperty("bar"); - Object bazP = fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, null); - assertEquals("Check bar equality -1", barP, null); - assertEquals("Check baz equality -1", bazP, null); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance2.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - } - - - @Test - public void testDynamicString() throws InterruptedException, IOException { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class); - assertNotNull("Check Configuration Admin availability", admin); - - Configuration configuration = admin.getConfiguration(instance.getInstanceName(), - getTestBundle().getLocation()); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", "0"); - - // Asynchronous dispatching of the configuration - configuration.update(conf); - grace(); - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java b/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java deleted file mode 100644 index 0065c9bb65..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-configuration-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUpdatedNoArgMethodAndManagedService.java +++ /dev/null @@ -1,325 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.ConfigurationException; -import org.osgi.service.cm.ManagedService; - -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.fail; -import static org.junit.Assert.assertNotNull; - - -public class TestUpdatedNoArgMethodAndManagedService extends Common { - - /** - * Instance where the ManagedServicePID is provided by the component type. - */ - ComponentInstance instance1; - /** - * Instance where the ManagedServicePID is provided by the instance. - */ - ComponentInstance instance2; - - /** - * Instance without configuration. - */ - ComponentInstance instance3; - - @Before - public void setUp() { - String type = "CONFIG-FooProviderType-4Updated2"; - Hashtable p = new Hashtable(); - p.put("instance.name", "any-instance"); - p.put("foo", "foo"); - p.put("bar", "2"); - p.put("baz", "baz"); - instance1 = ipojoHelper.createComponentInstance(type, p); - assertEquals("instance1 created", ComponentInstance.VALID, instance1.getState()); - - type = "CONFIG-FooProviderType-3Updated2"; - Hashtable p1 = new Hashtable(); - p1.put("instance.name", "instance-2"); - p1.put("foo", "foo"); - p1.put("bar", "2"); - p1.put("baz", "baz"); - p1.put("managed.service.pid", "instanceMSP"); - instance2 = ipojoHelper.createComponentInstance(type, p1); - - type = "CONFIG-FooProviderType-3Updated2"; - Hashtable p2 = new Hashtable(); - p2.put("instance.name", "instance-3"); - p2.put("managed.service.pid", "instance-3"); - instance3 = ipojoHelper.createComponentInstance(type, p2); - } - - @After - public void tearDown() { - instance1.dispose(); - instance2.dispose(); - instance3.dispose(); - instance1 = null; - instance2 = null; - instance3 = null; - } - - @Test - public void testStaticInstance1() { - ServiceReference fooRef = osgiHelper.waitForService(FooService.class.getName(), - "(instance.name=" + instance1.getInstanceName() + ")", - 5000); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - assertEquals("Check updated", 1, updated.intValue()); - } - - @Test - public void testStaticInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -1", fooP, "foo"); - assertEquals("Check bar equality -1", barP, new Integer(2)); - assertEquals("Check baz equality -1", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instanceMSP"); - assertNotNull("Check ManagedService availability", msRef); - - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("bar", new Integer(2)); - conf.put("foo", "foo"); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - assertEquals("Check foo equality -2", fooP, "foo"); - assertEquals("Check bar equality -2", barP, new Integer(2)); - assertEquals("Check baz equality -2", bazP, "zab"); - - // Get Service - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - } - - @Test - public void testDynamicInstance1() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "FooProvider-3"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Re-check props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance1.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated -1", 1, updated.intValue()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - - } - - @Test - public void testDynamicInstance2() { - ServiceReference fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - assertNotNull("Check FS availability", fooRef); - - String fooP = (String) fooRef.getProperty("foo"); - Integer barP = (Integer) fooRef.getProperty("bar"); - String bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "foo"); - assertEquals("Check bar equality", barP, new Integer(2)); - assertEquals("Check baz equality", bazP, "baz"); - - ServiceReference msRef = osgiHelper.getServiceReferenceByPID(ManagedService.class.getName(), "instanceMSP"); - assertNotNull("Check ManagedServiceFactory availability", msRef); - - // Configuration of baz - Dictionary conf = new Hashtable(); - conf.put("baz", "zab"); - conf.put("foo", "oof"); - conf.put("bar", new Integer(0)); - ManagedService ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - // Recheck props - fooRef = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), instance2.getInstanceName()); - fooP = (String) fooRef.getProperty("foo"); - barP = (Integer) fooRef.getProperty("bar"); - bazP = (String) fooRef.getProperty("baz"); - - assertEquals("Check foo equality", fooP, "oof"); - assertEquals("Check bar equality", barP, new Integer(0)); - assertEquals("Check baz equality", bazP, "zab"); - - // Check field value - FooService fs = (FooService) osgiHelper.getRawServiceObject(fooRef); - Properties p = fs.fooProps(); - fooP = (String) p.get("foo"); - barP = (Integer) p.get("bar"); - - assertEquals("Check foo field equality", fooP, "oof"); - assertEquals("Check bar field equality", barP, new Integer(0)); - - Integer updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated", 1, updated.intValue()); - - conf.put("baz", "zab2"); - conf.put("foo", "oof2"); - conf.put("bar", new Integer(0)); - ms = (ManagedService) osgiHelper.getRawServiceObject(msRef); - try { - ms.updated(conf); - } catch (ConfigurationException e) { - fail("Configuration Exception : " + e); - } - - updated = (Integer) fs.fooProps().get("updated"); - - assertEquals("Check updated -2", 2, updated.intValue()); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-context-injection-test/pom.xml deleted file mode 100644 index 4b0f98e43f..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-context-injection-test - - ${project.artifactId} - - diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingConstructor.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingConstructor.java deleted file mode 100644 index 287025a633..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingConstructor.java +++ /dev/null @@ -1,52 +0,0 @@ -/* -* 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using constructor injection to retrieve the bundle context. - */ -public class ComponentUsingConstructor implements CheckService { - - - private BundleContext context; - - public ComponentUsingConstructor(BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingField.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingField.java deleted file mode 100644 index d256ba6c93..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingField.java +++ /dev/null @@ -1,49 +0,0 @@ -/* -* 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using field injection to retrieve the bundle context. - */ -public class ComponentUsingField implements CheckService { - - // Injected. - private BundleContext context; - - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingMethod.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingMethod.java deleted file mode 100644 index 1be690b556..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ComponentUsingMethod.java +++ /dev/null @@ -1,51 +0,0 @@ -/* -* 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using method injection to retrieve the bundle context. - */ -public class ComponentUsingMethod implements CheckService { - - private BundleContext context; - - public void setContext(BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInConstructor.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInConstructor.java deleted file mode 100644 index 60af998d26..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInConstructor.java +++ /dev/null @@ -1,60 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using constructor injection to retrieve the bundle context. - */ -@Component -@Provides -public class ComponentBundleContextInjectionInConstructor implements CheckService { - - - private BundleContext context; - - /** - * @param context no parameter, as component is the default. - */ - public ComponentBundleContextInjectionInConstructor(@Context BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInField.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInField.java deleted file mode 100644 index 0b0f90f7e2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInField.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using field injection to retrieve the bundle context. - */ -@Component -@Provides -public class ComponentBundleContextInjectionInField implements CheckService { - - @Context(Context.Source.COMPONENT) - private BundleContext context; - - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInMethod.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInMethod.java deleted file mode 100644 index b97e020a01..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentBundleContextInjectionInMethod.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using method injection to retrieve the bundle context. - */ -@Component -@Provides -public class ComponentBundleContextInjectionInMethod implements CheckService { - - private BundleContext context; - - @Context - public void setContext(BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithThreeConstructorParams.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithThreeConstructorParams.java deleted file mode 100644 index ae69c9c81a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithThreeConstructorParams.java +++ /dev/null @@ -1,69 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component receiving both bundle context. - */ -@Component -@Provides -public class ComponentWithThreeConstructorParams implements CheckService { - - private final BundleContext bc; - private BundleContext instance; - - private BundleContext component; - - public ComponentWithThreeConstructorParams(BundleContext bc, @Context(Context.Source.INSTANCE) BundleContext - instance, - @Context BundleContext component) { - this.instance = instance; - this.component = component; - this.bc = bc; - } - - @Override - public boolean check() { - return instance != null && component != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (instance != null) { - map.put("instance", instance); - } - if (component != null) { - map.put("component", component); - } - if (bc != null) { - map.put("bc", bc); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoConstructorParams.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoConstructorParams.java deleted file mode 100644 index 8008e824e1..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoConstructorParams.java +++ /dev/null @@ -1,63 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component receiving both bundle context. - */ -@Component -@Provides -public class ComponentWithTwoConstructorParams implements CheckService { - - private BundleContext instance; - - private BundleContext component; - - public ComponentWithTwoConstructorParams(@Context(Context.Source.INSTANCE) BundleContext instance, - @Context BundleContext component) { - this.instance = instance; - this.component = component; - } - - @Override - public boolean check() { - return instance != null && component != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (instance != null) { - map.put("instance", instance); - } - if (component != null) { - map.put("component", component); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoFields.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoFields.java deleted file mode 100644 index bf32d0218a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoFields.java +++ /dev/null @@ -1,60 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component receiving both bundle context. - */ -@Component -@Provides -public class ComponentWithTwoFields implements CheckService { - - @Context(Context.Source.INSTANCE) - private BundleContext instance; - - @Context(Context.Source.COMPONENT) - private BundleContext component; - - - @Override - public boolean check() { - return instance != null && component != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (instance != null) { - map.put("instance", instance); - } - if (component != null) { - map.put("component", component); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoSetters.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoSetters.java deleted file mode 100644 index b69e0ec930..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/ComponentWithTwoSetters.java +++ /dev/null @@ -1,66 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component receiving both bundle context. - */ -@Component -@Provides -public class ComponentWithTwoSetters implements CheckService { - - private BundleContext instance; - private BundleContext component; - - @Context(Context.Source.INSTANCE) - public void setInstanceContext(BundleContext context) { - this.instance = context; - } - - @Context(Context.Source.COMPONENT) - public void setComponentContext(BundleContext context) { - this.component = context; - } - - @Override - public boolean check() { - return instance != null && component != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (instance != null) { - map.put("instance", instance); - } - if (component != null) { - map.put("component", component); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInConstructor.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInConstructor.java deleted file mode 100644 index 7df6fd96ff..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInConstructor.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using constructor injection to retrieve the bundle context. - */ -@Component -@Provides -public class InstanceBundleContextInjectionInConstructor implements CheckService { - - - private BundleContext context; - - public InstanceBundleContextInjectionInConstructor(@Context(Context.Source.INSTANCE) BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInField.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInField.java deleted file mode 100644 index fa0399e717..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInField.java +++ /dev/null @@ -1,54 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using field injection to retrieve the bundle context. - */ -@Component -@Provides -public class InstanceBundleContextInjectionInField implements CheckService { - - @Context(Context.Source.INSTANCE) - private BundleContext context; - - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInMethod.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInMethod.java deleted file mode 100644 index 7a83414395..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/annotations/InstanceBundleContextInjectionInMethod.java +++ /dev/null @@ -1,57 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.annotations; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using method injection to retrieve the bundle context. - */ -@Component -@Provides -public class InstanceBundleContextInjectionInMethod implements CheckService { - - private BundleContext context; - - @Context(Context.Source.INSTANCE) - public void setContext(BundleContext context) { - this.context = context; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java deleted file mode 100644 index eb0e505846..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/configuration/MyConfiguration.java +++ /dev/null @@ -1,31 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.configuration; - -import org.apache.felix.ipojo.configuration.Configuration; -import org.apache.felix.ipojo.configuration.Instance; -import org.apache.felix.ipojo.runtime.core.components.annotations.InstanceBundleContextInjectionInField; - -import static org.apache.felix.ipojo.configuration.Instance.instance; - -@Configuration -public class MyConfiguration { - - Instance instance1 = instance().of(InstanceBundleContextInjectionInField.class).named("from.configuration"); -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties1.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties1.java deleted file mode 100644 index 43fd99f4cc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties1.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.mix; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using constructor injection to retrieve the bundle context and a property. - * In this component the property is first. - */ -@Component -@Provides -public class MixWithProperties1 implements CheckService { - - - private final String message; - private final BundleContext context; - - public MixWithProperties1(@Property(name = "message") String message, @Context BundleContext context) { - this.context = context; - this.message = message; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - if (message != null) { - map.put("message", message); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties2.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties2.java deleted file mode 100644 index 2a8455f272..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/mix/MixWithProperties2.java +++ /dev/null @@ -1,64 +0,0 @@ -/* -* 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.ipojo.runtime.core.components.mix; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Context; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.osgi.framework.BundleContext; - -import java.util.HashMap; -import java.util.Map; - -/** - * A component using constructor injection to retrieve the bundle context and a property. - * In this component the property is last. - */ -@Component -@Provides -public class MixWithProperties2 implements CheckService { - - - private final String message; - private final BundleContext context; - - public MixWithProperties2(@Context BundleContext context, @Property(name = "message") String message) { - this.context = context; - this.message = message; - } - - @Override - public boolean check() { - return context != null; - } - - @Override - public Map map() { - Map map = new HashMap(); - if (context != null) { - map.put("context", context); - } - if (message != null) { - map.put("message", message); - } - return map; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index c3f2096128..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Map; - -public interface CheckService { - - public boolean check(); - - public Map map(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/resources/metadata.xml deleted file mode 100644 index 10b64cc745..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 0ba6a796b7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.ow2.chameleon.testing.helpers.BaseTest; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - // No custom configuration required. -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromAnnotations.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromAnnotations.java deleted file mode 100644 index 37461a80fb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromAnnotations.java +++ /dev/null @@ -1,129 +0,0 @@ -/* -* 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -import static junit.framework.Assert.assertNotNull; -import static junit.framework.Assert.assertNotSame; -import static org.junit.Assert.assertEquals; - -/** - * Checks that contexts are correctly injected. - * For instance bundle context, we use the 'instance.bundle.context' hidden configuration - * property. We use the BundleContext from the iPOJO bundle context, as a mark for testing, it is obviously, - * not recommended. - * - * These test cases are using Annotation descriptions. - */ -public class TestContextInjectionFromAnnotations extends Common { - - @Test - public void testFieldInjectionOfComponentBundleContext() { - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentBundleContextInjectionInField"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testFieldInjectionOfInstanceBundleContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.InstanceBundleContextInjectionInField", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testMethodInjectionOfComponentBundleContext() { - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentBundleContextInjectionInMethod"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testMethodInjectionOfInstanceBundleContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.InstanceBundleContextInjectionInMethod", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testConstructorInjectionOfComponentBundleContext() { - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentBundleContextInjectionInConstructor"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testConstructorInjectionOfInstanceBundleContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.InstanceBundleContextInjectionInConstructor", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testInstanceCreatedFromConfiguration() { - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, "from.configuration"); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertNotSame(bc, context); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromXML.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromXML.java deleted file mode 100644 index 2a194928bd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestContextInjectionFromXML.java +++ /dev/null @@ -1,113 +0,0 @@ -/* -* 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; - -/** - * Checks that contexts are correctly injected. - * For instance bundle context, we use the 'instance.bundle.context' hidden configuration - * property. We use the BundleContext from the iPOJO bundle context, as a mark for testing, it is obviously, - * not recommended. - * - * These test cases are using XML descriptions. - */ -public class TestContextInjectionFromXML extends Common { - - @Test - public void testFieldInjectionOfComponentBundleContextUsingXML() { - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Field-Component"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testFieldInjectionOfInstanceBundleContextUsingXML() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Field-Instance", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testMethodInjectionOfComponentBundleContextUsingXML() { - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Method-Component"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testMethodInjectionOfInstanceBundleContextUsingXML() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Method-Instance", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testConstructorInjectionOfComponentBundleContextUsingXML() { - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Constructor-Component"); - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - - @Test - public void testConstructorInjectionOfInstanceBundleContextUsingXML() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("CTX-Constructor-Instance", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(bc, context); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingComponentAndInstanceContext.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingComponentAndInstanceContext.java deleted file mode 100644 index 083c2e4921..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingComponentAndInstanceContext.java +++ /dev/null @@ -1,128 +0,0 @@ -/* -* 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; - -/** - * Checks that component can retrieve both contexts. - * For instance bundle context, we use the 'instance.bundle.context' hidden configuration - * property. We use the BundleContext from the iPOJO bundle context, as a mark for testing, it is obviously, - * not recommended. - * - * These test cases are using Annotation descriptions. - */ -public class TestInjectingComponentAndInstanceContext extends Common { - - @Test - public void testSetterInjectionOfBothContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentWithTwoSetters", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("component"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - context = (BundleContext) check.map().get("instance"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testFieldInjectionOfBothContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentWithTwoFields", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("component"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - context = (BundleContext) check.map().get("instance"); - assertNotNull(context); - assertEquals(bc, context); - } - - @Test - public void testConstructorInjectionOfBothContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentWithTwoConstructorParams", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("component"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - context = (BundleContext) check.map().get("instance"); - assertNotNull(context); - assertEquals(bc, context); - } - - /** - * Mix bundle context injection with the default bc injection (legacy). - */ - @Test - public void testConstructorInjectionOfThreeContext() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.annotations.ComponentWithThreeConstructorParams", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("component"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - context = (BundleContext) check.map().get("instance"); - assertNotNull(context); - assertEquals(bc, context); - - context = (BundleContext) check.map().get("bc"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingContextAndProperties.java b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingContextAndProperties.java deleted file mode 100644 index d2f3d5bb8c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInjectingContextAndProperties.java +++ /dev/null @@ -1,76 +0,0 @@ -/* -* 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -import static junit.framework.Assert.assertNotNull; -import static org.junit.Assert.assertEquals; - -/** - * Checks that component can mix property and context in constructor parameters. - * - * These test cases are using Annotation descriptions. - */ -public class TestInjectingContextAndProperties extends Common { - - @Test - public void testWhenPropertyIsFirst() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - configuration.put("message", "hello"); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.mix.MixWithProperties1", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - assertEquals("hello", check.map().get("message")); - } - - @Test - public void testWhenPropertyIsLast() { - BundleContext bc = osgiHelper.getBundle("org.apache.felix.ipojo").getBundleContext(); - Properties configuration = new Properties(); - configuration.put("instance.bundle.context", bc); - configuration.put("message", "hello"); - ComponentInstance instance = ipojoHelper.createComponentInstance("org.apache.felix.ipojo.runtime.core" + - ".components.mix.MixWithProperties2", configuration); - - CheckService check = ipojoHelper.getServiceObjectByName(CheckService.class, instance.getInstanceName()); - assertNotNull(check); - - BundleContext context = (BundleContext) check.map().get("context"); - assertNotNull(context); - assertEquals(getTestBundle().getSymbolicName(), context.getBundle().getSymbolicName()); - - assertEquals("hello", check.map().get("message")); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/resources/exam.properties b/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/resources/exam.properties deleted file mode 100644 index d8a500d9d8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-context-injection-test/src/test/resources/exam.properties +++ /dev/null @@ -1,19 +0,0 @@ -# -# 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. -# - diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-declaration-test/pom.xml deleted file mode 100644 index 36b2a47596..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/pom.xml +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-declaration-test - - ${project.artifactId} - - - - org.ow2.asm - asm-all - 5.0.1 - - - org.apache.felix - org.apache.felix.ipojo.api - 1.12.2-SNAPSHOT - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService.java deleted file mode 100644 index 9668318e85..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.HelloService; - -/** - * User: guillaume - * Date: 20/02/2014 - * Time: 13:29 - */ -@Component(name = "hello-service", version = "2.0") -@Provides -public class EnglishHelloService implements HelloService { - - @Property("Hello2") - private String message; - - @Override - public String hello(final String name) { - return message + " " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService2.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService2.java deleted file mode 100644 index 6d986d285e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/EnglishHelloService2.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.HelloService; - -/** - * User: guillaume - * Date: 20/02/2014 - * Time: 13:29 - */ -@Component(name = "hello-service") -@Provides -public class EnglishHelloService2 implements HelloService { - - @Property("Hello") - private String message; - - @Override - public String hello(final String name) { - return message + " " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FrenchHelloService.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FrenchHelloService.java deleted file mode 100644 index 57ca670955..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/FrenchHelloService.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.annotations.Property; -import org.apache.felix.ipojo.annotations.Provides; -import org.apache.felix.ipojo.runtime.core.test.services.HelloService; - -/** - * User: guillaume - * Date: 20/02/2014 - * Time: 13:29 - */ -@Component -@Provides -public class FrenchHelloService implements HelloService { - - @Property("Bonjour") - private String message; - - @Override - public String hello(final String name) { - return message + " " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/GermanHelloService.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/GermanHelloService.java deleted file mode 100644 index 712a4c32ad..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/components/GermanHelloService.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.components; - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.runtime.core.test.services.HelloService; - -import javax.xml.parsers.SAXParser; - -/** - * I intentionally left empty the component name plus the @Provides annotation. - * This is just to trigger the component manipulation - */ -@Component -public class GermanHelloService implements HelloService { - - SAXParser parser = null; - - @Override - public String hello(final String name) { - return "Hallo " + name; - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/HelloService.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/HelloService.java deleted file mode 100644 index abfff19c97..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/main/java/org/apache/felix/ipojo/runtime/core/test/services/HelloService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.services; - -/** - * User: guillaume - * Date: 20/02/2014 - * Time: 13:29 - */ -public interface HelloService { - String hello(String name); -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/Common.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/Common.java deleted file mode 100644 index 775dd076a5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/Common.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.declaration; - -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.util.Arrays; -import java.util.List; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - @Override - public boolean quiet() { - return true; - } - - - - @Override - public List getExtraExports() { - // The important thing here is to make sure that this package is in the bundle - return Arrays.asList( - "org.apache.felix.ipojo.runtime.core.test.components" - ); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/TestDeclarationBuilderService.java b/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/TestDeclarationBuilderService.java deleted file mode 100644 index 8bda8af230..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-declaration-test/src/test/java/org/apache/felix/ipojo/runtime/core/test/declaration/TestDeclarationBuilderService.java +++ /dev/null @@ -1,209 +0,0 @@ -/* - * 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.ipojo.runtime.core.test.declaration; - -import org.apache.felix.ipojo.IPojoFactory; -import org.apache.felix.ipojo.extender.DeclarationBuilderService; -import org.apache.felix.ipojo.extender.DeclarationHandle; -import org.apache.felix.ipojo.extender.ExtensionDeclaration; -import org.apache.felix.ipojo.extender.builder.FactoryBuilder; -import org.apache.felix.ipojo.extender.builder.FactoryBuilderException; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.test.services.HelloService; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.BundleContext; - -import static java.lang.String.format; -import static junit.framework.Assert.*; - -public class TestDeclarationBuilderService extends Common { - - private DeclarationBuilderService builder; - private DeclarationHandle handle; - - @Before - public void setUp() { - builder = osgiHelper.getServiceObject(DeclarationBuilderService.class); - } - - @After - public void tearDown() { - if (handle != null) { - handle.retract(); - } - } - - @Test - public void testAnonymousInstanceCreation() { - handle = builder.newInstance("org.apache.felix.ipojo.runtime.core.test.components.FrenchHelloService") - .build(); - - // When a service is registered, all events are fired synchronously, we - // can safely test the declaration binding - assertFalse(handle.getStatus().isBound()); - handle.publish(); - - // This test has been already ssen as failed. - HelloService hs = osgiHelper.waitForService(HelloService.class, "(factory.name=org.apache.felix.ipojo.runtime" + - ".core.test.components.FrenchHelloService)", 1000); - assertNotNull(hs); - System.out.println("Status: " + handle.getStatus().isBound()); - - assertTrue(handle.getStatus().isBound()); - handle.retract(); - assertFalse(handle.getStatus().isBound()); - } - - @Test - public void testNamedInstanceCreation() { - handle = builder.newInstance("org.apache.felix.ipojo.runtime.core.test.components.FrenchHelloService") - .name("bonjour-service") - .build(); - - handle.publish(); - assertTrue(ipojoHelper.isServiceAvailableByName(HelloService.class.getName(), "bonjour-service")); - } - - @Test - public void testConfiguredInstanceCreation() { - handle = builder.newInstance("org.apache.felix.ipojo.runtime.core.test.components.FrenchHelloService") - .name("bonjour-service") - .configure() - .property("message", "Salut") - .build(); - - handle.publish(); - assertTrue(ipojoHelper.isServiceAvailableByName(HelloService.class.getName(), "bonjour-service")); - - HelloService service = osgiHelper.getServiceObject(HelloService.class, format("(instance.name=%s)", "bonjour-service")); - assertEquals(service.hello("Guillaume"), "Salut Guillaume"); - } - - @Test - public void testVersionedTypeInstanceCreation() { - handle = builder.newInstance("hello-service") - .version("2.0") - .name("hello2") - .build(); - - handle.publish(); - - String filter = format("(instance.name=%s)", "hello2"); - osgiHelper.waitForService(HelloService.class, filter, 1000); - HelloService service = osgiHelper.getServiceObject(HelloService.class, filter); - assertEquals(service.hello("Guillaume"), "Hello2 Guillaume"); - } - - @Test - public void testExtensionCreation() { - handle = builder.newExtension("test", new EmptyFactoryBuilder()); - - handle.publish(); - - osgiHelper.waitForService(ExtensionDeclaration.class, null, 1000); - } - - @Test - public void testTypeCreation() throws Exception { - - handle = builder.newType(germanComponent()); - handle.publish(); - - DeclarationHandle instance = builder.newInstance("german-service") - .name("german-hello") - .build(); - instance.publish(); - - System.out.println(instance.getStatus().getMessage()); - - String filter = format("(instance.name=%s)", "german-hello"); - osgiHelper.waitForService(HelloService.class, filter, 1000); - HelloService service = osgiHelper.getServiceObject(HelloService.class, filter); - assertEquals(service.hello("Guillaume"), "Hallo Guillaume"); - - instance.retract(); - - } - - /* - @Test - public void testTypeCreationFromAPI() throws Exception { - PrimitiveComponentType type = new PrimitiveComponentType() - .setClassName("org.apache.felix.ipojo.runtime.core.test.components.GermanHelloService") - .setComponentTypeName("german-service") - .addService(new Service()); - - Element description = type.getFactory().getComponentMetadata(); - handle = builder.newType(description); - handle.publish(); - - DeclarationHandle instance = builder.newInstance("german-service") - .name("german-hello") - .build(); - instance.publish(); - - String filter = format("(instance.name=%s)", "german-hello"); - osgiHelper.waitForService(HelloService.class, filter, 1000); - HelloService service = osgiHelper.getServiceObject(HelloService.class, filter); - assertEquals(service.hello("Guillaume"), "Hallo Guillaume"); - - instance.retract(); - - } - */ - - private Element germanComponent() { - Element component = new Element("component", null); - component.addAttribute(new Attribute("name", "german-service")); - component.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.runtime.core.test.components.GermanHelloService")); - component.addElement(new Element("provides", null)); - component.addElement(manipulation()); - return component; - } - - private Element manipulation() { - Element manipulation = new Element("manipulation", null); - manipulation.addAttribute(new Attribute("classname", "org.apache.felix.ipojo.runtime.core.test.components.GermanHelloService")); - manipulation.addAttribute(new Attribute("super", "java.lang.Object")); - - Element itf = new Element("interface", null); - itf.addAttribute(new Attribute("name", "org.apache.felix.ipojo.runtime.core.test.services.HelloService")); - manipulation.addElement(itf); - - Element method = new Element("method", null); - method.addAttribute(new Attribute("name", "hello")); - method.addAttribute(new Attribute("return", "java.lang.String")); - method.addAttribute(new Attribute("arguments", "{java.lang.String}")); - method.addAttribute(new Attribute("names", "{name}")); - manipulation.addElement(method); - - return manipulation; - } - - private static class EmptyFactoryBuilder implements FactoryBuilder { - @Override - public IPojoFactory build(final BundleContext bundleContext, final Element metadata) throws FactoryBuilderException { - return null; - } - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/pom.xml deleted file mode 100644 index 3474f4c9b7..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-external-handlers-test - ${project.artifactId} - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java deleted file mode 100644 index 23a400d67c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceAndFieldInterceptorHandler.java +++ /dev/null @@ -1,131 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.components; - -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckService; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckServiceHandlerDescription; -import org.osgi.framework.ServiceRegistration; - -import java.util.Dictionary; -import java.util.Hashtable; - -public class CheckServiceAndFieldInterceptorHandler extends PrimitiveHandler implements CheckService { - - ServiceRegistration sr; - boolean isValid; - int changes = 0; - static final String NAMESPACE = "org.apache.felix.ipojo.test.handler.checkservice"; - - Dictionary props = new Hashtable(); - private String m_value; - - public void configure(Element metadata, Dictionary configuration) { - Element[] meta = metadata.getElements("checkAndSet", NAMESPACE); - if(meta == null) { return; } - // Get handler props - props.put("instance.name", configuration.get("instance.name")); - if(configuration.get("csh.simple") != null) { props.put("Simple", configuration.get("csh.simple")); } - if(configuration.get("csh.map") != null) { - Dictionary m = (Dictionary) configuration.get("csh.map"); - if (m.size() > 0) { - props.put("Map1", m.get("a")); - props.put("Map2", m.get("b")); - props.put("Map3", m.get("c")); - } - } - props.put("changes", changes); - - getInstanceManager().register(getPojoMetadata().getField("m_foo"), this); - m_value = (String) configuration.get("foo"); - - } - - public void initializeComponentFactory(ComponentTypeDescription cd, Element metadata) { - cd.addProperty(new PropertyDescription("csh.simple", "java.lang.String", null)); - cd.addProperty(new PropertyDescription("csh.map", "java.util.Dictionary", null)); - } - - public void start() { - if(sr == null) { - sr = getInstanceManager().getContext().registerService(CheckService.class.getName(), this, props); - } - isValid = true; - } - - public void stop() { - isValid = false; - synchronized(this) { - if(sr != null) { sr.unregister(); } - } - } - - public boolean check() { - isValid = !isValid; - return isValid; - } - - public Dictionary getProps() { - props.put("foo", m_value); - return props; - } - - public void stateChanged(int state) { - if (sr != null) { - changes++; - props.put("changes", changes); - sr.setProperties(props); - } - } - - public String getName() { - return NAMESPACE; - } - - public HandlerDescription getDescription() { - return new CheckServiceHandlerDescription(this); - } - - @Override - public Object onGet(Object pojo, String fieldName, Object value) { - if (fieldName.equals("m_foo")) { - return m_value; - } - if (pojo == null) { - throw new IllegalStateException("pojo parameter null - FELIX-4072"); - } - return value; - } - - @Override - public void onSet(Object pojo, String fieldName, Object value) { - if (fieldName.equals("m_foo")) { - System.out.println("Attempt to set the foo field to " + value); - m_value = (String) value; - } - if (pojo == null) { - throw new IllegalStateException("pojo parameter null - FELIX-4072"); - } - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceHandler.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceHandler.java deleted file mode 100644 index d2d1a703b6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/CheckServiceHandler.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.components; - -import org.apache.felix.ipojo.PrimitiveHandler; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckService; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckServiceHandlerDescription; -import org.osgi.framework.ServiceRegistration; - -import java.util.Dictionary; -import java.util.Hashtable; - -public class CheckServiceHandler extends PrimitiveHandler implements CheckService { - - ServiceRegistration sr; - boolean isValid; - int changes = 0; - static final String NAMESPACE = "org.apache.felix.ipojo.test.handler.checkservice"; - - Dictionary props = new Hashtable(); - - public void configure(Element metadata, Dictionary configuration) { - Element[] meta = metadata.getElements("check", NAMESPACE); - if(meta == null) { return; } - // Get handler props - props.put("instance.name", configuration.get("instance.name")); - if(configuration.get("csh.simple") != null) { props.put("Simple", configuration.get("csh.simple")); } - if(configuration.get("csh.map") != null) { - Dictionary m = (Dictionary) configuration.get("csh.map"); - if (m.size() > 0) { - props.put("Map1", m.get("a")); - props.put("Map2", m.get("b")); - props.put("Map3", m.get("c")); - } - } - props.put("changes", new Integer(changes)); - - } - - public void initializeComponentFactory(ComponentTypeDescription cd, Element metadata) { - cd.addProperty(new PropertyDescription("csh.simple", "java.lang.String", null)); - cd.addProperty(new PropertyDescription("csh.map", "java.util.Dictionary", null)); - } - - public void start() { - if(sr == null) { - sr = getInstanceManager().getContext().registerService(CheckService.class.getName(), this, props); - } - isValid = true; - } - - public void stop() { - isValid = false; - synchronized(this) { - if(sr != null) { sr.unregister(); } - } - } - - public boolean check() { - if(isValid) { isValid = false;} - else { isValid = true; } - return isValid; - } - - public Dictionary getProps() { - return props; - } - - public void stateChanged(int state) { - if (sr != null) { - changes++; - props.put("changes", new Integer(changes)); - sr.setProperties(props); - } - } - - public String getName() { - return NAMESPACE; - } - - public HandlerDescription getDescription() { - return new CheckServiceHandlerDescription(this); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/FooProviderType1.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/FooProviderType1.java deleted file mode 100644 index 0d2dfb00b8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/components/FooProviderType1.java +++ /dev/null @@ -1,74 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.components; - -import org.apache.felix.ipojo.runtime.externalhandlers.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - // Update m_foo - if (m_foo.equals(VALUE)) { - m_foo = VALUE_2; - } - - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", m_bar); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - int count = 0; - p.put("count", count); - return p; - } - - - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return true; } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckService.java deleted file mode 100644 index 916620d739..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckService.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.services; - -import java.util.Dictionary; -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Dictionary getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckServiceHandlerDescription.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckServiceHandlerDescription.java deleted file mode 100644 index fd20286470..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/CheckServiceHandlerDescription.java +++ /dev/null @@ -1,38 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.services; - -import org.apache.felix.ipojo.Handler; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.metadata.Attribute; -import org.apache.felix.ipojo.metadata.Element; - -public class CheckServiceHandlerDescription extends HandlerDescription { - - public CheckServiceHandlerDescription(Handler h) { - super(h); - } - - public Element getHandlerInfo() { - Element elem = super.getHandlerInfo(); - elem.addAttribute(new Attribute("isValid", isValid()+"")); - return elem; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/FooService.java deleted file mode 100644 index 1ccb16e1f0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/java/org/apache/felix/ipojo/runtime/externalhandlers/services/FooService.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.services; - -import java.util.Properties; - -public interface FooService { - - public static final String VALUE = "my foo is better than yours"; - public static final String VALUE_2 = "No"; - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/resources/metadata.xml deleted file mode 100644 index 0f1f66ffbc..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/AutoHandlerTest.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/AutoHandlerTest.java deleted file mode 100644 index fad6cc3b30..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/AutoHandlerTest.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.test; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.architecture.HandlerDescription; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckServiceHandlerDescription; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import java.util.List; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -public class AutoHandlerTest extends Common { - - private static final String ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE = "org.apache.felix.ipojo.handler.auto.primitive"; - - ComponentInstance instance; - - ComponentFactory factory; - - @Before - public void setUp() { - factory = (ComponentFactory) ipojoHelper.getFactory("HANDLER-HandlerTesterWO"); - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, ""); - } - - @After - public void tearDown() { - if (instance != null) { - instance.dispose(); - } - instance = null; - - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, ""); - - } - - @Test - public void testRequiredHandlerList() { - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, ""); - - factory.stop(); - factory.restart(); - factory.start(); - - List list = factory.getRequiredHandlers(); - assertFalse(list.contains("org.apache.felix.ipojo.test.handler.checkservice:check")); - - String v = "org.apache.felix.ipojo.test.handler.checkservice:check"; - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, v); - - factory.stop(); - factory.restart(); - factory.start(); - - list = factory.getRequiredHandlers(); - assertTrue(list.contains("org.apache.felix.ipojo.test.handler.checkservice:check")); - - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, ""); - - } - - - @Test - public void testInstanceCreation() throws Exception { - String v = "org.apache.felix.ipojo.test.handler.checkservice:check"; - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, v); - - factory.stop(); - factory.restart(); - factory.start(); - - instance = factory.createComponentInstance(new Properties()); - assertEquals(ComponentInstance.VALID, instance.getState()); - - HandlerDescription hd = instance.getInstanceDescription().getHandlerDescription(v); - assertNotNull(hd); - assertTrue(hd instanceof CheckServiceHandlerDescription); - - System.setProperty(ORG_APACHE_FELIX_IPOJO_HANDLER_AUTO_PRIMITIVE, ""); - - factory.stop(); - factory.restart(); - factory.start(); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/Common.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/Common.java deleted file mode 100644 index bfd9e35711..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/Common.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.test; - -import org.ow2.chameleon.testing.helpers.BaseTest; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest{ - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerTest.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerTest.java deleted file mode 100644 index 3728187f13..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerTest.java +++ /dev/null @@ -1,213 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.HandlerManagerFactory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckService; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.Dumps; - -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static junit.framework.Assert.assertFalse; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class HandlerTest extends Common { - - ComponentInstance instance; - - @Before - public void setUp() { - Properties props = new Properties(); - props.put("instance.name", "HandlerTest-1"); - props.put("csh.simple", "simple"); - Properties p = new Properties(); - p.put("a", "a"); - p.put("b", "b"); - p.put("c", "c"); - props.put("csh.map", p); - instance = ipojoHelper.createComponentInstance("HANDLER-HandlerTester", props); - } - - @Test - public void testConfiguration1() { - // Check the availability of CheckService - String name = "HandlerTest-1"; - ServiceReference sr = null; - ServiceReference[] refs = null; - String filter = "(" + "instance.name" + "=" + name + ")"; - refs = osgiHelper.getServiceReferences(CheckService.class.getName(), filter); - if (refs != null) { - sr = refs[0]; - } - - assertNotNull("Check the check service availability", sr); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(sr); - Dictionary p = cs.getProps(); - assertEquals("Assert 'simple' equality", p.get("Simple"), "simple"); - assertEquals("Assert 'a' equality", p.get("Map1"), "a"); - assertEquals("Assert 'b' equality", p.get("Map2"), "b"); - assertEquals("Assert 'c' equality", p.get("Map3"), "c"); - } - - @Test - public void testConfiguration2() { - // Check the availability of CheckService - String name = "HandlerTest-2"; - ServiceReference sr = null; - ServiceReference[] refs = null; - String filter = "(" + "instance.name" + "=" + name + ")"; - - refs = osgiHelper.getServiceReferences(CheckService.class.getName(), filter); - - if (refs != null) { - sr = refs[0]; - } - assertNotNull("Check the check service availability", sr); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(sr); - Dictionary p = cs.getProps(); - assertEquals("Assert 'simple' equality", p.get("Simple"), "Simple"); - assertEquals("Assert 'a' equality", p.get("Map1"), "a"); - assertEquals("Assert 'b' equality", p.get("Map2"), "b"); - assertEquals("Assert 'c' equality", p.get("Map3"), "c"); - } - - @Test - public void testConfiguration3() { - // Check the availability of CheckService - String name = "HandlerTest-2-empty"; - ServiceReference sr = null; - ServiceReference[] refs = null; - String filter = "(" + "instance.name" + "=" + name + ")"; - refs = osgiHelper.getServiceReferences(CheckService.class.getName(), filter); - if (refs != null) { - sr = refs[0]; - } - assertNotNull("Check the check service availability", sr); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(sr); - Dictionary p = cs.getProps(); - assertEquals("Assert 'simple' equality", p.get("Simple"), "Simple"); - assertEquals("Size of p", 3, p.size()); // instance name, simple and changes. - - cs = null; - } - - @Test - public void testLifecycle() { - // Check the availability of CheckService - String name = "HandlerTest-1"; - ServiceReference sr = null; - ServiceReference[] refs = null; - String filter = "(" + "instance.name" + "=" + name + ")"; - refs = osgiHelper.getServiceReferences(CheckService.class.getName(), filter); - if (refs != null) { - sr = refs[0]; - } - assertNotNull("Check the check service availability", sr); - - ServiceReference sr_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "HandlerTest-1"); - Architecture arch = (Architecture) osgiHelper.getRawServiceObject(sr_arch); - - System.out.println("==="); - Dumps.dumpArchitectures(context); - assertEquals("Check instance validity - 0", arch.getInstanceDescription().getState(), ComponentInstance.VALID); - - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(sr); - Dictionary p = cs.getProps(); - Integer changes = (Integer) p.get("changes"); - assertNotNull("Check changes no null", changes); - assertEquals("Changes changes 1 (" + changes + ")", changes.intValue(), 1); - assertEquals("Check instance validity - 1", arch.getInstanceDescription().getState(), ComponentInstance.VALID); - cs.check(); - p = cs.getProps(); - changes = (Integer) p.get("changes"); - assertEquals("Changes changes 2 (" + changes + ")", changes.intValue(), 2); - assertEquals("Check instance validity - 2", arch.getInstanceDescription().getState(), ComponentInstance.INVALID); - cs.check(); - p = cs.getProps(); - changes = (Integer) p.get("changes"); - assertEquals("Changes changes 3 (" + changes + ")", changes.intValue(), 3); - assertEquals("Check instance validity - 3", arch.getInstanceDescription().getState(), ComponentInstance.VALID); - cs.check(); - p = cs.getProps(); - changes = (Integer) p.get("changes"); - assertEquals("Changes changes 4 (" + changes + ")", changes.intValue(), 4); - assertEquals("Check instance validity - 4", arch.getInstanceDescription().getState(), ComponentInstance.INVALID); - } - - @Test - public void testAvailability() { - String name = "HandlerTest-1"; - ServiceReference sr = null; - ServiceReference[] refs = null; - String filter = "(" + "instance.name" + "=" + name + ")"; - refs = osgiHelper.getServiceReferences(CheckService.class.getName(), filter); - - if (refs != null) { - sr = refs[0]; - } - assertNotNull("Check the check service availability", sr); - - ServiceReference sr_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "HandlerTest-1"); - Architecture arch = (Architecture) osgiHelper.getRawServiceObject(sr_arch); - assertEquals("Check validity", arch.getInstanceDescription().getState(), ComponentInstance.VALID); - - // Kill the handler factory - HandlerManagerFactory f = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("check"); - f.stop(); - - boolean av = ipojoHelper.isServiceAvailableByName(CheckService.class.getName(), "HandlerTest-1"); - assertFalse("Check the check service unavailability", av); - - boolean av2 = ipojoHelper.isServiceAvailableByName(Architecture.class.getName(), "HandlerTest-1"); - assertFalse("Check the architecture unavailability", av2); - - // The instance is disposed, restart the handler - f.start(); - - Properties props = new Properties(); - props.put("instance.name", "HandlerTest-1"); - props.put("csh.simple", "simple"); - Properties p = new Properties(); - p.put("a", "a"); - p.put("b", "b"); - p.put("c", "c"); - props.put("csh.map", p); - instance = ipojoHelper.createComponentInstance("HANDLER-HandlerTester", props); - - sr = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), "HandlerTest-1"); - assertNotNull("Check the check service availability - 2", sr); - - sr_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "HandlerTest-1"); - arch = (Architecture) osgiHelper.getRawServiceObject(sr_arch); - assertEquals("Check validity - 2", arch.getInstanceDescription().getState(), ComponentInstance.VALID); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerWithFieldInterceptorTest.java b/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerWithFieldInterceptorTest.java deleted file mode 100644 index cece611ad9..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-external-handlers-test/src/test/java/org/apache/felix/ipojo/runtime/externalhandlers/test/HandlerWithFieldInterceptorTest.java +++ /dev/null @@ -1,84 +0,0 @@ -/* - * 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.ipojo.runtime.externalhandlers.test; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.HandlerManagerFactory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.externalhandlers.services.CheckService; -import org.apache.felix.ipojo.runtime.externalhandlers.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.helpers.Dumps; - -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class HandlerWithFieldInterceptorTest extends Common { - - - ComponentInstance instance; - - @Before - public void setUp() { - Properties props = new Properties(); - props.put("instance.name", "HandlerTest-1"); - props.put("csh.simple", "simple"); - Properties p = new Properties(); - p.put("a", "a"); - p.put("b", "b"); - p.put("c", "c"); - props.put("csh.map", p); - props.put("foo", FooService.VALUE); - instance = ipojoHelper.createComponentInstance("HANDLER-HandlerWithFieldInterceptorTester", props); - } - - @Test - public void testFieldInterception() { - // Check the availability of CheckService - String name = "HandlerTest-1"; - ServiceReference ref = ipojoHelper.getServiceReferenceByName(CheckService.class.getName(), name); - assertNotNull("Check the check service availability", ref); - CheckService cs = (CheckService) osgiHelper.getRawServiceObject(ref); - - Dictionary p = cs.getProps(); - assertEquals("Assert 'simple' equality", p.get("Simple"), "simple"); - assertEquals("Assert 'a' equality", p.get("Map1"), "a"); - assertEquals("Assert 'b' equality", p.get("Map2"), "b"); - assertEquals("Assert 'c' equality", p.get("Map3"), "c"); - - assertEquals("check foo value", FooService.VALUE, cs.getProps().get("foo")); - - // Change value. - - ServiceReference ref2 = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), name); - assertNotNull("Check the foo service availability", ref2); - FooService fs = (FooService) osgiHelper.getRawServiceObject(ref2); - - fs.foo(); // This trigger the changes. - - assertEquals("check foo value", FooService.VALUE_2, cs.getProps().get("foo")); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-factory-test/pom.xml deleted file mode 100644 index c5454978eb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/pom.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-factory-test - - ${project.artifactId} - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java deleted file mode 100644 index 91c9f75a80..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckProviderParentClass.java +++ /dev/null @@ -1,51 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -public abstract class CheckProviderParentClass { - - int simpleU = 0; - int objectU = 0; - int refU = 0; - int bothU = 0; - - - public void bothUnbind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothU++; } - } - - public void refUnbind(ServiceReference sr) { - if(sr != null) { refU++; } - } - - public void objectUnbind(FooService o) { - if(o != null && o instanceof FooService) { objectU++; } - else { - System.err.println("Unbind null : " + o); - } - } - - public void voidUnbind() { - simpleU++; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java deleted file mode 100644 index 5abe52168b..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/CheckServiceProvider.java +++ /dev/null @@ -1,83 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.CheckService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -public class CheckServiceProvider extends CheckProviderParentClass implements CheckService { - - FooService fs; - - int simpleB = 0; - int objectB = 0; - int refB = 0; - int bothB = 0; - - public boolean check() { - return fs.foo(); - } - - public Properties getProps() { - Properties props = new Properties(); - props.put("voidB", new Integer(simpleB)); - props.put("objectB", new Integer(objectB)); - props.put("refB", new Integer(refB)); - props.put("bothB", new Integer(bothB)); - props.put("voidU", new Integer(simpleU)); - props.put("objectU", new Integer(objectU)); - props.put("refU", new Integer(refU)); - props.put("bothU", new Integer(bothU)); - if (fs != null) { - props.put("result", new Boolean(fs.foo())); - props.put("boolean", new Boolean(fs.getBoolean())); - props.put("int", new Integer(fs.getInt())); - props.put("long", new Long(fs.getLong())); - props.put("double", new Double(fs.getDouble())); - if(fs.getObject() != null) { props.put("object", fs.getObject()); } - } - props.put("static", CheckService.foo); - props.put("class", CheckService.class.getName()); - return props; - } - - private void voidBind() { - simpleB++; - } - - protected void objectBind(FooService o) { - if (o == null) { - System.err.println("Bind receive null !!! "); - return; - } - if(o != null && o instanceof FooService) { objectB++; } - } - - public void refBind(ServiceReference sr) { - if(sr != null) { refB++; } - } - - public void bothBind(FooService o, ServiceReference sr) { - if(sr != null && o != null && o instanceof FooService) { bothB++; } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FiveInstances.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FiveInstances.java deleted file mode 100644 index 26484c2279..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FiveInstances.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.runtime.core.services.NoService; - -@Component(name="FiveInstances") -public class FiveInstances implements NoService { -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java deleted file mode 100644 index c53570bdc9..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooBarProviderType1.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooBarProviderType1 implements FooService, BarService { - - public boolean foo() { - return true; - } - - public Properties fooProps() { - return new Properties(); - } - - public boolean bar() { - return true; - } - - public Properties getProps() { - return new Properties(); - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java deleted file mode 100644 index 22059a8d75..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderType1.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.osgi.framework.BundleContext; - -import java.util.Properties; - -public class FooProviderType1 implements FooService { - - private int m_bar; - private String m_foo; - - private BundleContext m_context; - - private static FooProviderType1 singleton; - private static int count = 0; - - private static FooProviderType1 singleton(BundleContext bc) { - if (singleton == null) { - count++; - singleton = new FooProviderType1(bc); - } - return singleton; - } - - public static FooProviderType1 several(BundleContext bc) { - count++; - return new FooProviderType1(bc); - } - - public FooProviderType1(BundleContext bc) { - if (bc ==null) { - throw new RuntimeException("Injected bundle context null"); - } - m_context = bc; - } - - public boolean foo() { - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("bar", new Integer(m_bar)); - if(m_foo != null) { - p.put("foo", m_foo); - } - p.put("context", m_context); - - p.put("count", new Integer(count)); - return p; - } - - public void testException() throws Exception { - String a = "foobarbaz"; - throw new Exception("foo"+a); - } - - public void testTry() { - String a = "foo"; - a.charAt(0); - } - - public void testTry2(String s) { - String a = "foo"; - a.charAt(0); - } - - private void nexttry(String s) { - try { - s += "foo"; - } catch(RuntimeException e) { - - } - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - - /** - * Custom constructor. - * @param bar - * @param foo - * @param bc - */ - public FooProviderType1(int bar, String foo, BundleContext bc) { - m_bar = bar; - m_foo = foo; - m_context = bc; - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java deleted file mode 100644 index c52415f7a2..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn.java +++ /dev/null @@ -1,64 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - - -public class FooProviderTypeDyn implements FooService { - - private int intProp; - private String strProp; - private String[] strAProp; - private int[] intAProp; - private boolean boolProp; - - public boolean foo() { - intProp = 3; - boolProp = true; - if(strProp.equals("foo")) { strProp = "bar"; } - else { strProp = "foo"; } - strAProp = new String[] {"foo", "bar", "baz"}; - intAProp = new int[] {3, 2, 1}; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java deleted file mode 100644 index f1732ba9e3..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/FooProviderTypeDyn2.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -import org.apache.felix.ipojo.runtime.core.services.FooService; - -import java.util.Properties; - -public class FooProviderTypeDyn2 implements FooService { - - private int intProp = 2; - private boolean boolProp = true; - private String strProp = "foo"; - private String[] strAProp = new String[] {"foo", "bar"}; - private int[] intAProp = new int[] {1, 2, 3}; - - public boolean foo() { - intAProp = null; - return true; - } - - public Properties fooProps() { - Properties p = new Properties(); - p.put("intProp", new Integer(intProp)); - p.put("boolProp", new Boolean(boolProp)); - p.put("strProp", strProp); - p.put("strAProp", strAProp); - p.put("intAProp", intAProp); - return p; - } - - public boolean getBoolean() { return true; } - - public double getDouble() { return 1.0; } - - public int getInt() { return 1; } - - public long getLong() { return 1; } - - public Boolean getObject() { return new Boolean(true); } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoInstances.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoInstances.java deleted file mode 100644 index 97c9518173..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/NoInstances.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.runtime.core.services.NoService; - -@Component(name="NoInstances") -public class NoInstances implements NoService { -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/OneDuplicateInstance.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/OneDuplicateInstance.java deleted file mode 100644 index 8bf63c2eff..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/OneDuplicateInstance.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - - -import org.apache.felix.ipojo.annotations.Component; -import org.apache.felix.ipojo.runtime.core.services.NoService; - -@Component(name="OneDuplicateInstance") -public class OneDuplicateInstance implements NoService { -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java deleted file mode 100644 index 04f5def669..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/ReconfigurableSimpleType.java +++ /dev/null @@ -1,63 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class ReconfigurableSimpleType { - - - private String prop; // Property. - - private String x; // Property. - - boolean controller; - - public void start () { - if (prop == null || prop.equals("KO")) { - throw new IllegalStateException("Bad Configuration : " + prop); - } - - if (x == null) { - throw new IllegalStateException("x is null"); - } - - System.out.println("OK !!!!"); - } - - public void setX(String v) { - x = v; - } - - public void setProp(String p) { - prop = p; - if (prop == null || prop.equals("KO")) { - controller = false; - } else { - controller = true; - System.out.println("OK !!!!"); - } - } - - public void setController(boolean p) { - if (p) { - System.out.println("OK !!!!"); - } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java deleted file mode 100644 index 80b590e5fa..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/components/SimpleType.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.runtime.core.components; - -public class SimpleType { - - private boolean m_controller; - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java deleted file mode 100644 index 62eb08d3ae..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/BarService.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface BarService { - - public boolean bar(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java deleted file mode 100644 index 55bf6bb85a..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/CheckService.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface CheckService { - - public static final String foo = "foo"; - - public boolean check(); - - public Properties getProps(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java deleted file mode 100644 index 4ce1646d0c..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/FooService.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -import java.util.Properties; - -public interface FooService { - - boolean foo(); - - Properties fooProps(); - - Boolean getObject(); - - boolean getBoolean(); - - int getInt(); - - long getLong(); - - double getDouble(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/NoService.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/NoService.java deleted file mode 100644 index 69cec05c4d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/java/org/apache/felix/ipojo/runtime/core/services/NoService.java +++ /dev/null @@ -1,23 +0,0 @@ -/* - * 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.ipojo.runtime.core.services; - -public interface NoService { - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/resources/metadata.xml b/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/resources/metadata.xml deleted file mode 100644 index ee42f7096d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/main/resources/metadata.xml +++ /dev/null @@ -1,174 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java deleted file mode 100644 index 069dc882b6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/Common.java +++ /dev/null @@ -1,70 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.junit.After; -import org.junit.Before; -import org.osgi.service.cm.ConfigurationAdmin; -import org.ow2.chameleon.testing.helpers.BaseTest; -import org.ow2.chameleon.testing.helpers.ConfigAdminHelper; -import org.ow2.chameleon.testing.helpers.TimeUtils; - -import static junit.framework.Assert.fail; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - public static int UPDATE_WAIT_TIME = 2000; - public ConfigAdminHelper caHelper = null; - public ConfigurationAdmin admin; - - public void grace() { - TimeUtils.grace(UPDATE_WAIT_TIME); - } - - @Override - public boolean deployConfigAdmin() { - return true; - } - - @Before - public void initializeConfigAdmin() { - caHelper = new ConfigAdminHelper(bc); - admin = caHelper.getConfigurationAdmin(); - caHelper.deleteAllConfigurations(); - } - - @After - public void stoppingConfigAdmin() { - caHelper.deleteAllConfigurations(); - caHelper.dispose(); - } - - public void assertContains(String s, String[] arrays, String object) { - for (String suspect : arrays) { - if (object.equals(suspect)) { - return; - } - } - fail("Assertion failed : " + s); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java deleted file mode 100644 index 1561e58ee6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestComponentDesc.java +++ /dev/null @@ -1,345 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.ComponentTypeDescription; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.metadata.Element; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Arrays; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.*; - -/** - * Check component type description. - */ -public class TestComponentDesc extends Common { - - ServiceReference sr_fooProvider1; - ServiceReference sr_fooProvider2; - ServiceReference sr_fooProviderDyn2; - ServiceReference sr_fooProvider3; - ServiceReference sr_foobarProvider; - - Factory fooProvider1; - Factory fooProvider2; - Factory fooProviderDyn2; - Factory fooProvider3; - Factory foobarProvider; - - @Before - public void setUp() { - - sr_fooProvider1 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-1"); - sr_fooProvider2 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-2"); - sr_fooProviderDyn2 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-Dyn2"); - sr_fooProvider3 = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooProviderType-3"); - sr_foobarProvider = osgiHelper.getServiceReferenceByPID(Factory.class, "Factories-FooBarProviderType-1"); - - fooProvider1 = ipojoHelper.getFactory("Factories-FooProviderType-1"); - fooProvider2 = ipojoHelper.getFactory("Factories-FooProviderType-2"); - fooProviderDyn2 = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - fooProvider3 = ipojoHelper.getFactory("Factories-FooProviderType-3"); - foobarProvider = ipojoHelper.getFactory("Factories-FooBarProviderType-1"); - } - - /** - * Check simple providing. - */ - @Test - public void testFooProvider1() { - // Test SR properties -// String impl = (String) sr_fooProvider1.getProperty("component.class"); -// assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"); - - String[] specs = (String[]) sr_fooProvider1.getProperty("component.providedServiceSpecifications"); - assertEquals("Check component.providedServiceSpecifications length", specs.length, 1); - assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]); - - PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider1.getProperty("component.properties"); - assertEquals("Check component.properties length", pd.length, 0); - - // Test factory - assertEquals("Check factory name", fooProvider1.getName(), "Factories-FooProviderType-1"); - Element cd = fooProvider1.getDescription(); - -// assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl); - - Element[] specs2 = cd.getElements("provides"); - assertEquals("Check specs length", specs2.length, 1); - assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification")); - - Element[] pd2 = cd.getElements("property"); - assertNull("Check props null", pd2); - - // Check Description equality - ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider1.getProperty("component.description"); - assertNotNull("check description equality", desc); - } - - /** - * Check component properties. - */ - @Test - public void testFooProvider2() { - // Test SR properties -// String impl = (String) sr_fooProvider2.getProperty("component.class"); -// assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"); - - String[] specs = (String[]) sr_fooProvider2.getProperty("component.providedServiceSpecifications"); - assertEquals("Check component.providedServiceSpecifications length", specs.length, 1); - assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]); - - PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider2.getProperty("component.properties"); - assertEquals("Check component.properties length", pd.length, 5); - - assertEquals("Check component.properties name [" + 0 + "]", "int", pd[0].getName()); - assertEquals("Check component.properties type [" + 0 + "]", "int", pd[0].getType()); - assertEquals("Check component.properties value [" + 0 + "]", "2", pd[0].getValue()); - - assertEquals("Check component.properties name [" + 1 + "]", "long", pd[1].getName()); - assertEquals("Check component.properties type [" + 1 + "]", "long", pd[1].getType()); - assertEquals("Check component.properties value [" + 1 + "]", "40", pd[1].getValue()); - - assertEquals("Check component.properties name [" + 2 + "]", "string", pd[2].getName()); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType()); - assertEquals("Check component.properties value [" + 2 + "]", "foo", pd[2].getValue()); - - assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd[3].getName()); - assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd[3].getType()); - - assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd[4].getName()); - assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd[4].getType()); - - // Test factory - assertEquals("Check factory name", fooProvider2.getName(), "Factories-FooProviderType-2"); - Element cd = fooProvider2.getDescription(); - -// assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl); - - Element[] specs2 = cd.getElements("provides"); - assertEquals("Check specs length", specs2.length, 1); - assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification")); - - Element[] pd2 = cd.getElements("property"); - assertEquals("Check props length", pd2.length, 5); - - assertEquals("Check component.properties name [" + 0 + "]", "int", pd2[0].getAttribute("name")); - assertEquals("Check component.properties type [" + 0 + "]", "int", pd2[0].getAttribute("type")); - assertEquals("Check component.properties value [" + 0 + "]", "2", pd2[0].getAttribute("value")); - - assertEquals("Check component.properties name [" + 1 + "]", "long", pd2[1].getAttribute("name")); - assertEquals("Check component.properties type [" + 1 + "]", "long", pd2[1].getAttribute("type")); - assertEquals("Check component.properties value [" + 1 + "]", "40", pd2[1].getAttribute("value")); - - assertEquals("Check component.properties name [" + 2 + "]", "string", pd2[2].getAttribute("name")); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type")); - assertEquals("Check component.properties value [" + 2 + "]", "foo", pd2[2].getAttribute("value")); - - assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd2[3].getAttribute("name")); - assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd2[3].getAttribute("type")); - - assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd2[4].getAttribute("name")); - assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd2[4].getAttribute("type")); - - // Check Description equality - ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider2.getProperty("component.description"); - assertNotNull("check description equality", desc); - - // Check that we have the complete metadata - assertNotNull(fooProvider2.getComponentMetadata()); - } - - /** - * Check component properties (dynamic). - */ - @Test - public void testFooProviderDyn2() { - // Test SR properties -// String impl = (String) sr_fooProviderDyn2.getProperty("component.class"); -// assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderTypeDyn2"); - - String[] specs = (String[]) sr_fooProviderDyn2.getProperty("component.providedServiceSpecifications"); - assertEquals("Check component.providedServiceSpecifications length", specs.length, 1); - assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]); - - PropertyDescription[] pd = (PropertyDescription[]) sr_fooProviderDyn2.getProperty("component.properties"); - assertEquals("Check component.properties length", pd.length, 5); - - assertEquals("Check component.properties name [" + 0 + "]", "int", pd[0].getName()); - assertEquals("Check component.properties type [" + 0 + "]", "int", pd[0].getType()); - assertEquals("Check component.properties value [" + 0 + "]", "4", pd[0].getValue()); - - assertEquals("Check component.properties name [" + 1 + "]", "boolean", pd[1].getName()); - assertEquals("Check component.properties type [" + 1 + "]", "boolean", pd[1].getType()); - - assertEquals("Check component.properties name [" + 2 + "]", "string", pd[2].getName()); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType()); - - assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd[3].getName()); - assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd[3].getType()); - - assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd[4].getName()); - assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd[4].getType()); - - // Test factory - assertEquals("Check factory name", fooProviderDyn2.getName(), "Factories-FooProviderType-Dyn2"); - Element cd = fooProviderDyn2.getDescription(); - -// assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl); - - Element[] specs2 = cd.getElements("provides"); - assertEquals("Check specs length", specs2.length, 1); - assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification")); - - Element[] pd2 = cd.getElements("property"); - assertEquals("Check props length", pd2.length, 5); - - assertEquals("Check component.properties name [" + 0 + "]", "int", pd2[0].getAttribute("name")); - assertEquals("Check component.properties type [" + 0 + "]", "int", pd2[0].getAttribute("type")); - assertEquals("Check component.properties value [" + 0 + "]", "4", pd2[0].getAttribute("value")); - - assertEquals("Check component.properties name [" + 1 + "]", "boolean", pd2[1].getAttribute("name")); - assertEquals("Check component.properties type [" + 1 + "]", "boolean", pd2[1].getAttribute("type")); - - assertEquals("Check component.properties name [" + 2 + "]", "string", pd2[2].getAttribute("name")); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type")); - - assertEquals("Check component.properties name [" + 3 + "]", "strAProp", pd2[3].getAttribute("name")); - assertEquals("Check component.properties type [" + 3 + "]", "java.lang.String[]", pd2[3].getAttribute("type")); - - assertEquals("Check component.properties name [" + 4 + "]", "intAProp", pd2[4].getAttribute("name")); - assertEquals("Check component.properties type [" + 4 + "]", "int[]", pd2[4].getAttribute("type")); - - // Check Description equality - ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProviderDyn2.getProperty("component.description"); - assertNotNull("check description equality", desc); - - // Check that we have the complete metadata - assertNotNull(fooProvider2.getComponentMetadata()); - } - - /** - * Check component properties. - */ - @Test - public void testFooProvider3() { - // Test SR properties -// String impl = (String) sr_fooProvider3.getProperty("component.class"); -// assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooProviderType1"); - - String[] specs = (String[]) sr_fooProvider3.getProperty("component.providedServiceSpecifications"); - assertEquals("Check component.providedServiceSpecifications length", specs.length, 1); - assertEquals("Check component.providedServiceSpecifications", FooService.class.getName(), specs[0]); - - PropertyDescription[] pd = (PropertyDescription[]) sr_fooProvider3.getProperty("component.properties"); - assertEquals("Check component.properties length (" + pd.length +")", pd.length, 3); - - assertEquals("Check component.properties name [" + 0 + "]", "foo", pd[0].getName()); - - assertEquals("Check component.properties name [" + 1 + "]", "bar", pd[1].getName()); - - assertEquals("Check component.properties name [" + 2 + "]", "baz", pd[2].getName()); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd[2].getType()); - - // Test factory - assertEquals("Check factory name", fooProvider3.getName(), "Factories-FooProviderType-3"); - Element cd = fooProvider3.getDescription(); - -// assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl); - - Element[] specs2 = cd.getElements("provides"); - assertEquals("Check specs length", specs2.length, 1); - assertEquals("Check specs", FooService.class.getName(), specs2[0].getAttribute("specification")); - - Element[] pd2 = cd.getElements("property"); - assertEquals("Check props length", pd2.length, 3); - - assertEquals("Check component.properties name [" + 0 + "]", "foo", pd2[0].getAttribute("name")); - - assertEquals("Check component.properties name [" + 1 + "]", "bar", pd2[1].getAttribute("name")); - - assertEquals("Check component.properties name [" + 2 + "]", "baz", pd2[2].getAttribute("name")); - assertEquals("Check component.properties type [" + 2 + "]", "java.lang.String", pd2[2].getAttribute("type")); - - // Check Description equality - ComponentTypeDescription desc = (ComponentTypeDescription) sr_fooProvider3.getProperty("component.description"); - assertNotNull("check description equality", desc); - } - - /** - * Test two services provider. - */ - @Test - public void testFooBar() { - // Test SR properties -// String impl = (String) sr_foobarProvider.getProperty("component.class"); -// assertEquals("Check component.class", impl, "org.apache.felix.ipojo.test.scenarios.component.FooBarProviderType1"); - - String[] specs = (String[]) sr_foobarProvider.getProperty("component.providedServiceSpecifications"); - assertEquals("Check component.providedServiceSpecifications length", specs.length, 2); - - assertContains("Check component.providedServiceSpecifications 1", specs, FooService.class.getName()); - assertContains("Check component.providedServiceSpecifications 2", specs, BarService.class.getName()); - - PropertyDescription[] pd = (PropertyDescription[]) sr_foobarProvider.getProperty("component.properties"); - assertEquals("Check component.properties length", pd.length, 0); - - // Test factory - assertEquals("Check factory name", foobarProvider.getName(), "Factories-FooBarProviderType-1"); - Element cd = foobarProvider.getDescription(); - -// assertEquals("Check implementation class ", cd.getAttribute("implementation-class"), impl); - - Element[] specs2 = cd.getElements("provides"); - assertEquals("Check specs length", specs2.length, 2); - assertTrue("Check specs", containsSpecification(FooService.class.getName(), specs2)); - assertTrue("Check specs", containsSpecification(BarService.class.getName(), specs2)); - - Element[] pd2 = cd.getElements("property"); - assertNull("Check props null", pd2); - - // Check Description equality - ComponentTypeDescription desc = (ComponentTypeDescription) sr_foobarProvider.getProperty("component.description"); - assertNotNull("check description equality", desc); - - // Check that we have the complete metadata - assertNotNull(foobarProvider.getComponentMetadata()); - } - - private boolean containsSpecification(String value, Element[] array) { - for (int i = 0; array != null && i < array.length; i++) { - if (array[i] != null && array[i].containsAttribute("specification") && array[i].getAttribute("specification").equals(value)) { - return true; - } - } - return false; - } - - - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java deleted file mode 100644 index 3ba13188b3..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestConfigAdmin.java +++ /dev/null @@ -1,174 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Hashtable; -import java.util.Properties; - -import static org.junit.Assert.*; - -/** - * Check configuration admin reconfiguration. - */ -public class TestConfigAdmin extends Common { - - /** - * Check creation. - */ - @Test - public void testCreation() throws IOException, InterruptedException { - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null); - Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?"); - - Dictionary p = new Hashtable(); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - conf.update(p); - grace(); - - String pid = conf.getPid(); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - assertNotNull("Check instance creation", ref); - - // Deletion of the configuration - conf.delete(); - grace(); - - boolean av = ipojoHelper.isServiceAvailableByName(FooService.class.getName(), pid); - assertFalse("Check instance deletion", av); - } - - /** - * Check creation (push String). - */ - @Test - public void testCreationString() throws IOException, InterruptedException { - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null); - Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?"); - - Dictionary p = new Hashtable(); - p.put("int", "3"); - p.put("long", "42"); - p.put("string", "absdir"); - p.put("strAProp", "{a}"); - p.put("intAProp", "{1,2}"); - - conf.update(p); - grace(); - - String pid = conf.getPid(); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - - assertNotNull("Check instance creation", ref); - - conf.delete(); - grace(); - - boolean av = ipojoHelper.isServiceAvailableByName(FooService.class.getName(), pid); - assertFalse("Check instance deletion", av); - } - - /** - * Check update and delete. - */ - @Test - public void testUpdate() throws IOException, InterruptedException { - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null); - Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?"); - - Dictionary p = new Hashtable(); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - conf.update(p); - grace(); - - String pid = conf.getPid(); - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - - assertNotNull("Check instance creation", ref); - - p.put("int", 4); - conf.update(p); - grace(); - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - Integer test = (Integer) ref.getProperty("int"); - assertEquals("Check instance modification", 4, test.intValue()); - - conf.delete(); - grace(); - - boolean av = ipojoHelper.isServiceAvailableByName(FooService.class.getName(), pid); - assertFalse("Check instance deletion", av); - } - - /** - * Check update and delete. - * (Push String). - */ - @Test - public void testUpdateString() throws IOException, InterruptedException { - ConfigurationAdmin admin = osgiHelper.getServiceObject(ConfigurationAdmin.class, null); - Configuration conf = admin.createFactoryConfiguration("Factories-FooProviderType-2", "?"); - - Dictionary p = new Hashtable(); - p.put("int", "3"); - p.put("long", "42"); - p.put("string", "absdir"); - p.put("strAProp", "{a}"); - p.put("intAProp", "{1,2}"); - - conf.update(p); - grace(); - - String pid = conf.getPid(); - - ServiceReference ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - assertNotNull("Check instance creation", ref); - p.put("int", new Integer("4")); - conf.update(p); - grace(); - - ref = ipojoHelper.getServiceReferenceByName(FooService.class.getName(), pid); - Integer test = (Integer) ref.getProperty("int"); - assertEquals("Check instance modification", 4, test.intValue()); - conf.delete(); - grace(); - - boolean av = ipojoHelper.isServiceAvailableByName(FooService.class.getName(), pid); - assertFalse("Check instance deletion", av); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java deleted file mode 100644 index 547a6b0520..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestFactoryProperties.java +++ /dev/null @@ -1,86 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.architecture.PropertyDescription; -import org.apache.felix.ipojo.runtime.core.services.BarService; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertNull; - -public class TestFactoryProperties extends Common { - - @Test - public void testSimpleExposition() { - ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooProviderType-1"); - assertNotNull("The factory is available", ref1); - String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications"); - assertEquals("Check array length", spec.length, 1); - assertEquals("Check spec", spec[0], FooService.class.getName()); - } - - @Test - public void testDoubleExposition() { - ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooBarProviderType-1"); - assertNotNull("The factory is available", ref1); - String[] spec = (String[]) ref1.getProperty("component.providedServiceSpecifications"); - assertEquals("Check array length", spec.length, 2); - assertContains("Check spec 1", spec, FooService.class.getName()); - assertContains("Check spec 2", spec, BarService.class.getName()); - } - - @Test - public void testProps() { - ServiceReference ref1 = ipojoHelper.getServiceReferenceByName(Factory.class.getName(), "Factories-FooProviderType-Dyn2"); - assertNotNull("The factory is available", ref1); - PropertyDescription[] pd = (PropertyDescription[]) ref1.getProperty("component.properties"); - assertEquals("Check property list size", pd.length, 5); - - //P0 - assertEquals("0) Check name", "int", pd[0].getName()); - assertEquals("0) Check type", "int", pd[0].getType()); - assertEquals("0) Check value", "4", pd[0].getValue()); - - //P1 - assertEquals("1) Check name", "boolean", pd[1].getName()); - assertEquals("1) Check type", "boolean", pd[1].getType()); - assertNull("1) Check value", pd[1].getValue()); - - //P2 - assertEquals("2) Check name", "string", pd[2].getName()); - assertEquals("2) Check type", String.class.getName(), pd[2].getType()); - assertNull("2) Check value", pd[2].getValue()); - - //P3 - assertEquals("3) Check name", "strAProp", pd[3].getName()); - assertEquals("3) Check type", "java.lang.String[]", pd[3].getType()); - assertNull("3) Check value", pd[3].getValue()); - - //P4 - assertEquals("4) Check name", "intAProp", pd[4].getName()); - assertEquals("4) Check type", "int[]", pd[4].getType()); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInstances.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInstances.java deleted file mode 100644 index f2978c93e5..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestInstances.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.ipojo.runtime.core; - - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.ConfigurationException; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.MissingHandlerException; -import org.apache.felix.ipojo.UnacceptableConfiguration; -import org.junit.Test; - -import java.util.Dictionary; -import java.util.Hashtable; - -import static junit.framework.Assert.*; - -/** - * Checks the retrieval of instances and instance names from the Factory. - */ -public class TestInstances extends Common { - - @Test - public void testNoInstances() { - Factory factory = ipojoHelper.getFactory("NoInstances"); - assertNotNull(factory); - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(0, factory.getInstancesNames().size()); - assertEquals(0, factory.getInstances().size()); - } - - @Test - public void testOneDuplicateInstance() { - Factory factory = ipojoHelper.getFactory("OneDuplicateInstance"); - assertNotNull(factory); - - // Create one instance - ComponentInstance instance = createInstanceOrFail(factory, "OneDuplicateInstance-0"); - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(1, factory.getInstancesNames().size()); - assertEquals(1, factory.getInstances().size()); - - assertContains("", factory.getInstancesNames().toArray(new String[1]), "OneDuplicateInstance-0"); - - // Create another instance with the same name - // The instance should not be created, and we should have only the first instance - try { - createInstance(factory, "OneDuplicateInstance-0"); - fail("The instance OneDuplicateInstance-0 has been created with factory " + factory.getName() + ". " - + "It's shouldn't have been created has it's a duplicate instance"); - } catch (UnacceptableConfiguration e) { - // expected Exception - } catch (Exception e){ - fail("Cannot create instance OneDuplicateInstance-0 with factory " + factory.getName() + ". " - + "The wrong exception has been raised : " + e.toString()); - } - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(1, factory.getInstancesNames().size()); - assertEquals(1, factory.getInstances().size()); - - // Dispose of the instance - instance.dispose(); - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(0, factory.getInstancesNames().size()); - assertEquals(0, factory.getInstances().size()); - } - - @Test - public void testFiveInstances() { - Factory factory = ipojoHelper.getFactory("FiveInstances"); - assertNotNull(factory); - - // No instances for the moment - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(0, factory.getInstancesNames().size()); - assertEquals(0, factory.getInstances().size()); - - // Create 5 instances - ComponentInstance[] instances = createNInstanceOrFail(factory, "FiveInstances", 5); - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(5, factory.getInstancesNames().size()); - assertEquals(5, factory.getInstances().size()); - - assertContains("", factory.getInstancesNames().toArray(new String[5]), "FiveInstances-0"); - assertContains("", factory.getInstancesNames().toArray(new String[5]), "FiveInstances-1"); - assertContains("", factory.getInstancesNames().toArray(new String[5]), "FiveInstances-2"); - assertContains("", factory.getInstancesNames().toArray(new String[5]), "FiveInstances-3"); - assertContains("", factory.getInstancesNames().toArray(new String[5]), "FiveInstances-4"); - - // Dispose of instances 0, 3 and 2 - // 2 instances left - instances[0].dispose(); - instances[3].dispose(); - instances[2].dispose(); - - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(2, factory.getInstancesNames().size()); - assertEquals(2, factory.getInstances().size()); - - assertContains("", factory.getInstancesNames().toArray(new String[2]), "FiveInstances-1"); - assertContains("", factory.getInstancesNames().toArray(new String[2]), "FiveInstances-4"); - - // Dispose of instances 1 and 4 - // No instances left - instances[1].dispose(); - instances[4].dispose(); - - assertNotNull(factory.getInstancesNames()); - assertNotNull(factory.getInstances()); - - assertEquals(0, factory.getInstancesNames().size()); - assertEquals(0, factory.getInstances().size()); - } - - public ComponentInstance[] createNInstanceOrFail(Factory factory, String baseName, Integer n) { - ComponentInstance[] instances = new ComponentInstance[n]; - for (int i = 0; i < n; i++) { - instances[i] = createInstanceOrFail(factory, baseName + "-" + i); - } - return instances; - } - - public ComponentInstance createInstanceOrFail(Factory factory, String name) { - ComponentInstance instance = null; - try { - instance = createInstance(factory, name); - } catch (Exception e) { - fail("Cannot create instance " + name + " with factory " + factory.getName() + ". " - + "Raised exception : " + e.toString()); - } - return instance; - } - - public ComponentInstance createInstance(Factory factory, String name) - throws MissingHandlerException, UnacceptableConfiguration, ConfigurationException { - Dictionary conf = new Hashtable(); - conf.put("instance.name", name); - return factory.createComponentInstance(conf); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java deleted file mode 100644 index 97d5c8cbb4..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestObedience.java +++ /dev/null @@ -1,117 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentFactory; -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.apache.felix.ipojo.HandlerManagerFactory; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.runtime.core.services.FooService; -import org.junit.Test; -import org.osgi.framework.ServiceReference; - -import java.util.Properties; - -import static org.junit.Assert.*; - -/** - * Check that instances are disposed when the factory is stopped. - */ -public class TestObedience extends Common { - - @Test - public void testObedience() { - assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName())); - ComponentFactory factory = (ComponentFactory) ipojoHelper.getFactory("Factories-FooProviderType-1"); - assertNotNull("Check factory existing", factory); - - Properties props1 = new Properties(); - props1.put("instance.name", "foo1"); - Properties props2 = new Properties(); - props2.put("instance.name", "foo2"); - - ComponentInstance ci1 = null, ci2 = null; - try { - ci1 = factory.createComponentInstance(props1); - ci2 = factory.createComponentInstance(props2); - } catch (Exception e) { - fail("Cannot instantiate foo providers : " + e.getMessage()); - } - - assertTrue("Check foo1 validity", ci1.getState() == ComponentInstance.VALID); - assertTrue("Check foo2 validity", ci2.getState() == ComponentInstance.VALID); - - assertNotNull("Check foo service", osgiHelper.getServiceReference(FooService.class.getName())); - assertEquals("Check the number of Foo", osgiHelper.getServiceReferences(FooService.class.getName(), null).length, 2); - - factory.stop(); - - assertTrue("Check foo1 invalidity (" + ci1.getState() + ")", ci1.getState() == ComponentInstance.DISPOSED); - assertTrue("Check foo2 invalidity (" + ci1.getState() + ")", ci2.getState() == ComponentInstance.DISPOSED); - - assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName())); - - factory.start(); - assertNull("Check no foo service", osgiHelper.getServiceReference(FooService.class.getName())); - } - - @Test - public void testDisposeAfterFactoryInvalidation() { - ComponentFactory cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType"); - assertNotNull("Check factory availability -1", cf); - assertEquals("Check factory state -1", Factory.VALID, cf.getState()); - - ServiceReference ref_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "SimpleInstance"); - assertNotNull("Check Architecture availability -1", ref_arch); - - HandlerManagerFactory hf = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("controller"); - assertNotNull("Check handler availability -1", hf); - assertEquals("Check handler state -1", Factory.VALID, hf.getState()); - - // Stop the handler - hf.stop(); - HandlerManagerFactory hf2 = (HandlerManagerFactory) ipojoHelper.getFactoryHelper().getHandlerFactory("controller", 1, false); - assertNull("Check handler availability -2", hf2); - - // Check the factory invalidity - cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType"); - assertNotNull("Check factory availability -2", cf); - assertEquals("Check factory state -2", Factory.INVALID, cf.getState()); - - // Check the instance disappearance, the instance was disposed. - assertFalse("Check Architecture availability -1", ipojoHelper - .isServiceAvailableByName(Architecture.class.getName(), "SimpleInstance")); - - // Restart the handler - hf.start(); - hf2 = (HandlerManagerFactory) ipojoHelper.getHandlerFactory("controller"); - assertNotNull("Check handler availability -3", hf2); - - // Check the factory state - cf = (ComponentFactory) ipojoHelper.getFactory("org.apache.felix.ipojo.runtime.core.components.SimpleType"); - assertNotNull("Check factory availability -3", cf); - assertEquals("Check factory state -3", Factory.VALID, cf.getState()); - - - // Check the instance re-creation - ref_arch = ipojoHelper.getServiceReferenceByName(Architecture.class.getName(), "SimpleInstance"); - assertNotNull("Check Architecture availability -3", ref_arch); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestReconfiguration.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestReconfiguration.java deleted file mode 100644 index fd54099281..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestReconfiguration.java +++ /dev/null @@ -1,287 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import junit.framework.Assert; -import org.apache.felix.ipojo.*; -import org.apache.felix.ipojo.architecture.Architecture; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.service.cm.Configuration; -import org.osgi.service.cm.ConfigurationAdmin; - -import java.io.IOException; -import java.util.Dictionary; -import java.util.Properties; - -import static junit.framework.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.fail; - -public class TestReconfiguration extends Common { - - @Test - public void testRevalidationOnReconfiguration() { - ComponentFactory factory = (ComponentFactory) ipojoHelper.getFactory( - "org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType"); - - // First inject a configuration triggering an exception of the validate method. - Properties props = new Properties(); - props.put("prop", "KO"); - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (UnacceptableConfiguration e) { - fail(e.getMessage()); - } catch (MissingHandlerException e) { - fail(e.getMessage()); - } catch (ConfigurationException e) { - fail(e.getMessage()); - } - - assertNotNull(ci); - assertEquals("instance invalid", ComponentInstance.STOPPED, ci.getState()); - - // Reconfigure - props = new Properties(); - props.put("prop", "OK"); - - ci.reconfigure(props); - - assertNotNull(ci); - assertEquals("instance valid", ComponentInstance.VALID, ci.getState()); - } - - @Test public void testRevalidationOnReconfigurationUsingConfigAdmin() throws InvalidSyntaxException { - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("org.apache.felix.ipojo.runtime.core.components" + - ".ReconfigurableSimpleType", "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - // First inject a configuration triggering an exception of the validate method. - props.put("prop", "KO"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - // Due to change in Architecture, the architecture service is still exposed but the instance state is STOPPED. - // This was made to ease debugging to dead instances. - Assert.assertTrue(ipojoHelper.isInstanceStopped(pid)); - - // Reconfigure - props = new Properties(); - props.put("prop", "OK"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - Assert.assertNotNull("architecture", osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - Architecture arch = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Is valid ?", ComponentInstance.VALID, arch.getInstanceDescription().getState()); - } - - @Test public void testRevalidationOnReconfigurationWithController() { - ComponentFactory factory = (ComponentFactory) ipojoHelper.getFactory( - "org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType2"); - - // First inject a configuration triggering an exception of the validate method. - Properties props = new Properties(); - props.put("prop", "KO"); - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (UnacceptableConfiguration e) { - fail(e.getMessage()); - } catch (MissingHandlerException e) { - fail(e.getMessage()); - } catch (ConfigurationException e) { - fail(e.getMessage()); - } - - assertNotNull(ci); - assertEquals("instance invalid", ComponentInstance.INVALID, ci.getState()); // Controller effect. - - // Reconfigure - props = new Properties(); - props.put("prop", "OK"); - - ci.reconfigure(props); - - assertNotNull(ci); - assertEquals("instance valid", ComponentInstance.VALID, ci.getState()); - } - - @Test public void testRevalidationOnReconfigurationUsingConfigAdminAndController() throws InvalidSyntaxException { - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType2", - "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - // First inject a configuration triggering an exception of the validate method. - props.put("prop", "KO"); - - try { - configuration.update(props); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Wait for the processing of the first configuration. - grace(); - - // Invalid ... controller effect - Assert.assertNotNull("architecture", osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - Architecture arch = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Is invalid ?", ComponentInstance.INVALID, arch.getInstanceDescription().getState()); - - // Reconfigure - props = new Properties(); - props.put("prop", "OK"); - - try { - configuration.update(props); - grace(); - } catch (IOException e) { - fail(e.getMessage()); - } - - pid = configuration.getPid(); - - - Assert.assertNotNull("architecture", osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - arch = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Is valid ?", ComponentInstance.VALID, arch.getInstanceDescription().getState()); - } - - @Test public void testRevalidationOnReconfigurationOfTheController() { - ComponentFactory factory = (ComponentFactory) ipojoHelper.getFactory( - "org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType3"); - - // First inject a configuration triggering an exception of the validate method. - Properties props = new Properties(); - props.put("controller", "false"); - ComponentInstance ci = null; - try { - ci = factory.createComponentInstance(props); - } catch (UnacceptableConfiguration e) { - fail(e.getMessage()); - } catch (MissingHandlerException e) { - fail(e.getMessage()); - } catch (ConfigurationException e) { - fail(e.getMessage()); - } - - assertNotNull(ci); - assertEquals("instance invalid", ComponentInstance.INVALID, ci.getState()); // Controller effect. - - // Reconfigure - props = new Properties(); - props.put("controller", "true"); - - ci.reconfigure(props); - - assertNotNull(ci); - assertEquals("instance valid", ComponentInstance.VALID, ci.getState()); - } - - @Test public void testRevalidationOnReconfigurationUsingConfigAdminOfTheController() throws InvalidSyntaxException { - Configuration configuration = null; - try { - configuration = admin.createFactoryConfiguration("org.apache.felix.ipojo.runtime.core.components.ReconfigurableSimpleType3", - "?"); - } catch (IOException e) { - fail(e.getMessage()); - } - Dictionary props = configuration.getProperties(); - if (props == null) { - props = new Properties(); - } - // First inject a configuration triggering an exception of the validate method. - props.put("controller", "false"); - - try { - configuration.update(props); - grace(); - } catch (IOException e) { - fail(e.getMessage()); - } - - String pid = configuration.getPid(); - - // Invalid ... controller effect - Assert.assertNotNull("architecture", osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - Architecture arch = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Is invalid ?", ComponentInstance.INVALID, arch.getInstanceDescription().getState()); - - // Reconfigure - props = new Properties(); - props.put("controller", "true"); - - try { - configuration.update(props); - grace(); - } catch (IOException e) { - fail(e.getMessage()); - } - - pid = configuration.getPid(); - - Assert.assertNotNull("architecture", osgiHelper.getServiceReference(Architecture.class.getName(), "(architecture.instance=" + pid + ")")); - arch = (Architecture) osgiHelper.getServiceObject( Architecture.class.getName(), "(architecture.instance=" + pid + ")"); - - assertEquals("Is valid ?", ComponentInstance.VALID, arch.getInstanceDescription().getState()); - } -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUnacceptableConfiguration.java b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUnacceptableConfiguration.java deleted file mode 100644 index 8cd36c0d25..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/java/org/apache/felix/ipojo/runtime/core/TestUnacceptableConfiguration.java +++ /dev/null @@ -1,836 +0,0 @@ -/* - * 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.ipojo.runtime.core; - -import org.apache.felix.ipojo.ComponentInstance; -import org.apache.felix.ipojo.Factory; -import org.junit.Test; - -import java.util.Properties; - -import static org.hamcrest.core.IsNot.not; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.fail; - -/** - * Test unacceptable configuration. - */ -public class TestUnacceptableConfiguration extends Common { - - /** - * Configuration without the name property. - */ - @Test - public void testWithoutName() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - Properties p = new Properties(); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("an acceptable configuration is refused : " + e.getMessage()); - e.printStackTrace(); - } - - } - - /** - * Configuration without the name property. - */ - @Test - public void testWithoutNameOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2opt"); - - Properties p = new Properties(); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("an acceptable configuration is refused : " + e.getMessage()); - } - - } - - /** - * Empty configuration. - */ - @Test - public void testEmptyConfiguration() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - Properties p = new Properties(); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Empty configuration. - */ - @Test - public void testEmptyConfigurationOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2opt"); - Properties p = new Properties(); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Empty configuration (just the name). - */ - @Test - public void testEmptyConfiguration2() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - Properties p = new Properties(); - p.put("instance.name", "ko"); - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - return; - } - - fail("An unacceptable configuration is accepted"); - } - - /** - * Empty configuration (just the name). - */ - @Test - public void testEmptyConfiguration2opt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - Properties p = new Properties(); - p.put("instance.name", "ko"); - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - - } - - /** - * Null configuration (accept). - */ - @Test - public void testNull() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(null); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Null configuration (accept). - */ - @Test - public void testNullOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2opt"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(null); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Null configuration (fail). - */ - @Test - public void testNull2() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(null); - ci.dispose(); - } catch (Exception e) { - return; - } - - fail("An unacceptable configuration is accepted"); - } - - /** - * Null configuration (success). - */ - @Test - public void testNull2Opt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(null); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - - - } - - /** - * Check static properties. - */ - @Test - public void testStaticOK() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("long", 42l); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check static properties. - */ - @Test - public void testStaticOKopt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("long", 42l); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check dynamic properties. - */ - @Test - public void testDynamicOK() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - e.printStackTrace(); - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - - /** - * Check dynamic properties. - */ - @Test - public void testDynamicOKopt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dynopt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - e.printStackTrace(); - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - - p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - e.printStackTrace(); - fail("An acceptable configuration is rejected (2) : " + e.getMessage()); - } - } - - /** - * Check inconsistent types. - */ - @Test - public void testDynamicBadType() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check inconsistent types. - */ - @Test - public void testDynamicBadTypeOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dynopt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("long", (long) 42); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - - p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected (2) : " + e.getMessage()); - } - } - - /** - * Check good configuration (with overriding). - */ - @Test - public void testDynamicComplete() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check good configuration (with overriding). - */ - @Test - public void testDynamicCompleteOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - - - p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected (2) : " + e.getMessage()); - } - } - - /** - * Check good configuration. - */ - @Test - public void testDynamicJustEnough() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check good configuration. - */ - @Test - public void testDynamicJustEnoughOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - - p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("strAProp", new String[]{"a"}); - - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check good configuration. - */ - @Test - public void testDynamicMix() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check good configuration. - */ - @Test - public void testDynamicMixOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - - p = new Properties(); - p.put("instance.name", "ok"); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check uncomplete configuration. - */ - @Test - public void testDynamicUncomplete() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - return; - } - - fail("An unacceptable configuration is accepted"); - } - - /** - * Check uncomplete configuration. - */ - @Test - public void testDynamicUncompleteOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - - - } - - /** - * Check good configuration (more properties). - */ - @Test - public void testDynamicMore() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - p.put("tralala", "foo"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check good configuration (more properties). - */ - @Test - public void testDynamicMoreOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - p.put("tralala", "foo"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check properties affecting services and component. - */ - @Test - public void testDoubleProps() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - p.put("boolean", false); - p.put("string", "toto"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check properties affecting services and component. - */ - @Test - public void testDoublePropsOpt() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-Dyn2opt"); - - Properties p = new Properties(); - p.put("instance.name", "ok"); - p.put("int", 3); - p.put("boolean", true); - p.put("string", "absdir"); - p.put("strAProp", new String[]{"a"}); - p.put("intAProp", new int[]{1, 2}); - p.put("boolean", false); - p.put("string", "toto"); - - ComponentInstance ci; - try { - ci = f.createComponentInstance(p); - ci.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is rejected : " + e.getMessage()); - } - } - - /** - * Check instance name unicity. - */ - @Test - public void testUnicity1() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - ComponentInstance ci1, ci2, ci3; - try { - ci1 = f.createComponentInstance(null); - ci2 = f.createComponentInstance(null); - ci3 = f.createComponentInstance(null); - assertThat("Check name ci1, ci2", ci1.getInstanceName(), not(ci2.getInstanceName())); - assertThat("Check name ci1, ci3", ci1.getInstanceName(), not(ci3.getInstanceName())); - assertThat("Check name ci3, ci2", ci3.getInstanceName(), not(ci2.getInstanceName())); - ci1.dispose(); - ci2.dispose(); - ci3.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Check instance name unicity. - */ - @Test - public void testUnicity2() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - ComponentInstance ci1, ci2, ci3; - try { - Properties p1 = new Properties(); - p1.put("instance.name", "name1"); - ci1 = f.createComponentInstance(p1); - Properties p2 = new Properties(); - p2.put("instance.name", "name2"); - ci2 = f.createComponentInstance(p2); - Properties p3 = new Properties(); - p3.put("instance.name", "name3"); - ci3 = f.createComponentInstance(p3); - assertThat("Check name ci1, ci2", ci1.getInstanceName(), not(ci2.getInstanceName())); - assertThat("Check name ci1, ci3", ci1.getInstanceName(), not(ci3.getInstanceName())); - assertThat("Check name ci3, ci2", ci3.getInstanceName(), not(ci2.getInstanceName())); - ci1.dispose(); - ci2.dispose(); - ci3.dispose(); - } catch (Exception e) { - fail("An acceptable configuration is refused"); - } - } - - /** - * Check instance name unicity. - */ - @Test - public void testUnicity3() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - - ComponentInstance ci1 = null, ci2; - try { - Properties p1 = new Properties(); - p1.put("instance.name", "name1"); - ci1 = f.createComponentInstance(p1); - Properties p2 = new Properties(); - p2.put("instance.name", "name1"); - ci2 = f.createComponentInstance(p2); - assertThat("Check name ci1, ci2", ci1.getInstanceName(), not(ci2.getInstanceName())); - ci1.dispose(); - ci2.dispose(); - } catch (Exception e) { - if (ci1 != null) { - ci1.dispose(); - } - // OK. - return; - } - - fail("An unacceptable configuration is acceptable"); - } - - /** - * Check instance name unicity. - */ - @Test - public void testUnicity4() { - Factory f = ipojoHelper.getFactory("Factories-FooProviderType-2"); - Factory f2 = ipojoHelper.getFactory("Factories-FooProviderType-1"); - - ComponentInstance ci1 = null, ci2; - try { - Properties p1 = new Properties(); - p1.put("instance.name", "name1"); - ci1 = f.createComponentInstance(p1); - Properties p2 = new Properties(); - p2.put("instance.name", "name1"); - ci2 = f2.createComponentInstance(p2); - assertThat("Check name ci1, ci2", ci1.getInstanceName(), not(ci2.getInstanceName())); - ci1.dispose(); - ci2.dispose(); - } catch (Exception e) { - if (ci1 != null) { - ci1.dispose(); - } - return; - } - - fail("An unacceptable configuration is acceptable"); - } - - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/resources/exam.properties b/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/resources/exam.properties deleted file mode 100644 index d8a500d9d8..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-test/src/test/resources/exam.properties +++ /dev/null @@ -1,19 +0,0 @@ -# -# 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. -# - diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/pom.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/pom.xml deleted file mode 100644 index 43805cf3d9..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/pom.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - org.apache.felix - org.apache.felix.ipojo.runtime.core-it - 1.12.2-SNAPSHOT - - - 4.0.0 - - ipojo-core-factory-version-test - - ${project.artifactId} - - diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyComponent.java b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyComponent.java deleted file mode 100644 index 0631bb68cb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyComponent.java +++ /dev/null @@ -1,30 +0,0 @@ -/* - * 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.ipojo.core.tests.components; - -import org.apache.felix.ipojo.core.tests.services.MyService; - -public class MyComponent implements MyService { - - public void foo() { - // Nothing to do. - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyCons.java b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyCons.java deleted file mode 100644 index b502641d0d..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/components/MyCons.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * 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.ipojo.core.tests.components; - -import org.apache.felix.ipojo.core.tests.services.MyService; - -public class MyCons { - - private MyService[] services; - - public MyCons() { - System.out.println("Bound to " + services.length); - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/services/MyService.java b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/services/MyService.java deleted file mode 100644 index 12ccb6fd43..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/java/org/apache/felix/ipojo/core/tests/services/MyService.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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.ipojo.core.tests.services; - -public interface MyService { - - public void foo(); - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/cons.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/cons.xml deleted file mode 100644 index 9f356297f6..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/cons.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/instances.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/instances.xml deleted file mode 100644 index 2c41b1f0fd..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/instances.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.1.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.1.xml deleted file mode 100644 index 8d481d79bb..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.1.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.xml deleted file mode 100644 index 51c85fe578..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/provider-v1.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v1.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v1.xml deleted file mode 100644 index 5b48b572ff..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v1.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v2.xml b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v2.xml deleted file mode 100644 index 40c9e88344..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/main/resources/vprovider-v2.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - \ No newline at end of file diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/Common.java b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/Common.java deleted file mode 100644 index e959ee960e..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/Common.java +++ /dev/null @@ -1,91 +0,0 @@ -/* - * 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.ipojo.tests.core; - -import org.apache.commons.io.FileUtils; -import org.apache.felix.ipojo.core.tests.services.MyService; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Constants; -import org.ow2.chameleon.testing.helpers.BaseTest; - -import java.io.File; -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; - -import static org.ops4j.pax.exam.CoreOptions.bundle; -import static org.ops4j.pax.tinybundles.core.TinyBundles.withBnd; - -/** - * Bootstrap the test from this project - */ -public class Common extends BaseTest { - - @Override - public boolean deployTestBundle() { - return false; - } - - public Option createServiceBundleV1() throws MalformedURLException { - File out = new File("target/tested/service-v1.jar"); - - if (out.exists()) { - return bundle(out.toURI().toURL().toExternalForm()); - } - - InputStream is = TinyBundles.bundle() - .add(MyService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.core.tests.services") - .build(withBnd()); - try { - FileUtils.copyInputStreamToFile(is, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the bundle"); - } - } - - public Option createServiceBundleV2() throws MalformedURLException { - File out = new File("target/tested/service-v2.jar"); - - if (out.exists()) { - return bundle(out.toURI().toURL().toExternalForm()); - } - - InputStream is = TinyBundles.bundle() - .add(MyService.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ServiceInterface") - .set(Constants.EXPORT_PACKAGE, "org.apache.felix.ipojo.core.tests.services; version=\"2.0.0\"") - .build(withBnd()); - try { - FileUtils.copyInputStreamToFile(is, out); - return bundle(out.toURI().toURL().toExternalForm()); - } catch (MalformedURLException e) { - throw new RuntimeException("Cannot compute the url of the bundle"); - } catch (IOException e) { - throw new RuntimeException("Cannot write of the bundle"); - } - } - -} diff --git a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java b/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java deleted file mode 100644 index b11077e5f0..0000000000 --- a/ipojo/runtime/core-it/ipojo-core-factory-version-test/src/test/java/org/apache/felix/ipojo/tests/core/FactoryVersionTest.java +++ /dev/null @@ -1,176 +0,0 @@ -/* - * 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.ipojo.tests.core; - -import org.apache.commons.io.FileUtils; -import org.apache.felix.ipojo.architecture.Architecture; -import org.apache.felix.ipojo.core.tests.components.MyComponent; -import org.apache.felix.ipojo.core.tests.services.MyService; -import org.junit.Assert; -import org.junit.Test; -import org.ops4j.pax.exam.Option; -import org.ops4j.pax.tinybundles.core.TinyBundles; -import org.osgi.framework.Bundle; -import org.osgi.framework.Constants; -import org.osgi.framework.InvalidSyntaxException; -import org.osgi.framework.ServiceReference; -import org.ow2.chameleon.testing.tinybundles.ipojo.IPOJOStrategy; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - -import static org.ops4j.pax.exam.CoreOptions.bundle; - -public class FactoryVersionTest extends Common { - - - @org.ops4j.pax.exam.Configuration - public Option[] config() throws IOException { - - Option[] options = super.config(); - - File provider1 = new File("target/tested/provider-v1.jar"); - FileUtils.copyInputStreamToFile( - TinyBundles.bundle() - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderV1") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.core.tests.services") - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources/provider-v1.xml"))), - provider1); - - File provider2 = new File("target/tested/provider-v1.1.jar"); - FileUtils.copyInputStreamToFile( - TinyBundles.bundle() - .add(MyComponent.class) - .set(Constants.BUNDLE_SYMBOLICNAME, "ProviderV1.1") - .set(Constants.IMPORT_PACKAGE, "org.apache.felix.ipojo.core.tests.services") - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources/provider-v1.1.xml"))), - provider2); - - File instance = new File("target/tested/instance.jar"); - FileUtils.copyInputStreamToFile( - TinyBundles.bundle() - .set(Constants.BUNDLE_SYMBOLICNAME, "Instances") - .build(IPOJOStrategy.withiPOJO(new File("src/main/resources/instances.xml"))), - instance); - - List